Live Chat
Monday - Friday 8am - 6pm EST Chat Now
Contact Us
Monday - Friday 8am - 8pm EST 1-800-268-7737 Other Contact Options
Checkout

Cart () Loading...

    • Quantity:
    • Delivery:
    • Dates:
    • Location:

    $

The Importance of OSPF Type 1, 3 and 5 Link State Advertisements and the benefits of understanding them

Date:
Sep. 23, 2021
Author:
Annette Smallworth

Many Enterprise companies use Open Shortest Path First (OSPF) as their Interior Gateway Protocol (IGP). OSPF relies on Link State Advertisements (LSAs) in order to advertise and learn subnets so whether it’s for CCNA or CCNP Enterprise or simply for a basic understanding of OSPF, it is important to understand the purpose of the various LSA types and how far the LSAs flood. This document will focus on LSA Type 1’s, 3’s and 5’s.

Once an understanding of the different OSPF types and the OSPF Link State Database has been mastered then this can be a useful and efficient tool for not only verifying the OSPF network but also for troubleshooting an OSPF network as well.

Before we start in depth, let’s review the fundamentals of routing and routing protocols

 

The Routing Table

The routing table holds subnet addresses and subnet masks and optionally a default route (0.0.0.0/0). the routing table is one of the most important tables in networking because recall that if the destination IP address of a packet does NOT match any entries at all in the routing table, then that IP packet will be dropped and will never reach the destination device, typically causing the user to log a fault call.



Figure 1 Network Diagram


The following screenshots relate to Figure 1 above.

Recall that each interface on a router needs to be in a unique subnet BUT router to router will share a subnet. Also recall that the only subnets that automatically go into the routing table are the Directly Connected, and they are represented in the routing table by an uppercase C.

For example, below is the directly connected subnets on R4

R4#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override

172.16.0.0/16 is variably subnetted, 4 subnets, 3 masks
C 172.16.14.0/25 is directly connected, Ethernet0/0
L 172.16.14.2/32 is directly connected, Ethernet0/0
192.168.4.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.4.0/24 is directly connected, Loopback0
L 192.168.4.1/32 is directly connected, Loopback0
198.51.100.0/24 is variably subnetted, 2 subnets, 2 masks
C 198.51.100.0/24 is directly connected, Ethernet0/1
L 198.51.100.1/32 is directly connected, Ethernet0/1

 

Figure 2 Directly Connected subnets on R4

Note that in the diagram in Figure 1, R4 has 3 interfaces (2 Ethernet interfaces and 1 Loopback interface). Recall that if an interface is “up up” and has an IP address configured on it, then the Subnet Address / Subnet Mask will automatically enter into the routing table as a directly connected subnet preceded by an uppercase C. Because there are three interfaces on R4, there are three C’s in the routing table.

(Note: The “L” entries are not subnets, they are the actual host address on each interface and hence show with a /32 subnet mask.)

All other subnets in the network will need to be learned. The two ways that a router can learn subnets that are not directly connected are:

  1. Static Routes = Manually adding entries into a routing table
  2. Dynamic Routes = Configure a Routing Protocol, such as OSPF, to dynamically advertise and learn subnets to help build the routing table

 

Routing Protocols

There are many different routing protocols:

  • RIP
  • EIGRP
  • OSPF
  • IS-IS
  • BGP

However, all routing protocols have a common function: To advertise subnets and to learn subnets in order to help build the routing table. OSPF is a popular Interior Gateway Protocol, designed to advertise and learn subnets within a company (Autonomous System).

OSPF is a Link State Routing Protocol, consequently it NEVER advertises the whole routing table. It advertises the subnets using small pieces of information called Link State Advertisements (LSAs). OSPF has many different types of LSAs. All LSAs are important, but the key LSAs to understand first are Type 1’s, 3’s and 5’s.

For the purpose of simplicity, Figure 1 is shown multiple times in this document, and the following discussions will relate to the diagram in Figure 1 and focus on R4 learning subnets via OSPF.

OSPF Type 1 (Router) LSAs


Figure 1 Network Diagram

 

