OSPFv2 Link State Advertisements

Link State Advertisements (LSAs) are one of hardest things to understand while learning OSPF. I believe that having a basic understanding of the LSA types and being able to interpret them is crucial to understanding OSPF operation. LSAs are flooded to populate the Link State Database (LSDB) on routers participating in OSPF. The content of the local LSDB is used to calculate loop free paths to known destinations. I built a network in my home lab that will generate LSA types 1,2,3,4, and 5 to hopefully help you and I better understand LSAs and the LSDB. This article assumes that the reader has a basic understanding of OSPF configuration, router IDs, network types, and multi area concepts.

Graphs

Graph theory is relevant to computer networks, particularly with routing. A graph consists of vertices and edges. Vertices in an OSPF context are Router IDs (RIDs). Edges connect exactly two vertices and can be thought of as network links. Each edge (link) is weighed based on the OSPF link cost, typically derived from the interface bandwidth. Each router will compute a unidirectional graph from its perspective to reach known destinations. It is possible to have a different cost on each end of a link so it is feasible that this unidirectional property may result in asymmetric paths to and from some destination. Try to consider the network as a graph while piecing together the LSAs and LSDB.

The Lay of the Land

Before jumping into the LSA types and functions, it will be helpful to know the network topology and router IDs. I encourage you to take a screenshot of the diagram below for reference. Routers 1.1.1.1, 2.2.2.2 and 3.3.3.3 are connected to a common broadcast segment where 3.3.3.3 is manually configured to be the OSPF Designated Router. 1.1.1.1 has a loopback interface configured with 198.51.100.1/16. The link between 2.2.2.2 and 4.4.4.4 is a serial point-to-point link. All other links are ethernet broadcast links. Router 4.4.4.4 is an Area Border Router (ABR), connecting Area 0 to Area 51. 5.5.5.5 is serving as an Autonomous System Boundary Router (ASBR) by redistributing EIGRP AS 1 into OSPF. The IP addressing scheme used in this network is designed to make LSDB entries easier to recognize. This would not be an ideal addressing scheme for a production network. A trained eye will be able to imagine the LSDB based on this diagram and information. If you have OSPF experience, I encourage you to grab a physical or virtual notepad and jot down what you think the OSPF LSDB will consist of from the perspective of 1.1.1.1 and 5.5.5.5.

LSDB High Level View

Cisco IOS allows you to see a high-level overview of the LSDB by issuing “show ip ospf database”. This is useful if you need to view a quick snapshot of the LSDB without seeing the details of each LSA and link. This output also allows you to see all the LSA types present in the local database. In this example we can see 1.1.1.1 is aware of type 1,2,3,4, and 5 LSAs.

