In this post we are going to talk about some not so well-known behavior of OSPF, I find all these mechanisms pretty brilliant in the execution.
Most of the people got it right that one of the loop avoidance mechanism is the requirement that Area 0 is always between two areas, all routers must have an interface into Area 0.
We will see also LSA 1, 2 and 3 which always go together and interact with each other. Type 3 are the way to send information outside of your area.
We will see some hidden mechanisms that show the OSPF true power, let’s take a look.
First a little about LSA 1 and LSA 3 types
To fully understand all the loop avoidance mechanisms that will come later, we have to understand the behavior of LSA 1 and LSA type 3.
First let’s talk about two very important concepts that will be handy to know beforehand:
- Topology information: Is a blueprint of the area, who is connected to who and which interfaces I have myself as a router point of view. All routers generate this information as LSA type 1.
- Reachability information: Basically the subnets or prefixes. This information is included inside Type 1 LSA as well as Type 3 LSAs.
LSA 1 Router LSA: They contain the topology information(who is connected to who and what links do I have connected) and also reachability information(subnets information)
LSA 2 Network LSA: If we have DR/BDR we will have also LSA type 2 in the area, it’s a efficiency mechanism. It contains the mask information for the segment and all the routers that are fully adjacent with the DR.
LSA 3 summary LSA: Only has reachability information. It contains a summary of Type 1 and Type 2 into a single LSA 3 per route (hence the name). It is not automatically summarizing the subnets; the summary is just T1 and T2 into a single T3. They carry the cost to reach the route from the ABR point of view.
Type 1 and Type 2 cannot leave the area from where they were created, that’s why ABR has to generate LSA type 3 to summarize that information into another area.
Type 3 LSA is the way an ABR can send the reachability information to the Area 0, but not the topology information. LSA 3 will be re-generated by the next ABR when is going to be injected into another area from Area 0.
Type 3 LSA also cannot leave the area where it was created, that’s why at every ABR LSA 3 will be created again with the last ABR information. Every ABR will include their cost to reach the subnet when they re-generate a new LSA 3 into another area.
If Type 3 are not allowed inside an area, due to any loop prevention mechanism we won’t see any new reachability information coming from another area.
How OSPF avoid loops?
Two general ways: Area 0 behavior and Hierarchy with routes
Area 0 – Backbone rules
Area 0 must be between two areas, or all routers must have an interface in Area 0 if they want to connect to another area. LSA3 are blocked from non-backbone into another non-backbone area.
Type 3 LSA can only go from non-backbone (area 0) into backbone. It won’t be allowed to move between non-backbone areas.
If information would be allowed to go between non-backbone areas, the information will be duplicated fast, as when Area 25 router gets the Subnet S it will announce it to area 0 and Area 10 again.
Area 0 must be contiguous, you cannot send LSA3 from non-backbone into backbone. If Area 0 it’s broken in two parts you can fix it with a GRE tunnel or a Virtual-link.
Here we see that with two redundant ABRs, by not allowing T3 from non-backbone into backbone we don’t allow Subnet Y and Subnet S to be injected again back into Area 0.
Area 0 must be in the middle of two areas, like hub and spoke design.
Routes hierarchy to avoid loops
3 types of routes from most preferred to least preferred:
- Intra-area (type 1 and type 2 LSA)
- Inter-area (Type 3 LSA)
- Externals (Type 5, Type 7)
If we receive the same subnet from different sources, always follow this priority. It doesn’t matter the cost. Intra-area routes are more preferred.
- OSPF have a cold-potato routing behavior, cold potato is trying to keep the traffic inside all the time possible even if it is not optimal, in this case if we receive same prefix as external and as intra-area we will use the intra-area.
- Another type of routing is hot-potato routing, which means forward the traffic as fast as possible out of the autonomous system into another site. (BGP behavior).
Why is this hierarchy important? If we only follow cost to decide how to route our prefixes, we could have a loop. As we mentioned above, routers inside an area do not know any topology information outside their area.
Check the next example:
Imagine if we have Subnet Y with cost 20 in the Area 25, but we received from the outside world (AREA 0 and beyond) the same subnet Y with a lower cost 10 as Type 3 or Type 5, if we follow just the cost we would send the traffic the wrong way as we don’t have any clue of what’s beyond our directed connected routers in Area 0. See picture below.
OSPF fix that problem by choosing hierarchy over cost, we will always prefer the intra-area route with any cost over any other that’s not intra-area for the same subnet.
Is important to note that OPSF behaves as a link-state protocol inside an area, but as a distance-vector when we are talking between areas.
That’s because we don’t have any topology visibility outsidse of our area, we just know what are the routes/subnets our direct neighbors tell us about.
This was a little deeper post, but I hope that you got new ideas and a new vision of the loop avoidance mechanisms of OSPF.
Also maybe you were surprised to find out that OSPF behaves like a distance-vector protocol at times; I was for sure surprised when I found it out!
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?