Which routers generate a Type 1 LSA?

  • In OSPF, every router generates a Type 1 LSA, also known as a Router LSA.

 

What is inside a Type 1 LSA?

  • Router-id of the router that generated that LSA (32-bit number that represents that router in OSPF).
  • Directly connected subnets only (not the whole routing table).
  • Cost of each directly connected subnet (by default cost = Reference BW / Interface BW).
  • Sequence number (Starting sequence number = 0x80000001).

 

How far do Type 1 LSAs flood?

  • Within OSPF there is a flooding mechanism.
  • All LSAs flood, but how far they flood depends on the type of LSA.
  • Type 1 LSAs flood within the area.
  • LSAs are stored in the Link State Database (LSDB).
  • There is a Link State Database on each router for each Area it is part of.
  • Within an area, each Link State Database must be identical.
    • OSPF routers synchronize the LSDB to the neighbor to ensure the databases are identical.

 

For example, if there were 30 routers in Area 0, then there would be 30 x Type 1 LSA in every router in Area 0. In Figure 1, there are two routers in Area 0 (R1 and R4), so there will be just two Type 1 (Router) LSAs in R4 — its own and the one from R1, as shown below in Figure 3.

R4# show ip ospf database

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

Router Link States (Area 0)

Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 603 0x80000007 0x009E68 2
4.4.4.4 4.4.4.4 642 0x80000007 0x00F1F7 2

 

Figure 3: Partial Link State Database on R4 – showing the Type 1 LSAs

The LSDB will show one line per LSA. In the above Figure 3, there are two Type 1 (Router) LSAs. The highlighted ADV Router column above shows the Router ID (RID) of each of the routers in Area 0 that generated a Type 1 LSA (Router 1.1.1.1 and Router 4.4.4.4).

 

OSPF Type 3 (Summary Net) LSAs

 

 


Figure 1 Network Diagram


LSAs are stored in the LSDB, and this uses RAM on each router. An OSPF design to use less RAM on the internal routers is to have more than one OSPF Area (Multi-Area OSPF) and configure Route Summarization. In Figure 1 above, notice there are three OSPF Areas (Area 0, Area 1, Area 2). Any router that is between OSPF Areas is called an Area Border Router (ABR). In Figure 1, R1 is the ABR. Area Border Routers automatically generate Type 3 LSAs.

 

Which routers generate Type 3 LSAs?

  • Only ABRs generate Type 3 LSAs, also known as Summary LSAs.

 

What is included in a Type 3 LSA?

  • Router-id of the router that generated that LSA (32 bit number that represents that router in OSPF). Only ABRs generate Type 3’s, so it will be the Router-ID of the ABR.
  • By default, the ABR will generate a Type 3 LSA for every subnet that is being advertised from one OSPF Area to the adjoining OSPF Area.
  • Cost (Metric) of each subnet being advertised into the adjoining area.
  • Sequence Number (Starting sequence number = 0x80000001).

 

How far do Type 3 LSAs flood?

  • Within OSPF there is a flooding mechanism.
  • All LSAs flood, but how far they flood depends on the type of LSA.
  • Type 3 LSAs flood within the adjoining Area.
  • LSAs are stored in the Link State Database (LSDB).
  • Note: There is a Link State Database on each router for each Area it is part of, so in Figure 1, the ABR (R1), will have three LSDB because it is part of three Areas and therefore the ABR for those three Areas (Area 0, Area 1, Area 2).
    • When issuing the command “show ip ospf database” on an ABR, it will show the LSDB for each area in numerical order.
      • This can appear confusing when observing the LSDB on an ABR so to avoid confusion always check which Area LSDB you are currently looking at.

Below is a portion of the LSDB on R4 showing the Type 3 (Summary) LSAs. R4 is an internal router in Area 0 only (R4 is NOT an ABR).

R4# show ip ospf database

<output omitted>


Summary Net Link States (Area 0)

