Last time, we talked about a nifty little lab I set up for redistribution and how the OSPF ASBRs acted a little differently than I expected. This time, let’s look at how changing external OSPF routes to a metric-type of 1 (E1) affects the routing tables.
Here’s the network again.
The static routes are being redistributed into their respective IGPs, and EIGRP is being redistributed into OSPF. Let’s look at the routing table on R1.
123456789101112131415 Gateway of last resort is not set10.0.0.0/8 is variably subnetted, 7 subnets, 2 masksO 10.0.0.2/32 [110/11] via 192.168.0.102, 00:06:53, Ethernet0/0O E2 10.0.0.3/32 [110/20] via 192.168.0.105, 00:06:53, Ethernet0/0[110/20] via 192.168.0.102, 00:06:53, Ethernet0/0S 10.10.10.0/24 is directly connected, Null0C 10.0.0.1/32 is directly connected, Loopback0O E2 10.0.0.4/32 [110/20] via 192.168.0.105, 00:06:53, Ethernet0/0[110/20] via 192.168.0.102, 00:06:53, Ethernet0/0O 10.0.0.5/32 [110/11] via 192.168.0.105, 00:06:53, Ethernet0/0O E2 10.10.20.0/24 [110/20] via 192.168.0.105, 00:06:03, Ethernet0/0C 192.168.0.0/24 is directly connected, Ethernet0/0O E2 192.168.101.0/24 [110/20] via 192.168.0.105, 00:06:53, Ethernet0/0[110/20] via 192.168.0.102, 00:06:53, Ethernet0/0
Notice that there are two routes to each of the networks discovered from EIGRP (the loopbacks of 10.0.0.3/32 and 10.0.0.4/32 as well as 192.168.101.0/24). There is nothing strange here; OSPF simply sees the exit paths through the ASBRs. How about if we change the metric-type on the routes from R2 and see what happens?
I know of at least two ways you can do it. First, you can set the metric-type in the redistribute command on the ASBR’s OSPF process.
1 redistribute eigrp 1 subnets metric-type 1
You can also use a route-map to set the metric-type and apply that to the redistribute command.
1234 route-map TEST permit 10set metric-type type-1!redistribute eigrp 1 route-map TEST subnets
Either way does the same thing. Now let’s check the route table on R1 again.
123456789101112 Gateway of last resort is not set10.0.0.0/8 is variably subnetted, 7 subnets, 2 masksO 10.0.0.2/32 [110/11] via 192.168.0.102, 00:18:30, Ethernet0/0O E1 10.0.0.3/32 [110/30] via 192.168.0.102, 00:02:11, Ethernet0/0S 10.10.10.0/24 is directly connected, Null0C 10.0.0.1/32 is directly connected, Loopback0O E1 10.0.0.4/32 [110/30] via 192.168.0.102, 00:02:11, Ethernet0/0O 10.0.0.5/32 [110/11] via 192.168.0.105, 00:18:30, Ethernet0/0O E2 10.10.20.0/24 [110/20] via 192.168.0.105, 00:17:40, Ethernet0/0C 192.168.0.0/24 is directly connected, Ethernet0/0O E1 192.168.101.0/24 [110/30] via 192.168.0.102, 00:02:11, Ethernet0/0
Only one route this time, and it’s the E1 route from R2. It seems that E1 routes are more preferred than E2 routes. Let’s look at the OSPF database for 192.168.101.0/24 on R1 to see if we can figure that out.
12345678910111213141516171819202122232425262728293031323334353637 R1#sh ip ospf database external 192.168.101.0OSPF Router with ID (10.0.0.1) (Process ID 1)Type-5 AS External Link StatesRouting Bit Set on this LSALS age: 467Options: (No TOS-capability, DC)LS Type: AS External LinkLink State ID: 192.168.101.0 (External Network Number )Advertising Router: 10.0.0.2LS Seq Number: 80000004Checksum: 0xEA58Length: 36Network Mask: /24Metric Type: 1 (Comparable directly to link state metric)TOS: 0Metric: 20Forward Address: 0.0.0.0External Route Tag: 0Routing Bit Set on this LSALS age: 1497Options: (No TOS-capability, DC)LS Type: AS External LinkLink State ID: 192.168.101.0 (External Network Number )Advertising Router: 10.0.0.5LS Seq Number: 80000001Checksum: 0x6260Length: 36Network Mask: /24Metric Type: 2 (Larger than any link state path)TOS: 0Metric: 20Forward Address: 0.0.0.0External Route Tag: 0
You can see that everything is the same except for the metric-type field, which is exactly what we expect. By definition, if an external OSPF route is E1, the internal OSPF cost is added to the total cost of the route. This is reflected in the “Comparable directly to link state metric” text next to the Metric Type value. In contrast, an E2 route does not have the cost incremented; the cost is simply passed down the line as “Larger than any link state path”. This means that E1 routes are considered more accurate and should be more preferred than E2 routes.
Just another complexity of OSPF. Thanks to @matthewnorwood, @jameskazin, @steve, @wannabeccie, @ciscotophat, and @lbsources for the insight into the route differences.
Send any twitter updates questions my way.
Audio Commentary
[audio:http://aconaway.com/wp-content/uploads/2010/06/ROUTE-Redistribution-Nuance-2.mp3|titles=ROUTE – Redistribution Nuance #2]
Don’t think I’ve read this point made anywhere, very interesting thanks.
If you’d asked me before I would have said it would have preferred the E2 due to lower cost (Here 20 to 30), logic foiled again! Also the post could be titled OSPF Nuisances rather than Nuances 😉
I’m with you, Steve. Logic says the best metric should win, but everyone forgets to include the tie-breaker of metric type. *sigh*