OSPF Part 2

Submitted by rayc on Tue, 11/23/2021 - 19:44

In this part of the OSPF article, I will talk about OSPF Area types and also the specific LSA messages and where/how they're used. 

OSPF uses the concept of Areas to logically group routers together inside an AS. There are 5 different area types on Cisco OSPF routers.

  1. Backbone Area (This is always Area 0)
  2. Non-Backbone Area (Any other are other than 0)
  3. Stub Area 
  4. Totally Stubby Area
  5. Not-So-Stubby-Area (NSSA)

 

The Backbone area is the most important area in OSPF as ALL OSPF areas must connect to the backbone area. This Area must be contiguous in order to prevent routing loops meaning that you cannot have two Area 0's in a single OSPF AS. Non-Backbone areas are any other are that you configure if you deem it necessary to use multiple OSPF Areas in an OSPF AS. These Areas must have an ABR that connects to Area 0. 

A Stub Area is an area that does not flood certain LSA types, in particular the Type 4 ASBR Summary LSA's and Type 5 External LSA's. The ABR on the border of a stub area will flood a single Type 3 Summary default route LSA into the area in order for routers inside the Stub Area to be able to reach any non-intra or inter-area routes. The reason for using a Stub area is to reduce unnecessary routing overhead by having Type 4 and 5 LSA's in the LSDB. This will mean that the routers inside a Stub area will run SPF calculations faster and require less CPU and memory to make path calculations. There are some restrictions when it comes to Stub routers.

  • A Stub router will set the E bit in the Hello packet to 0. If it hears a Hello packet with the E bit set to 1, it will not form a neighbour relationship as this means the router is not configured as a Stub.
  • Virtual Links cannot be configured through a stub area.
  • No router in a Stub area can be an ASBR as ASBR's produce Type 4 and 5 LSAs. 
  • A Stub area can have more than one ABR, but because only a default route is advertised, the router's have no way of knowing which ABR should be the preferred path.

 

A Totally Stubby area is a Cisco creation. A Totally Stubby Area takes the concept of a stub area even further by blocking not just Type 4 and 5 LSA's, but also the Type 3 Summary LSA's as well. This means that no inter Area LSA's are flooding into the Totally Stubby Area, except for a single Type 3 default route LSA that is advertised by the ABR. 

An NSSA area is again a Cisco variation of a Stub Area. As I mentioned, a Stub area does not allow Type 4 or 5 LSAs so there cannot be an ASBR router inside a Stub Area. This is where a NSSA comes in. The NSSA area allows for an ASBR, while still blocking Type 4 and 5 LSA's, by utilising a Type 7 NSSA External LSA. These Type 7 LSA's are flooded throughout the NSSA, but are blocked at the ABR. When the NSSA ASBR sends a Type 7 LSA, it has the option to set the P bit. If the ABR to an NSSA area receives an LSA with the P bit set, it will translate the Type 7 LSA, into a Type 5 LSA and flood that into the other areas. If the P bit is set to 0 however, the ABR just blocks the LSA. 

The following table shows the OSPF Area types, and the LSA types that are allowed.

Area Type Type 1 & 2 Type 3 Type 4 Type 5 Tpye 7
Backbone Yes Yes Yes Yes No
Non-Backbone Yes Yes Yes Yes No
Stub Yes Yes No No No

Totally Stubby

Yes No* No No No
NSSA Yes Yes Yes No Yes

* Except for a single Type 3 default route LSA

 

LSA Types

OSPF has 11 types of LSA messages however Cisco routers running OSPFv2, only use 6 of those LSA Types. 

  • Type 1 Router LSA: This type of LSA is created by all OSPF routers on a network segment and flooded throughout the Area. 
  • Type 2 Network LSA: This type of LSA is created by DR routers and is used to advertise multi-access network segments.
  • Type 3 Summary LSA: This LSA is advertised by the ABR to represent network segments from another area.
  • Type 4 ASBR Summary LSA: This LSA is advertised by an ASBR (Autonomous System Boundary Router) as summary routes for a specific ASBR.
  • Type 5 AS External LSA: This LSA advertises the LSAs for routes that are redistributed into the OSPF process.
  • Type 7 NSSA External LSA: This LSA advertises redistributed routes from within an NSSA area. 

 

Let's take a look more closely at each LSA. 

Type 1 Router LSA

Type 1 Router LSA's are created by each and every router in an OSPF area and flooded throughout that area. The Router LSA is the most fundamental LSA in OSPF.  Router LSA's are not sent into any other area other than the originating area. These LSA's contain all of the information about a specific router and it's attached networks including the cost to reach those networks. Below is a packet capture of a Type 1 Router LSA. 