Link ID ADV Router Age Seq# Checksum
172.16.12.0  1.1.1.1 888 0x80000005 0x00ABB9
172.16.13.0  1.1.1.1 888 0x80000005 0x00A0C3
192.168.2.0  1.1.1.1 888 0x80000005 0x000AB4
192.168.3.0  1.1.1.1 888 0x80000005 0x00FEBE
192.168.16.0  1.1.1.1 888 0x80000005 0x006F41
192.168.17.0  1.1.1.1 888 0x80000005 0x00644B
192.168.18.0  1.1.1.1 888 0x80000005 0x005955
192.168.19.0 1.1.1.1 888 0x80000005 0x004E5F
192.168.20.0  1.1.1.1 888 0x80000005 0x004369
192.168.21.0  1.1.1.1 888 0x80000005 0x003873
192.168.22.0  1.1.1.1 888 0x80000005 0x002D7D
192.168.23.0 1.1.1.1 888 0x80000005 0x002287



Figure 4: Partial OSPF Link State Database on R4 - showing the Type 3 LSAs

Notice in Figure 4 above, there are 12 Type 3 LSAs in the LSDB on R4 (an internal router in Area 0).
Notice that it is the ABR, R1 (RID 1.1.1.1), which generated those 12 Type 3 LSAs. Notice that there is one Type 3 LSA for every subnet (Link ID column) being advertised from the other OSPF areas into Area 0 by the ABR (R1).

 

OSPF Type 5 (External) LSAs

 

Figure 1 Network Diagram


In Figure 1 above, some subnets are outside of OSPF. For example, on R3 there are four subnets shown outside of OSPF (10.33.4.0/24 thru 10.33.7.0/24). If those subnets need to be advertised into OSPF, then Route Redistribution needs to be configured on R3. When Route Redistribution is configured on R3, then R3 becomes an OSPF ASBR (Autonomous System Boundary Router).

 

Which routers generate Type 5 LSAs?

  • Only ASBRs generate Type 5 LSAs, also known as External LSAs.

 

What is included in a Type 5 LSA?

  • Router-id of the router that generated that LSA (32-bit number that represents that router in OSPF). Only ASBRs generate Type 5 LSAs, so it will be the Router-id of the ASBR.
  • By default, the ASBR will generate one Type 5 LSA for every subnet that is being advertised from outside of OSPF into OSPF.
  • Cost (Metric) of each subnet being advertised into OSPF.
  • Sequence Number (Starting sequence number = 0x80000001).

 

How far do Type 5 LSAs flood?

  • Within OSPF there is a flooding mechanism.
  • All LSAs flood, but how far they flood depends on the type of LSA.
  • Type 5 LSAs flood throughout all of OSPF.
  • LSAs are stored in the Link State Database (LSDB).

Below is a portion of the LSDB on R4 showing the Type 5 (External) LSAs. R4 is an internal router in Area 0 only (R4 is NOT an ABR or an ASBR).

R4# show ip ospf database

<output omitted>

Type-5 AS External Link States

Link ID ADV Router Age Seq# Checksum Tag
10.33.4.0 3.3.3.3 852 0x80000005 0x004918 0
10.33.5.0 3.3.3.3 852 0x80000005 0x003E22 0
10.33.6.0 3.3.3.3 852 0x80000005 0x00332C 0
10.33.7.0 3.3.3.3 852 0x80000005 0x002836 0

 

Figure 5: Partial OSPF Link State Database on R4 – showing the Type 5 LSAs

Notice in Figure 5 above, there are four Type 5 LSAs in the LSDB on R4 (R4 is an internal router in Area 0). Notice that it was the ASBR, R3 (RID 3.3.3.3), which generated those 4 x Type 5 LSAs.
Notice that there is one Type 5 LSA for every subnet (Link ID column) being advertised from outside of OSPF into OSPF by the ASBR (R3).

 

Now finally… back to the Routing Table

This white paper has now explained the three key LSAs in OSPF (Type 1, 3 and 5).

  • Type 1 is advertising subnets within an OSPF Area.
  • Type 3 is advertising subnets from one OSPF Area to another OSPF Area.
  • Type 5 is advertising subnets from outside of OSPF into OSPF.

We have also seen that the LSAs are stored in the OSPF Link State Database (LSDB) and have been using R4 in Figure 1 as the example. The final piece of the puzzle is to now consider how the OSPF LSDB will help build the routing table, because recall the purpose of any routing protocol is to advertise and learn subnets so as to help build the routing table:

