Well, at least one of you asked... and I did promise! Next we'll move on to Type 5 (external) LSAs. (yeeha!) But if you didn't yet vote for your top requests from Santa for this year, at least relative to Cisco certs, pop back to Tuesday's post to weigh in. This topic will take me a few posts, so let's jump right in.
OSPF creates a type 5 LSA for a subnet that is injected into OSPF from an external source. To inject the route, the autonomous System Border Router (ASBR), which is by definition a router that connects to a non-OSPF routing domain, uses the redistribute command. The redistribute command, which might be more descriptively named the "get-routes-from-elsewhere" command, pulls routes into OSPF. To represent those routes, OSPF often times creates a type 5 LSA. (In other cases, a type 7 is created; that happens when the area is an NSSA area. More maybe on that before we're done.)
Type 5 LSAs come in 2 types, or metric types: External type 1 and type 2 (default). I'll touch on the simpler type 2 today.
LSA type 5, metric type 2 (often called external 2 or external type 2 to avoid confusion with the LSA types) is:
- Created by the ASBR
- LSA contains the metric as dictated by the ASBR
- Flooded by ABR's to other normal (non-stubby) OSPF areas
- The flooding process does not change the metric in the type 5 LSA
- Routers choose "best" route based on the metric in the ASBR; the OSPF cost calculation ignores the costs inside the OSPF domain, instead using only the cost listed in the type 5 LSAs.
For example, consider the following figure. In this case, routers R1 and R4 both learn a route for 11.0.0.0/8 from somewhere outside OSPF (eg, BGP). R1 creates and floods a type 5 LSA (E2, or external type 2) for network 11.0.0.0, with metric 10. R4 creates/floods a different type 5 LSA (E2), but with its metric (metric 15). R2 sees both LSAs, then floods both LSAs into area 1, so R3 sees both type 5 LSAs.
Given the comments before the figure, R2's route for 11.0.0.0/8 will use R1 as the next-hop, with a metric of 10 - the metric of the Type 5 LSA flooded by R1. Similarly, R3's route will use R2 as a next-hop, with metric 10 - again ignoring the OSPF costs.
(Food for thought: External Type 1 routes make the routers add the internal OSPF cost when calculating the metric for each route. What would R2's and R3's metrics be then for their respective routes for 11.0.0.0/8?)
More then on OSPF LSA type 5, External type 1 next blog post.
To try this at home, you can do a shorter version of the lab with just two routers. Configure the IP addresses as shown in this figure, including the loopback on R2. Make sure all the interfaces, or the equivalent on your lab, are up/up. Then add the following config to the two routers:
On R2:
Interface loopback 1
Ip address 11.1.1.2 255.0.0.0
Interface Fa0/1
Ip address 10.2.12.2 255.255.255.0
No shut
Interface serial 0/0/0
Clock rate1536000
Ip address 10.2.23.2 255.255.255.0
No shutdown
Router ospf 1
Router-id 2.2.2.2
Network 10.2.12.0 0.0.0.255 area 0
Network 10.2.23.0 0.0.0.255 area 1
Redistribute connected metric 10
On R3:
Interface Serial0/0/1
Ip address 10.2.23.3 255.255.255.0
No shutdown
Interface fastethernet 0/0
Ip address 10.2.3.3 255.255.255.0
No shutdown
Router ospf 1
Router-id 3.3.3.3
Network 10.0.0.0 0.255.255.255 area 1
The redistribute connected command on R2 will inject an external route into OSPF, defaulting to External type 2. R2 will create an LSA type 5 in area 0, and then also in area 1 - and flood the LSA to R3 as well.
If you try this at home, then, on both R2 and R3, try the show ip ospf database, show ip ospf database external, and show ip route commands. On R3, you should see a metric 10 route ("10" as the second number in brackets) in show ip route for 11.0.0.0/8. You should also see the type 5 LSA, with metric 10, with advertising router ID of 2.2.2.2 (R2).
(If you found this page helpful, let me know. I debated whether to bother to give you a simple test using few routers, figuring the fewer routers, the more people that would have enough gear to try it. Thanks...)