Router A and router B are advertising the subnet 192.168.0.0/24 on loopback interface. Router C selects router A by default as the preferred path.
I want to change the preferred path by changing the cost on the Router A interface eth0 and loopback. I assume Router C should choose Router B as the preferred path, but unfortunately it doesn’t.
Hmm the calculated cost from C’s perspective is the sum of costs of each egress interface to the destination prefix.
Modifying the cost eth0 should have no effect on C’s choice of path.
Can you show the output of ‘show ip ospf interface lo’ on router A and see what the cost is reporting as? That is the only interface that will effect the path.
Hm, try including Lo in the area instead of redistributed the connected routes. Redistributed will cause the ospf process to ignore the cost on Lo as it’s imported from an external routing source.
interfaces {
ethernet eth0 {
address 172.16.1.254/16
duplex auto
smp_affinity auto
speed auto
}
loopback lo {
address 192.168.0.1/24
ip {
ospf {
cost 100
dead-interval 40
hello-interval 10
priority 1
retransmit-interval 5
transmit-delay 1
}
}
}
}
protocols {
ospf {
area 0.0.0.0 {
network 172.16.0.0/16
network 192.168.0.0/24
}
parameters {
abr-type cisco
router-id 172.16.1.254
}
}
}
Router B:
interfaces {
ethernet eth0 {
address 172.16.2.254/16
duplex auto
smp_affinity auto
speed auto
}
loopback lo {
address 192.168.0.1/24
}
}
protocols {
ospf {
area 0.0.0.0 {
network 172.16.0.0/16
network 192.168.0.0/24
}
parameters {
abr-type cisco
router-id 172.16.2.254
}
}
}
Router C:
interfaces {
ethernet eth0 {
address 172.16.0.254/16
duplex auto
smp_affinity auto
speed auto
}
ethernet eth1 {
address dhcp
duplex auto
hw-id 08:00:27:eb:dd:fb
smp_affinity auto
speed auto
}
loopback lo {
}
}
protocols {
ospf {
area 0.0.0.0 {
network 172.16.0.0/16
}
parameters {
abr-type cisco
router-id 172.16.0.254
}
}
}
And this is the result.
Router C:
$ show ip route ospf
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
I - ISIS, B - BGP, > - selected route, * - FIB route
O 172.16.0.0/16 [110/10] is directly connected, eth0, 00:04:10
O>* 192.168.0.1/32 [110/20] via 172.16.2.254, eth0, 00:04:10
The route of Router A is gone because of the cost in the loopback interface.
When I disable the interface eth0 of router B. I get the following:
Router C:
$ show ip route ospf
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
I - ISIS, B - BGP, > - selected route, * - FIB route
O 172.16.0.0/16 [110/10] is directly connected, eth0, 00:22:44
O>* 192.168.0.1/32 [110/110] via 172.16.1.254, eth0, 00:00:38
It works. Great!
But is there a command to see all the backup routes, including the routes that has cost in the interface?
[/code]
Yeah what you are observing is only the best, or equal, routes get installed in the rib.
The command you’re looking for is ‘show ip ospf database’, and specifically, ‘show ip ospf database router’. It’s less useful though because it’s a dump of the topology, and I’m not aware of a command that can ask it to only print out topology information for one prefix.