OSPF has an algorithm to calculate the best path to each subnet. The algorithm uses the information in all the LSAs to calculate the best path to each subnet. The algorithm is called the “shortest path first (spf) algorithm.” (The algorithm is also referred to as the Dijkstra algorithm, after the Dutch mathematician that developed it in the 1950s.)



Figure 1 Network Diagram

Referring to R4 on Figure 1 above one last time, the complete OSPF LSDB (Link State Database) on R4 is shown below in Figure 7. For clarity, I have highlighted the OSPF Type 1, 3 and 5 LSAs in the database, and also for clarity, I have added the Type number of the LSA in italics next to the name of the LSA.

R4#show ip ospf database

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

Router Link States (Area 0) Type 1

Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 20 0x80000003 0x00A664 2
4.4.4.4 4.4.4.4 19 0x80000003 0x00F9F3 2

 

Net Link States (Area 0) Type 2

Link ID ADV Router Age Seq# Checksum
172.16.14.2 4.4.4.4 19 0x80000001 0x00B018

 

Summary Net Link States (Area 0) Type 3

Link ID ADV Router Age Seq# Checksum
172.16.12.0 1.1.1.1 50 0x80000001 0x00B3B5
172.16.13.0 1.1.1.1 50 0x80000001 0x00A8BF
192.168.2.0 1.1.1.1 15 0x80000001 0x0012B0
192.168.3.0 1.1.1.1 15 0x80000001 0x0007BA
192.168.16.0 1.1.1.1 15 0x80000001 0x00773D
192.168.17.0 1.1.1.1 15 0x80000001 0x006C47
192.168.18.0 1.1.1.1 15 0x80000001 0x006151
192.168.19.0 1.1.1.1 15 0x80000001 0x00565B
192.168.20.0 1.1.1.1 15 0x80000001 0x004B65
192.168.21.0 1.1.1.1 15 0x80000001 0x00406F
192.168.22.0 1.1.1.1 15 0x80000001 0x003579
192.168.23.0 1.1.1.1 15 0x80000001 0x002A83

 

Summary ASB Link States (Area 0) Type 4

Link I ADV Router Age Seq# Checksum
3.3.3.3 1.1.1.1 15 0x80000001 0x0037EA

 

Type-5 AS External Link States Type 5

Link ID ADV Router Age Seq# Checksum Tag
10.33.4.0 3.3.3.3 60 0x80000001 0x005114 0
10.33.5.0 3.3.3.3 60 0x80000001 0x00461E 0
10.33.6.0 3.3.3.3 60 0x80000001 0x003B28 0
10.33.7.0 3.3.3.3 60 0x80000001 0x003032 0

 

Figure 6: Complete OSPF Link State Database on R4, showing all the LSAs but with the Type 1’s, 3’s and 5’s highlighted and noted.


Now let’s compare the LSDB on R4 to the Routing Table on R4 which is shown below in Figure 7.

R4#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override

Gateway of last resort is 198.51.100.2 to network 0.0.0.0

S* 0.0.0.0/0 [1/0] via 198.51.100.2

10.0.0.0/24 is subnetted, 4 subnets

O E2 10.33.4.0 [110/20] via 172.16.14.1, 00:13:16, Ethernet0/0
O E2 10.33.5.0 [110/20] via 172.16.14.1, 00:13:16, Ethernet0/0
O E2 10.33.6.0 [110/20] via 172.16.14.1, 00:13:16, Ethernet0/0
O E2 10.33.7.0 [110/20] via 172.16.14.1, 00:13:16, Ethernet0/0

172.16.0.0/16 is variably subnetted, 4 subnets, 3 masks

O IA 172.16.12.0/30 [110/20] via 172.16.14.1, 00:13:21, Ethernet0/0
O IA 172.16.13.0/30 [110/20] via 172.16.14.1, 00:13:21, Ethernet0/0
C 172.16.14.0/25 is directly connected, Ethernet0/0
L 172.16.14.2/32 is directly connected, Ethernet0/0
O 192.168.1.0/24 [110/11] via 172.16.14.1, 00:13:21, Ethernet0/0
O IA 192.168.2.0/24 [110/21] via 172.16.14.1, 00:13:21, Ethernet0/0
O IA 192.168.3.0/24 [110/21] via 172.16.14.1, 00:13:21, Ethernet0/0

