Type 7 to Type 5 Translation

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.

Lab

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:

#R1
int Gi1
 ip address 10.1.2.1 255.255.255.0
 no shut
!
int Gi2
 ip address 10.1.3.1 255.255.255.0
 no shut
!
int Lo0
 ip address 1.1.1.1 255.255.255.255
!
router ospf 1
 network 10.1.0.0 0.0.255.255 area 2
 area 2 nssa

#R2
int Gi1
 ip address 10.1.2.2 255.255.255.0
 no shut
!
int Gi2
 ip address 10.2.4.2 255.255.255.0
 no shut
!
int Lo0
 ip address 2.2.2.2 255.255.255.255
!
router ospf 1
 network 10.1.2.0 0.0.0.255 area 2
 network 10.2.4.0 0.0.0.255 area 0
 area 2 nssa

#R3
int Gi1
 ip address 10.1.3.3 255.255.255.0
 no shut
!
int Gi2
 ip address 10.3.4.3 255.255.255.0
 ip ospf cost 5
 no shut
!
int Lo0
 ip address 3.3.3.3 255.255.255.255
!
router ospf 1
 network 10.1.3.0 0.0.0.255 area 2
 network 10.3.4.0 0.0.0.255 area 0
 area 2 nssa

#R4
int Gi1
 ip address 10.2.4.4 255.255.255.0
 no shut
!
int Gi2
 ip address 10.3.4.4 255.255.255.0
 ip ospf cost 5
 no shut
!
int Gi3
 ip address 10.4.5.4 255.255.255.0
 no shut
!
int Lo0
 ip address 4.4.4.4 255.255.255.255
!
router ospf 1
 network 10.2.4.0 0.0.0.255 area 0
 network 10.3.4.0 0.0.0.255 area 0
 network 10.4.5.0 0.0.0.255 area 1

#R5
int Gi1
 ip address 10.4.5.5 255.255.255.0
 no shut
!
int Lo0
 ip address 5.5.5.5 255.255.255.255
!
router ospf 1
 network 0.0.0.0 255.255.255.255 area 1

We’ll create Lo1 on R1, and redistribute it as an N2 route into Area 2, which is a NSSA.

#R1
int lo1
 ip address 101.0.0.1 255.0.0.0
!
route-map MATCH_LO1 permit 10
 match interface Lo1
!
router ospf 1
 redistribute connected route-map MATCH_LO1

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:

R4#show ip ospf data 
<snip>
                Summary ASB Link States (Area 1)
          
Link ID         ADV Router      Age         Seq#       Checksum
2.2.2.2         4.4.4.4         234         0x80000001 0x00B072
3.3.3.3         4.4.4.4         237         0x80000001 0x00829C

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
101.0.0.0       3.3.3.3         78          0x80000001 0x001709 0

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.

R4’s path selection process

Which path do you think R4 takes to get to 101/8? Will it go through R2 or R3?

R4#show ip route 101.0.0.0
Routing entry for 101.0.0.0/8
  Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 3
  Last update from 10.2.4.2 on GigabitEthernet1, 00:00:29 ago
  Routing Descriptor Blocks:
  * 10.2.4.2, from 3.3.3.3, 00:00:29 ago, via GigabitEthernet1
      Route metric is 20, traffic share count is 1

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:

R4#show ip ospf data external 

            OSPF Router with ID (4.4.4.4) (Process ID 1)

                Type-5 AS External Link States

  LS age: 992
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 101.0.0.0 (External Network Number )
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000001
  Checksum: 0x1709
  Length: 36
  Network Mask: /8
        Metric Type: 2 (Larger than any link state path)
        MTID: 0 
        Metric: 20 
        Forward Address: 10.1.3.1
        External Route Tag: 0
  • 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.

R4#show ip ospf database summary 10.1.3.0

            OSPF Router with ID (4.4.4.4) (Process ID 1)

                Summary Net Link States (Area 0)

  LS age: 13
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(Network)
  Link State ID: 10.1.3.0 (summary Network Number)
  Advertising Router: 2.2.2.2
  LS Seq Number: 80000001
  Checksum: 0xB173
  Length: 28
  Network Mask: /24
        MTID: 0         Metric: 2 

  LS age: 4
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(Network)
  Link State ID: 10.1.3.0 (summary Network Number)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000001
  Checksum: 0x8998
  Length: 28
  Network Mask: /24
        MTID: 0         Metric: 1

But R4’s best route to 10.1.3.1 is through R2, because the R3-R4 link has a cost of 5.

R4#show ip route 10.1.3.0
Routing entry for 10.1.3.0/24
  Known via "ospf 1", distance 110, metric 3, type inter area
  Last update from 10.2.4.2 on GigabitEthernet1, 00:02:02 ago
  Routing Descriptor Blocks:
  * 10.2.4.2, from 2.2.2.2, 00:02:02 ago, via GigabitEthernet1
      Route metric is 3, traffic share count is 1

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:

# Section 12.4.4.1.  Examples of AS-external-LSAs

if two routers, both reachable
from one another, originate functionally equivalent
AS-external-LSAs (i.e., same destination, cost and
non-zero forwarding address), then the LSA
originated by the router having the highest OSPF
Router ID is used.  The router having the lower OSPF
Router ID can then flush its LSA.

This explains why we only see the Type 5 LSA from R3 and not R2.

R5’s path selection process

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.

! Here we see the two Type 4 LSAs (which are not used for path calculation) and the Type 5 LSA

R5#show ip ospf data
<snip>
                Summary ASB Link States (Area 1)
          
Link ID         ADV Router      Age         Seq#       Checksum
2.2.2.2         4.4.4.4         1094        0x80000001 0x00B072
3.3.3.3         4.4.4.4         617         0x80000002 0x00A871

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
101.0.0.0       3.3.3.3         1506        0x80000001 0x001709 0

R5#show ip route 101.0.0.0
Routing entry for 101.0.0.0/8
  Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 4
  Last update from 10.4.5.4 on GigabitEthernet1, 00:19:37 ago
  Routing Descriptor Blocks:
  * 10.4.5.4, from 3.3.3.3, 00:19:37 ago, via GigabitEthernet1
      Route metric is 20, traffic share count is 1

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.

#R2,R3
router ospf 1
 area 2 range 10.1.3.0 255.255.255.0 not-advertise

After about 10 seconds, R5 removes the 101/8 route from its RIB:

R5#show ip route 10.1.3.0
% Subnet not in table

R5#show ip route 101.0.0.0
% Network not in table

RFC 2328 says that the forwarding address must be known via an intra-area or inter-area route:

#16.4.  Calculating AS external routes
If the forwarding address is non-zero, look up the
            forwarding address in the routing table.[24] The matching
            routing table entry must specify an intra-area or inter-area
            path; if no such path exists, do nothing with the LSA and
            consider the next in the list.

What are the Type 4 LSAs even for then?

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.

Last updated