1.1.1.1#show ip ospf database

            OSPF Router with ID (1.1.1.1) (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         421         0x80000005 0x00B5E8 2
2.2.2.2         2.2.2.2         417         0x80000006 0x000AD4 3
3.3.3.3         3.3.3.3         430         0x80000003 0x00FFFE 1
4.4.4.4         4.4.4.4         492         0x80000002 0x00669B 2

                Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
10.0.0.3        3.3.3.3         430         0x80000001 0x00C93B

                Summary Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
172.30.51.0     4.4.4.4         483         0x80000001 0x00A789
172.30.51.4     4.4.4.4         452         0x80000001 0x0089A2

                Summary ASB Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
4.4.4.4         4.4.4.4         330         0x80000001 0x002C10
5.5.5.5         4.4.4.4         452         0x80000001 0x0026F0

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
100.64.1.0      5.5.5.5         42          0x80000001 0x00A6C0 0
192.168.0.0     5.5.5.5         501         0x80000001 0x001C87 0

Type 1 (Router) LSAs

Each OSPF speaking router will generate a single LSA type 1 describing its connected networks that are participating in OSPF. The type 1 LSA is flooded, unmodified to all other routers in the same area as the originating router. Type 1 LSAs are not flooded into other OSPF areas. The type 1 can advertise different types of networks such as point-to-point, transit links, stub interfaces and virtual links. Virtual links are beyond the scope of this article.

For LSA Type 1 entries the link ID will vary depending on the link type as described in RFC 2328 section 4.2. Sections of this RFC are referenced several times in this article.

Link Type | Description                                      | Link ID

1                | Point-to-Point                                | Neighboring router’s Router ID

2                | Connection to a transit network | IP Address of the DR

3                | Connection to a stub network     | IP network ID   

4                | Virtual link                                      | Neighboring router’s Router ID    

Let’s start by investigating the type 1 LSAs originating from 1.1.1.1. This router advertises two links in its router LSA. The first link originates from interface Loopback1 and is advertised as a stub network. An interesting point is that the loopback interface is advertised as a /32, despite it being configured with a /16 subnet mask. This behavior is specified in RFC 2328 section 9.1. The second entry is advertised as a transit network and represents the link connecting to the ethernet switch. The Link ID specifies the interface address of the designated router (DR). The Link Data specifies the IP address of 1.1.1.1’s interface connecting to this segment. The TOS 0 Metrics field indicates the cost of the link that will be used for shortest path calculation. I’m using the default reference bandwidth of 100Mbps so fast ethernet and gigabit ethernet will both have a cost of 1. The cost can be thought of as the edge’s weight when considering the network as a graph.

1.1.1.1#show ip ospf database router self-originate

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

                Router Link States (Area 0)

  LS age: 1468
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 1.1.1.1
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000008
  Checksum: 0xAFEB
  Length: 48
  Number of Links: 2

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 198.51.100.1
     (Link Data) Network Mask: 255.255.255.255
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 10.0.0.3
     (Link Data) Router Interface address: 10.0.0.1
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

To prove type 1 LSAs are flooded without modification to all routers in the area, we can jump down to 4.4.4.4, the ABR and display the LSA originating from 1.1.1.1. The content of the LSA is identical to the copy on the originating router.

4.4.4.4#show ip ospf database router 1.1.1.1

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

                Router Link States (Area 0)

  LS age: 444
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 1.1.1.1
  Advertising Router: 1.1.1.1
  LS Seq Number: 8000000A
  Checksum: 0xABED
  Length: 48
  Number of Links: 2

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 198.51.100.1
     (Link Data) Network Mask: 255.255.255.255
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 10.0.0.3
     (Link Data) Router Interface address: 10.0.0.1
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

Now that we’ve seen the type 1 LSA originating from 1.1.1.1 from multiple routers, let’s look at all the type 1s in 1.1.1.1’s LSDB. Since we’ve already covered the LSA from 1.1.1.1, let’s skip over it now.

Router 2.2.2.2 advertises 3 links in its type 1 LSA. The transit link entry advertises its participation in the multiaccess segment connecting 1.1.1.1, 2.2.2.2 and 3.3.3.3. This entry is like the one we looked at previously from 1.1.1.1. The next two are more interesting. Referring to the diagram, 2.2.2.2 only has two OSPF interfaces yet there are 3 entries in its type 1 advertisement. This is because of the point-to-point (p2p) link to 4.4.4.4. RFC 2328 section 12.4.1.1 specifies how to describe p2p links in the LSDB. The scenario in this network causes a p2p entry that specifies the neighboring router’s ID and the local router’s IP address. There is also a stub network entry that advertises the subnet of the link. I suggest checking the RFC to better understand this behavior and other possible scenarios.

Router 3.3.3.3 only has a single interface participating in OSPF and it is a broadcast interface type connecting to the shared segment with 1.1.1.1 and 2.2.2.2. Since it is the DR (priority 255) for this segment, it advertises its own interface IP as the Link ID and Link Data.

Router 4.4.4.4 only has one interface in area 0 so we only see attributes of this link as type 1 information within area 0. This is the other end of the p2p link from 2.2.2.2 so we have a point-to-point entry advertising its interface address of 172.16.0.2. The stub network entry is identical to the one presented from 2.2.2.2. Notice that the TOS 0 Metric of this link is 64 on both ends. The interface bandwidth of the link is 1.544 Mbps. Remember that type 1 LSAs are significant within an area, so no information about area 51 or the redistributed EIGRP networks is known by area 0 via type 1 LSAs.

1.1.1.1#show ip ospf database router

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

                Router Link States (Area 0)

  LS age: 859
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 1.1.1.1
  Advertising Router: 1.1.1.1
  LS Seq Number: 8000000A
  Checksum: 0xABED
  Length: 48
  Number of Links: 2

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 198.51.100.1
     (Link Data) Network Mask: 255.255.255.255
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 10.0.0.3
     (Link Data) Router Interface address: 10.0.0.1
      Number of MTID metrics: 0
       TOS 0 Metrics: 1


  LS age: 1835
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 2.2.2.2
  Advertising Router: 2.2.2.2
  LS Seq Number: 80000007
  Checksum: 0x8D5
  Length: 60
  Number of Links: 3

    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 4.4.4.4
     (Link Data) Router Interface address: 172.16.0.1
      Number of MTID metrics: 0
       TOS 0 Metrics: 64

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 172.16.0.0
     (Link Data) Network Mask: 255.255.255.252
      Number of MTID metrics: 0
       TOS 0 Metrics: 64

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 10.0.0.3
     (Link Data) Router Interface address: 10.0.0.2
      Number of MTID metrics: 0
       TOS 0 Metrics: 1


  LS age: 1945
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 3.3.3.3
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000006
  Checksum: 0xF902
  Length: 36
  Number of Links: 1

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 10.0.0.3
     (Link Data) Router Interface address: 10.0.0.3
      Number of MTID metrics: 0
       TOS 0 Metrics: 1


  LS age: 10
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 4.4.4.4
  Advertising Router: 4.4.4.4
  LS Seq Number: 80000006
  Checksum: 0x5E9F
  Length: 48
  Area Border Router
  Number of Links: 2

    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 2.2.2.2
     (Link Data) Router Interface address: 172.16.0.2
      Number of MTID metrics: 0
       TOS 0 Metrics: 64

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 172.16.0.0
     (Link Data) Network Mask: 255.255.255.252
      Number of MTID metrics: 0
       TOS 0 Metrics: 64

Type 2 (Network) LSAs

Type 2 (Network) LSAs are generated for transit broadcast or NBMA networks and are generated by the designated router. Just like the type 1, type 2 LSAs are only flooded within the area from which they originate. If there is a DR, a type 2 will be flooded even if only 2 routers exist on the multiaccess segment. The DR will include its IP address in the multiaccess segment, the network mask, and a list of all the routers fully adjacent to the DR. It will also include itself in the list. From a graph perspective, this is an optimization that makes the DR appear as a pseudonode in the center of the multiaccess network. Without this optimization, multiaccess networks with more than two routers would appear as full mesh. I like to think of it logically as a hub and spoke where the DR is the hub and the BDR/DROTHERs are spokes with point-to-point links connecting the spokes to the DR hub. Refer to the previous diagram to compare the physical topology vs the diagram below that represents the SPF graph with the optimization of the type 2 LSA/pseudonode.

Below is the LSA type 2 representing the broadcast multiaccess segment between 1.1.1.1, 2.2.2.2 and 3.3.3.3. The link state ID and advertising router are those of the DR, 3.3.3.3.

2.2.2.2#show ip ospf database network

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

                Net Link States (Area 0)

  LS age: 37
  Options: (No TOS-capability, DC)
  LS Type: Network Links
  Link State ID: 10.0.0.3 (address of Designated Router)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000003
  Checksum: 0xC53D
  Length: 36
  Network Mask: /24
        Attached Router: 3.3.3.3
        Attached Router: 1.1.1.1
        Attached Router: 2.2.2.2

Type 3 (Summary) LSAs

A notable attribute of LSA types 1 and 2 is that they do not leave the area from which they originate. LSA type 3 (aka Summary LSA) is used to advertise OSPF native (not redistributed) networks from one area to another. The summary LSA is originated by the ABR. In this example, 4.4.4.4 is the only ABR and it sits between area 0 and area 51. 4.4.4.4 will take the networks from area 0 and advertise them into area 51 as type 3 and vice versa. They’re called summary LSAs because they hide the topological details of the area that the network resides in. The type 3 LSA contains the destination network ID, network mask, metric (cost), and the advertising router ID. The advertising router is the router ID of the ABR that originates the type 3.

Below are the LSDB type 3 entries on router 2.2.2.2. Notice that these are the two networks in area 51 and the advertising router is the ABR, 4.4.4.4. All that area 0 routers need to know is “to reach these networks, route to 4.4.4.4”. Routers in area 0 will know how to reach 4.4.4.4 based on information learned in type 1 LSAs. This model is somewhat distance vector like.

2.2.2.2#show ip ospf database summary

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

                Summary Net Link States (Area 0)

  LS age: 530
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(Network)
  Link State ID: 172.30.51.0 (summary Network Number)
  Advertising Router: 4.4.4.4
  LS Seq Number: 80000003
  Checksum: 0xA38B
  Length: 28
  Network Mask: /30
        MTID: 0         Metric: 1

  LS age: 530
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(Network)
  Link State ID: 172.30.51.4 (summary Network Number)
  Advertising Router: 4.4.4.4
  LS Seq Number: 80000003
  Checksum: 0x85A4
  Length: 28
  Network Mask: /30
        MTID: 0         Metric: 2

Below are the type 3 LSAs known by 5.5.5.5. Instead of having all the area 0 details we saw in our type 1 and 2 investigation, area 51 only receives this summarized information from the ABR.

5.5.5.5#show ip ospf database summary

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

                Summary Net Link States (Area 51)

  Routing Bit Set on this LSA
  LS age: 80
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(Network)
  Link State ID: 10.0.0.0 (summary Network Number)
  Advertising Router: 4.4.4.4
  LS Seq Number: 80000004
  Checksum: 0x15C9
  Length: 28
  Network Mask: /24
        TOS: 0  Metric: 65

  Routing Bit Set on this LSA
  LS age: 80
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(Network)
  Link State ID: 172.16.0.0 (summary Network Number)
  Advertising Router: 4.4.4.4
  LS Seq Number: 80000004
  Checksum: 0xF53A
  Length: 28
  Network Mask: /30
        TOS: 0  Metric: 64

  Routing Bit Set on this LSA
  LS age: 80
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(Network)
  Link State ID: 198.51.100.1 (summary Network Number)
  Advertising Router: 4.4.4.4
  LS Seq Number: 80000004
  Checksum: 0xC8BF
  Length: 28
  Network Mask: /32
        TOS: 0  Metric: 66

Type 5 (AS External) LSAs

Until now we’ve gone through the LSA types in numerical order but let’s skip over type 4 for now. We’ll revisit that later. The LSA type 5 is used to announce Autonomous System (AS) external networks that have been redistributed into OSPF. Recall from the topology diagram that there is an EIGRP domain attached to area 51 via an interface on 5.5.5.5. It’s not displayed in the diagram but there is also a loopback interface on 5.5.5.5 that is included in EIGRP. The loopback IP is 100.64.1.1/24. I configured one way redistribution in OSPF by issuing “redistribute eigrp 1 metric-type 1 subnets” under OSPF configuration. These external networks are propagated through the OSPF domain via type 5 LSAs. The type 5 LSAs from 5.5.5.5’s LSDB are shown below. The type 5 contains the network ID, mask, advertising router ID, metric type, and a few other attributes. Type 5 LSAs propagate across area boundaries. Routers in area 0 have identical copies of the type 5 LSAs as advertised by the ASBR.

5.5.5.5#show ip ospf database external

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

                Type-5 AS External Link States

  LS age: 764
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 100.64.1.0 (External Network Number )
  Advertising Router: 5.5.5.5
  LS Seq Number: 80000002
  Checksum: 0xA4C1
  Length: 36
  Network Mask: /24
        Metric Type: 1 (Comparable directly to link state metric)
        TOS: 0
        Metric: 20
        Forward Address: 0.0.0.0
        External Route Tag: 0

  LS age: 764
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 192.168.0.0 (External Network Number )
  Advertising Router: 5.5.5.5
  LS Seq Number: 80000002
  Checksum: 0x1A88
  Length: 36
  Network Mask: /24
        Metric Type: 1 (Comparable directly to link state metric)
        TOS: 0
        Metric: 20
        Forward Address: 0.0.0.0
        External Route Tag: 0

Type 4 (ASBR Summary) LSA

Recall from the last section that type 5 LSAs are propagated beyond area boundaries and that the ASBR is the advertising router. First, let’s check out the type 5s known by 1.1.1.1 in area 0. These are identical in routing content to the type 5s found in area 51. Because type 1 LSAs do not cross area borders, routers in area 0 have no knowledge of how to reach the ASBR, 5.5.5.5. Without knowledge of how to reach the ASBR, routers in area 0 will not be able to reach the external networks. This problem is solved by the type 4 LSA.

1.1.1.1#show ip ospf database external

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

                Type-5 AS External Link States

  LS age: 116
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 100.64.1.0 (External Network Number )
  Advertising Router: 5.5.5.5
  LS Seq Number: 80000006
  Checksum: 0x9CC5
  Length: 36
  Network Mask: /24
        Metric Type: 1 (Comparable directly to link state metric)
        MTID: 0
        Metric: 20
        Forward Address: 0.0.0.0
        External Route Tag: 0

  LS age: 116
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 192.168.0.0 (External Network Number )
  Advertising Router: 5.5.5.5
  LS Seq Number: 80000006
  Checksum: 0x128C
  Length: 36
  Network Mask: /24
        Metric Type: 1 (Comparable directly to link state metric)
        MTID: 0
        Metric: 20
        Forward Address: 0.0.0.0
        External Route Tag: 0

The type 4 LSA is generated by the ABR and flooded throughout area 0. It basically says “I know you have those type 5’s from 5.5.5.5. To get to 5.5.5.5, route to me (4.4.4.4) and I’ll take it from here”. The first entry here is interesting. “Adv Router is not-reachable” with the metric set to infinity, 2^24-1. Notice that the AS boundary router address is 4.4.4.4. This is not a routable address, it is only a router ID. If you know why this entry exists, please send me an email, or leave a comment. The second entry in the output is valid and provides area 0 routers with information on how to route toward the ASBR.

1.1.1.1#show ip ospf database asbr-summary

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

                Summary ASB Link States (Area 0)

  Adv Router is not-reachable in topology Base with MTID 0
  LS age: 1980
  Options: (No TOS-capability, No DC, Upward)
  LS Type: Summary Links(AS Boundary Router)
  Link State ID: 4.4.4.4 (AS Boundary Router address)
  Advertising Router: 4.4.4.4
  LS Seq Number: 80000005
  Checksum: 0x2414
  Length: 28
  Network Mask: /0
        MTID: 0         Metric: 16777215

  LS age: 222
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(AS Boundary Router)
  Link State ID: 5.5.5.5 (AS Boundary Router address)
  Advertising Router: 4.4.4.4
  LS Seq Number: 80000006
  Checksum: 0x1CF5
  Length: 28
  Network Mask: /0
        MTID: 0         Metric: 1

To experiment with the odd type 4 LSA in the previous output, I configured a loopback interface on 4.4.4.4 with IP address 4.4.4.4/32. I included the loopback interface in OSPF area 51 and removed the static router ID configuration. This resulted in two “Adv Router is not-reachable” type 4 entries.

1.1.1.1#show run | sec ospf
router ospf 1
 network 4.4.4.4 0.0.0.0 area 51
 network 172.16.0.0 0.0.0.3 area 0
 network 172.30.51.0 0.0.0.3 area 51

1.1.1.1#show ip ospf database asbr-summary

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

                Summary ASB Link States (Area 0)

  LS age: 463
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(AS Boundary Router)
  Link State ID: 5.5.5.5 (AS Boundary Router address)
  Advertising Router: 4.4.4.4
  LS Seq Number: 80000002
  Checksum: 0x24F1
  Length: 28
  Network Mask: /0
        MTID: 0         Metric: 1

  Adv Router is not-reachable in topology Base with MTID 0
  LS age: 2787
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(AS Boundary Router)
  Link State ID: 5.5.5.5 (AS Boundary Router address)
  Advertising Router: 172.30.51.1
  LS Seq Number: 80000001
  Checksum: 0x2FF8
  Length: 28
  Network Mask: /0
        MTID: 0         Metric: 1

  Adv Router is not-reachable in topology Base with MTID 0
  LS age: 2792
  Options: (No TOS-capability, No DC, Upward)
  LS Type: Summary Links(AS Boundary Router)
  Link State ID: 172.30.51.1 (AS Boundary Router address)
  Advertising Router: 172.30.51.1
  LS Seq Number: 80000003
  Checksum: 0x7EDD
  Length: 28
  Network Mask: /0
        MTID: 0         Metric: 16777215

There are other LSA types and many other OSPF scenarios that will cause different LSDB states. This article is nowhere near comprehensive, but I hope you find it useful in understanding some of the basics of link state advertisements. Good, bad, or indifferent I’d love to have your feedback. Thanks for reading!

Leave Comment

Your email address will not be published. Required fields are marked *

Time limit exceeded. Please complete the captcha once again.