192.168.4.0/24 is variably subnetted, 2 subnets, 2 masks

C 192.168.4.0/24 is directly connected, Loopback0
L 192.168.4.1/32 is directly connected, Loopback0
O IA 192.168.16.0/24 [110/21] via 172.16.14.1, 00:13:21, Ethernet0/0
O IA 192.168.17.0/24 [110/21] via 172.16.14.1, 00:13:21, Ethernet0/0
O IA 192.168.18.0/24 [110/21] via 172.16.14.1, 00:13:21, Ethernet0/0
O IA 192.168.19.0/24 [110/21] via 172.16.14.1, 00:13:21, Ethernet0/0
O IA 192.168.20.0/24 [110/21] via 172.16.14.1, 00:13:21, Ethernet0/0
O IA 192.168.21.0/24 [110/21] via 172.16.14.1, 00:13:21, Ethernet0/0
O IA 192.168.22.0/24 [110/21] via 172.16.14.1, 00:13:21, Ethernet0/0
O IA 192.168.23.0/24 [110/21] via 172.16.14.1, 00:13:21, Ethernet0/0

198.51.100.0/24 is variably subnetted, 2 subnets, 2 masks

C 198.51.100.0/24 is directly connected, Ethernet0/1
L 198.51.100.1/32 is directly connected, Ethernet0/1

Figure 7: Complete Routing Table on R4

Notice in the R4 routing table above, there are 3 directly connected subnets “C,” 1 x Static Route “S” and there are 17 other entries with an “O” at the beginning of the entry, meaning that R4 has learnt 17 subnets via OSPF:

One of those subnets has just an “O” on the left-hand side, meaning that subnet was learned by a Type 1 LSA, so that subnet is in the same Area as R4 (Area 0). Twelve of those subnets have “O IA” on the left-hand side, meaning those 12 subnets were learned by Type 3 LSAs, so those subnets are within OSPF but in different OSPF Areas to R4 and were advertised into Area 0 via the ABR.

Four of those subnets have “O E2” on the left-hand side, meaning those four subnets were learned by Type 5 LSAs. So, those subnets are outside of OSPF and were advertised into OSPF via the ASBR.

 

 

LSA TYPE LSA NAME WHICH ROUTERS
GENERATE
PURPOSE OF LSA HOW FAR DOES LSA FLOOD EQUIVALENT ENTRY IN ROUTING TABLE
1 ROUTER ALL Advertises Directly Connected Subnets Floods within the OSPF Area O
3 SUMMARY NET ABR Advertises Subnets from one OSPF Area to adjoining OSPF Area Floods within the adjoining OSPF Area O IA
5 EXTERNAL ASBR Advertises Subnets from outside of OSPF into OSPF Floods through all of OSPF O E2 (by default)
or
O E1

Figure 8: A summary of the three key LSAs, Type 1’s, 3’s and 5’s


To conclude, the LSAs in OSPF are advertising subnets and are stored in the OSPF Link State Database on each router. The LSAs covered in this white paper have a direct impact on the OSPF entries in the routing table as shown in Figure 8 above, hence the need to understand the different LSA types, whether it be for CCNA, CCNP Enterprise or your job as a network engineer dealing with OSPF. After mastering the different OSPF LSA types and the Link State Database, then a Network Engineer is able to determine what LSAs should be in the Link State Database base for a particular router at any given time. Consequently, checking the content of the OSPF Link State Database can be a quick and efficient tool to verify that the OSPF Network is working correctly or can also be an equally useful and efficient tool to troubleshoot a problematic OSPF network.

{I suggest once you feel confident of the purpose of LSAs Type 1’s, 3’s and 5’s, then investigate the purpose of LSA Type 2’s and 4’s – which are also a necessary part of OSPF but do not have such an obvious impact on the Routing Table}