Type 1 Router LSA packet capture

From the above packet capture, you can see that this is a Type 1 LSA that has been sent by the advertising router 3.3.3.3 (that's the router ID of the advertising router not the interface IP). You can see the LS Age, and the sequence number and the total number of links (3). The LSA then goes on the list the three networks and includes the type of network it is (Stub or Transit), and the metric to reach that network. Notice that the Link ID is the IP address of the DR on that segment and the Link Data is the Interface IP of the advertising Router. You can see this information in the routers OSPF LSDB by using the show command show ip ospf database router [rid]. 

output of show ip ospf database router RID command

Notice in the above output the line stating "Routing Bit Set on this LSA in topology Base with MTID 0". This just means that the route has been added to the route table on the Cisco router. 

Type 2 Network LSA

Type 2 Network LSA's are only found on multi-access OSPF network segments where there is a DR. This type of LSA does not explicitly specify routes, but specifies the other routers on that network segment. In effect, the DR acts as a pseudonode to represent all Routers on the multi-access network. Type 2 LSA's, like Type 1, are not flooded outside of the area. Below is a packet capture of a Type 2 LSA.

OSPF Type 2 Network LSA pcap

To view the Type 2 Network LSA's on an OSPF router, use the show command show ip ospf database network [Link-State ID]. The Link-State ID is the ID of the DR on the multi-access network.

output of the show ip ospf database network link-state-id command

Type 3 Network Summary LSA

Type 3 Network Summary LSAs are originated from an ABR (Area Border Router). Network Summary LSA's are sent into an area, to advertise networks that originated from another area. Type 3 LSA's are sent both into the backbone area, and non-backbone areas. If you have a default route configured originating from Area 0 and are advertising it to a non-backbone area, then a Type 3 LSA is used.  Network Summary LSA's, include a list of networks that are reachable along with the cost to reach those network from the ABR. Below is a packet capture of a Type 3 Network Summary LSA.

Type 3 Network Summary LSA pcap

As you can see the ABR that has advertised this LSA, is 4.4.4.4 and the Link State ID is 172.16.1.0 with a mask of 255.255.255.0. The Metric to reach that network from the ABR, is 101. To view the Type 3 Network Summary LSA's on an OSPF router, use the show command show ip ospf database summary [LS-ID] where the LS-ID is the Link-State ID of the network you wish to view.

output of the show ip ospf database summary LS-ID command

Type 4 ASBR Summary LSA

The Type 4 ASBR (Autonomous System Boundary Router) Summary, is originated from an ASBR router. An ASBR router is an ABR that is a boundary for an OSPF network and a non OSPF network. For example, if you have two companies merging, and one uses OSPF and the other uses EIGRP or RIP, you would configure a router to run both protocols and redistribute the routes into each. This router running both protocols is called an ASBR router. These Type 4 ASBR Summary LSA's, advertise the path to the ASBR. ASBR Summary LSA's are only sent outside the Area that the ASBR is in. Below is a packet capture of a Type 4 ASBR Summary LSA.

Type 4 ASBR Summary LSA pcap

You can view the Type 4 ASBR Summary LSA's using the show command show ip ospf database asbr-summary [LS-ID] where LS-ID is the Link State ID of the ASBR which is 3.3.3.3 in this case.

output of show ip ospf database asbr-summary lsid command

Type 5 AS External LSA

The Type 5 AS External LSA's are advertised by the ASBR to advertise the external networks or a default route that is external to the OSPF AS. These route types are not associated with an area so when you view them in the database, unlike the other LSA Types that state the area they are for, the router just shows that they are AS External Routes. Below is a packet capture of the Type 5 LSA.

Type 5 AS External LSA pcap

Below is the output of the show ip ospf database external command showing the information in the Type 5 LSA.

output of the show ip ospf database external command

Type 7 NSSA External LSA

Type 7 NSSA External LSA's are only found in NSSA Areas. These LSA's are used to advertise the external routes that are redistributed into the OSPF NSSA Area by the ASBR inside the NSSA. Below is a packet capture of a Type 7 NSSA LSA.

Type 7 NSSA External pcap

To view the Type 7 LSA's in the OSPF LSDB on the router use the show command show ip ospf database nssa-external.

output of show ip ospf database nssa-external command

Notice, that in the packet capture, there is no P bit set. You can configure the NSSA ABR to always advertise the routes by using the command  area 20 nssa translate type7 always