Type 7 to Type 5 Translation
Last updated
Last updated
You may already know that the ABR for an NSSA area translates Type 7 LSAs injected by an ASBR into Type 5 LSAs. But how exactly does this work? Are Type 4 LSAs generated? If so, how are they used?
What happens when there are multiple ABRs for the NSSA area?
Do routers in other areas calculate the path to the external prefixes based on the ABR’s address or the ASBR’s address?
If you are fuzzy on the answers to any of these questions, read on and lab along! I hope that this article will give you some clarity on how Type 7 to Type 5 LSA translation works.
We’ll use this topology:
The cost of all links is 1, except for the link between R3-R4, which has a symmetrical cost of 5.
Here is the startup-config for all routers:
We’ll create Lo1 on R1, and redistribute it as an N2 route into Area 2, which is a NSSA.
Before moving on, try to predict what you will see on R4 (the ABR for Area 0 and Area 1). There are several possibilities you might consider such as:
Two Type 5 LSAs, Two Type 4 LSAs
Two Type 7 LSAs, Two Type 4 LSAs
Two Type 5 LSAs, No Type 4 LSAs
etc.
Once you’ve thought it through, check your answer against the OSPF database on R4:
The answer is that there is a single Type 5 LSA (for both areas, since the type 5 is flooded domain-wide), and there are two Type 4 LSAs for all non-backbone areas. (Which in this case, the only non-backbone area R4 is connected to is Area 1). Remember that the Type 7 LSA is only seen within the NSSA area itself (Area 2). Therefore it is not seen on R4.
So R3 translated the Type 7 LSA into a Type 5 LSA. But why isn’t there also a Type 5 LSA generated by R2? This is because for an NSSA area, only one ABR will translate the Type 7 LSA to a Type 5 LSA.
How does R2 know to let R3 translate the Type 7 into a Type 5? The ABR with the highest RID in the NSSA area will do the translation. In this case, it is R3.
If you don’t completely understand why it works this way, don’t worry. The reason for this will become more clear as you continue on.
Which path do you think R4 takes to get to 101/8? Will it go through R2 or R3?
R4 learned 101/8 from the Type 5 LSA generated by R3 (3.3.3.3), but the next hop is R2 (10.2.4.2)! Why?
This is because when a Type 7 LSA is translated into Type 5 LSA by an NSSA ABR, the ABR adds a forward address to the Type 5 LSA. The forward address is the next-hop that the ABR has to the destination. In this case, the forward address would be the next-hop that R3 has for the 101/8 route in its RIB, which would be R1’s IP address on Gi2.
Check out the Type 5 LSA, paying attention to the second-to-last line:
10.1.3.1 is R1’s IP address on Gi2.
Normally for regular Type 5 LSAs, you would see the forward address as 0.0.0.0, which means the router that generated the LSA also injected the route into OSPF. When the forward address is 0.0.0.0, the router preforms a lookup on the ABR itself to determine the path. If the ABR is not part of the local area, the router uses the Type 4 LSA to determine the path to the ABR.
To find the best path for 101/8, R4 does a recursive lookup on the forward address 10.1.3.1, not 3.3.3.3. R4 knows 10.1.3.1 via both R2 and R3.
But R4’s best route to 10.1.3.1 is through R2, because the R3-R4 link has a cost of 5.
This process actually explains why only one ABR generates the Type 5. When the forwarding address is non-zero (meaning there exists some forwarding address that is not 0.0.0.0 in the Type 5 LSA), the forwarding lookup is based on the forward address, not the ABR that originated the Type 5. Therefore it would be needlessly redundant if both R2 and R3 generate a Type 5 LSA that says that the forward address is 10.1.3.1.
Imagine if there were many more Type 7 LSAs, and many more ABRs for Area 2. It would be a complete waste of resources to flood all those Type 5 LSAs and store them in memory. All other routers would treat the copies of the LSAs the same anways, because they are all calculating the path based on the forwarding address, not which ABR originated the Type 5 LSA.
Read this snippet from RFC 2328 for the official documentation for this feature:
This explains why we only see the Type 5 LSA from R3 and not R2.
We’ve figured out how R4 determined the path to 101/8. How does R5 determine the path to 101/8? The answer is that R5 also does a recursive lookup on 10.1.3.1, even though it has the Type 4 LSAs. When the forwarding address of a Type 5 LSA is non-zero, the router does path calculation based on that forwarding address instead of the ABR.
To prove that R5 is doing this recursive lookup, let’s filter the 10.1.3.0/24 Type 3 LSA on both R2 and R3. R5 will no longer have an inter-area route for 10.1.3.0/24 known from R4.
After about 10 seconds, R5 removes the 101/8 route from its RIB:
RFC 2328 says that the forwarding address must be known via an intra-area or inter-area route:
We’ve seen that only a single ABR for the NSSA area translates the Type 7 LSA into a Type 5. All other routers do a recursive lookup based on the forward address, which in this case is the ASBR itself at 10.1.3.1. But why do we even need the Type 4 LSAs then? What purpose does the Type 4 LSA serve in this scenario?
Harold Ritter states in this Cisco thread (https://community.cisco.com/t5/switching/ospf-type-4-lsas-nssa/td-p/805088/page/2 ) that the Type 4 is used in this case to let other routers know that the ASBR is still available. If the ASBR goes down, the ABR can max age the Type 4 LSA.
To be honest, this doesn’t make sense to me. The ABR for the NSSA area that did the translation (R3) did not generate a Type 4 in the first place, therefore it can’t max age a Type 4. R4 generated the Type 4 LSAs. Also, why can’t R3 just max age the Type 5 LSA?
Instead I believe that the reason we have the Type 4 LSAs is to be able to properly build the OSPF graph. Type 5 LSAs must have an associated Type 4 LSA in order to let internal routers in non-backbone areas build the graph correctly.
While the router does path selection based on the fowarding address, the OSPF graph needs to connect the 101/8 to R3, since R3 originated the Type 5 LSA. But without a Type 4 LSA, R5 has nowhere to “put” or “place” R3 in its own graph. So R5 needs the Type 4 LSA in order to connect R3 to R4, and then hangs 101/8 off of R3.
The graph that R5 builds based on its LSDB
So the purpose of the Type 4 LSA in this case, I believe, is not for path selection, but to be able to place the 101/8 prefix in the graph.