Hello, everyone.
This part is a bit confusing so I need some clarity regarding it.
O > O IA > External Routes
The routes on the left (before >) will always be preferred over the ones on the right, regardless of the cost?
Take 192.168.1.0/24 as an example. It’s an inter-area route from the perspective of R3
R3#
O IA 192.168.1.0/24 [110/2] via 20.20.20.4, 00:52:06, GigabitEthernet
Now, I will configure this exact same network on R7-XR (so R3 will also receive a intra-area route). I will give it a very high cost.
R7-XR#
interface Loopback0
ipv4 address 192.168.1.1 255.255.255.0
router ospf 110
auto-cost reference-bandwidth 10000
area 2
interface Loopback0
cost 665
loopback stub-network enable
R3, who had the O IA route now replaced it with the O route.
R3#
O 192.168.1.0/24 [110/666] via 192.168.5.7, 00:17:18, GigabitEthernet2
R3 didn’t care whether the cost was higher or lower, all it cared about was the fact that this comes from inside the area so it should be preferred.
All of this works fine for O > O IA > external routes but starting from external routes, it works differently?
Let’s focus on N1 > E1 > N2 > E2 now.
R5 is redistirbuting 6.6.6.6/32 into Area 51 as a N1 route and advertising this to R4. I’ve also configured R2-XR to redistribute that exact same network as a E1 route (I’ve cut the link to Area 51 for R2-XR because it would advertise the route as N1 there). The blue area on the right is a normal area and R4 is receiving the E1 route there.
R4#show ip ospf database
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
6.6.6.6 2.2.2.2 1031 0x80000002 0x0011EE 0
Type-7 AS External Link States (Area 51)
Link ID ADV Router Age Seq# Checksum Tag
6.6.6.6 5.5.5.5 33 0x8000000C 0x0091DE 0
At the moment, the cost is exactly the same for both routes and R4 is preferring the N1 route.
O N1 6.6.6.6 [110/21] via 192.168.1.5, 00:01:35, GigabitEthernet2
If I change the metric on R5 to a larger value (the 6.6.6.6/32 prefix is coming from EIGRP)
R5(config-router)#redistribute eigrp 100 metric 500
R4 will now prefer the E1 route
O E1 6.6.6.6 [110/21] via 20.20.20.2, 00:00:10, GigabitEthernet1
So if there are two routes of the same metric type (E1/N1), N1 will only be preferred if the cost ties? Which isn’t how it works with O and IA routes, those will always be preferred one over the other regardless of the cost.
If I tell R2-XR to advertise an E2 route instead, the N1 route will be preferred regardless of the metric on R4.
O N1 172.16.10.0 [110/501] via 192.168.1.5, 00:00:15, GigabitEthernet2
So to summarize, different route types O > O IA > N/E-1 > N/E-2 will always be preferred over eachother, regardless of the cost. An O Route will beat an O IA route. An E1 route will beat an E2 or an N2 route.
However, routes of the same kind such as E1 or N1 will only be preferred if the cost ties?
Thank you
David