As stated in the previous section, OSPF uses several types of Link State Advertisements. Each LSA begins with a standard 20-byte LSA header. This header contains the following:
- Link State Age
- Options
- Link State Type
- Link State ID
- Advertising Router
- Link State Sequence Number
- Link State Checksum
- Length
The 2-byte Link State Age field states the time since the LSA was originated (in seconds). The maximum age of the LSA is 3600 seconds, which means that if the age reaches 3600 seconds, the LSA is removed from the database. To avoid this, the LSA is refreshed every 1800 seconds.
The 1-byte Options field contains the same options as those in the OSPF Hello packet. The 1-byte Link State Type field represents the types of LSA. These different LSA packet types are described in detail in the following sections.
The 4-byte Link State ID field identifies the portion of the network that is being described by the LSA. The contents of this field depend on the advertisement’s LS type. The 4-byte Advertising Router field represents the router ID of the router originating the LSA.
The 1-byte Link State Sequence Number field detects old or duplicate link state advertisements. Successive instances of an LSA are given successive Link State Sequence Numbers. The first sequence number 0x80000000 is reserved; therefore the first sequence number is always 0x80000001. This value is incremented as packets are sent. The maximum sequence number is 0x7FFFFFFF. The 2-byte Link State Checksum field performs the Fletcher checksum of the complete contents of the LSA, including the LSA header. The Link State age field is not included in the checksum. The checksum is performed because Link State Advertisements can be corrupted while being stored in memory, for example, due to router software or hardware issues, or during flooding, for example, due to Physical Layer errors.
NOTE: The checksum is performed at the time the LSA is generated or is received. In addition to this, the checksum is performed at every CheckAge interval, which is 10 minutes. If this field has a value of 0, it means that the checksum has not been performed.
The final field, which is the Length field, is a 2-byte field that includes the length (in bytes) of the LSA. This includes the 20-byte LSA header. Figure 3-15 illustrates the LSA header:

Fig. 3-15. Link State Advertisement Header
While OSPF supports 11 different types of Link State Advertisements, only LSAs Type 1, 2 and, 3, which are used to calculate internal routes, and LSAs Type 4, 5, and 7, which are used to calculate external routes are within the scope of the ROUTE exam. These LSAs will be described in detail in the following section. The basic network topology illustrated in Figure 3-16 will be used to describe the different types of LSAs.

Fig. 3-16. Understanding OSPF LSAs
In Cisco IOS software, the show ip ospf database command is used to view the contents of the Link State Database. This command, when used without any keywords, prints out a summary of LSAs in all areas to which the router is connected. The command supports several keywords which provide greater granularity in allowing network administrators to restrict output to only specific types of LSAs, LSAs advertised by the local router, or even LSAs advertised by other routers within the OSPF domain.
While illustrating the output of the usage of each keyword is unrealistic, the following section describes the different LSAs and the common keywords using in conjunction with the show ip ospf database command to view detailed information on these LSAs. The keywords supported by this command are:
| R3#show ip ospf database ? adv-router Advertising Router link states asbr-summary ASBR summary link states database-summary Summary of database external External link states network Network link states nssa-external NSSA External link states opaque-area Opaque Area link states opaque-as Opaque AS link states opaque-link Opaque Link-Local link states router Router link states self-originate Self-originated link states summary Network summary link states | Output modifiers <cr> |
Router Link State Advertisements (Type 1)
Type 1 LSAs are generated by each router for each area it belongs to. The Router LSA lists the originating router’s router ID (RID). Each individual router will generate a Type 1 LSA for the area in which it resides. The Router LSAs are the first LSA types printed in the output of the show ip ospf database command. For example, referencing Figure 3-15, both R3 and R4 will generate a Type 1 LSA for area 2 as illustrated in the following output:
| R3#show ip ospf database |
OSPF Router with ID (3.3.3.3) (Process ID 3)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2.2 2.2.2.2 704 0x80000005 0x0048A2 2
3.3.3.3 3.3.3.3 424 0x80000004 0x003AA4 2
| R4#show ip ospf database |
OSPF Router with ID (4.4.4.4) (Process ID 4)
Router Link States (Area 2)
Link ID ADV Router Age Seq# Checksum Link count
3.3.3.3 3.3.3.3 249 0x80000004 0x0082DA 2
4.4.4.4 4.4.4.4 62 0x80000005 0x00273E 4
When a router is connected to more than one area, it generates a Type 1 LSA for each area that it is connected to. For example, in addition to generating a Type 1 LSA for area 2, R3 will also generate a Type 1 LSA for area 0, to which it is also connected:
| R3#show ip ospf database |
OSPF Router with ID (3.3.3.3) (Process ID 3)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2.2 2.2.2.2 793 0x80000005 0x0048A2 2
3.3.3.3 3.3.3.3 513 0x80000004 0x003AA4 2
Router Link States (Area 2)
Link ID ADV Router Age Seq# Checksum Link count
3.3.3.3 3.3.3.3 515 0x80000004 0x0082DA 2
4.4.4.4 4.4.4.4 329 0x80000005 0x00273E 4
NOTE: The same would be applicable to R2 which is also connected to more than one area.
To view detailed information on the Router LSA, you can use the show ip ospf database router command. The options available with this command are listed below:
| R4#show ip ospf database router ? A.B.C.D Link state ID (as an IP address) adv-router Advertising Router link states internal Internal LSA information self-originate Self-originated link states | Output modifiers <cr> |
Within the output of this command, the Link ID identifies the link itself. This field will differ depending on the link type. The following link types are supported:
- Point-to-point
- Link to Transit Network
- Link to Stub Network
- Virtual Link
For a point-to-point link type, the Link ID will always be the neighbor router ID (RID). For a link to a transit network, the Link ID will always be the IP address of the DR. This was illustrates earlier in this chapter, and will be illustrated again when we discuss Type 2 LSAs.
A stub network simply refers to a link on which no DR/BDR has been elected, such as a point-to-point network type, for example. Links to stub networks are also links for which no neighbors have been discovered. For these link types, the Link ID will always be the network/subnet number. And finally, for a Virtual Link, the Link ID will always contain the neighbors ID. Virtual Links will be described later in this chapter.
The Advertising Router field displays the IP address of the router advertising this information. This field will contain the RID of the advertising router. The Age field indicates the age of the LSA. By default, OSPF re-floods all LSAs every 30 minutes (1800 seconds) based on the Link State Age field. The Age is reset when a new LSA is received by the router. If a router wants to remove a particular LSA, it can flood the LSA with a MaxAge value of 3600 seconds.
Other routers that receive an LSA with this Age flush or purge the LSA from their databases. For example, if router previously advertising an External LSA for a route was reconfigured and the route redistribution configuration was removed, the router would flood the removed External LSAs with a MaxAge value of 3600 seconds and a maximum metric value throughout the domain allowing other router to flush or purge this LSA entry from their Link State Database as illustrated in the following output:
| R4#show ip ospf database external |
OSPF Router with ID (4.4.4.4) (Process ID 4)
Type-5 AS External Link States
Delete flag is set for this LSA
LS age: MAXAGE(3600)
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 192.168.0.0 (External Network Number )
Advertising Router: 4.4.4.4
LS Seq Number: 80000003
Checksum: 0x5E5E
Length: 36
Network Mask: /22
Metric Type: 1 (Comparable directly to link state metric)
TOS: 0
Metric: 16777215
Forward Address: 0.0.0.0
External Route Tag: 0
It should be noted that it is also possible for the router to be removed, etc, before it can send out the flood update for the LSA with the MaxAge set. In such cases, the LSA is retained in the databases of other OSPF routers, however, the Age counter continues to increment and when it gets to 3600 seconds, the LSA is removed or purged.
NOTE: In Cisco IOS software, the max-metric router-lsa [external-lsa <max-metric-value>] [include-stub] [on-startup <seconds> | wait-for-bgp] [summary-lsa <max-metric-value>] OSPF router configuration command can be issued used on the router to configure it to advertise a maximum metric so that other routers do not prefer the router as an intermediate hop in their shortest path first (SPF) calculations. This command may be applied in the following situations
- When reloading a router, and you do not want other routers to attempt to forward traffic through that router, as it may result in a black-holing of network traffic
- When introducing a new router into the OSPF network and you do not want other routers to forward traffic through the new router for the time being
- When gracefully removing a router from the network, which allows other routers to select alternate paths before the router is actually removed from the network
The Sequence number is the Link state sequence number. This is used to detect old or duplicate LSAs. As stated at the beginning of this section, the first sequence number of 0x80000000 is reserved; therefore, LSAs will always begin with the sequence number 0x80000001. This value is incremented by the router that originates the LSA when it re-floods it every 30 minutes. This action also resets the Age of the LSA.
The Checksum field pertains to the Fletcher checksum of the complete contents of the LSA. And finally, the Link Count field indicates the number of interfaces detected for the router. For example, to view detailed Type 2 LSA information, the show ip ospf database router 4.4.4.4 command could be used on R4 as follows:
| R4#show ip ospf database router 4.4.4.4 |
OSPF Router with ID (4.4.4.4) (Process ID 4)
Router Link States (Area 2)
LS age: 870
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: 0x253F
Length: 72
Number of Links: 4
Link connected to: a Stub Network
(Link ID) Network/subnet number: 4.4.4.4
(Link Data) Network Mask: 255.255.255.255
Number of TOS metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 172.16.4.0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 1
Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 3.3.3.3
(Link Data) Router Interface address: 10.0.2.4
Number of TOS metrics: 0
TOS 0 Metrics: 64
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.0.2.0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 64
Let us take a moment to understand the output above. First of all, the Link State ID of R4s Type 1 LSA is printed above as 4.4.4.4. This is the RID assigned to R4.
Next, let us take a look at the number of links. We know that R4 has three interfaces: Loopback 0, FastEthernet0/0 (connected to the 172.16.4.0/24 subnet), and Serial0/0 (connected to the 10.0.2.0/24 subnet, and a P2P link to R3). By default, all Loopback interfaces are considered stub networks by OSPF. Therefore, the first link described as a link to a stub network is that for the Loopback0 interface on R4. The second link also described as a link to a stub network is that for the FastEthernet0/0 172.16.4.0/24 subnet. This is because although the interface is not a Loopback interface, there are no other OSPF neighbors discovered off that particular link.
The third link described as a link connected to another router represents the Serial0/0 P2P link between R4 and R3. This is a point-to-point link type as shown in parenthesis (brackets). For these link types, the Link ID will always be the neighbor router ID (RID). And finally, because there is no DR/BDR election on the P2P link between R4 and R3, the link is also designated as connected to a stub network. The link ID is therefore the network/subnet number and the subnet mask for the link is included in the Link Data field as is the case for the other two links connected to stub networks.
Because Type 1 LSAs are flooded within a single area and all routers within the area receive these LSAs from all other routers in the same area, the show ip ospf database router adv-router 3.3.3.3 command can be issued on R4 to view the Type 1 LSAs advertised by R3. The output of this command would be the same as the output of the show ip ospf database router 3.3.3.3 command on R3 itself. This is illustrated in the output below:
| R4#show ip ospf data router adv-router 3.3.3.3 |
OSPF Router with ID (4.4.4.4) (Process ID 4)
Router Link States (Area 2)
Routing Bit Set on this LSA
LS age: 526
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: 0x7EDC
Length: 48
Area Border Router
Number of Links: 2
Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 4.4.4.4
(Link Data) Router Interface address: 10.0.2.3
Number of TOS metrics: 0
TOS 0 Metrics: 64
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.0.2.0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 64
Referencing the output above, the Link State ID of R3s Type 1 LSA is printed as 3.3.3.3. This is the RID assigned to R3. Although R3 is connected to two different areas, the router will flood the Type 1 LSA into all areas to which it is connected. In other words, on R3, this same LSA would also be flooded into area 0.
Unlike R4, R3 only has a single link in area 2, which is the Serial0/0 interface. Loopback 0 is configured as part of area 0 as illustrated in Figure 3-16. Using the same logic, Serial0/0 is described as a link connected to another router because it is a point-to-point link type connecting R3 and R3. The same link is also described as being connected to a stub network because there is no DR/BDR elected on that link.
Before we move onto Network LSAs (Type 2), let us take a look at the Type 1 LSAs on R3 which has connections in both area 0 and area 2 and is therefore an Area Border Router (ABR):
| R3#show ip ospf database router 3.3.3.3 |
OSPF Router with ID (3.3.3.3) (Process ID 3)
Router Link States (Area 0)
LS age: 386
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: 8000000C
Checksum: 0x2AAC
Length: 48
Area Border Router
Number of Links: 2
Link connected to: a Stub Network
(Link ID) Network/subnet number: 3.3.3.3
(Link Data) Network Mask: 255.255.255.255
Number of TOS metrics: 0
TOS 0 Metrics: 1
Link connected to: a Transit Network
(Link ID) Designated Router address: 10.0.1.2
(Link Data) Router Interface address: 10.0.1.3
Number of TOS metrics: 0
TOS 0 Metrics: 1
Router Link States (Area 2)
LS age: 387
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: 8000000C
Checksum: 0x72E2
Length: 48
Area Border Router
Number of Links: 2
Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 4.4.4.4
(Link Data) Router Interface address: 10.0.2.3
Number of TOS metrics: 0
TOS 0 Metrics: 64
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.0.2.0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 64
From the output above, the Link State ID shows R3s Type 1 LSA into area 0. This LSA contains the RID of R3, which is 3.3.3.3. Because R3 is connected to both area 0 and area 2, it is considered an Area Border Router (ABR). Within area 0, the LSA shows two links. The first is for the Loopback 0 interface, which is listed as a stub network connection.
The second link is connected to a transit network. Recall, earlier in this chapter we learned that multi-access links are referred to as transit networks in OSPF terminology. The Link ID for this LSA will always list the router ID of the Designated Router, while the Link Data field contains the actual IP address of the router interface. The same would also be reflected on R2 as follows:
| R3#show ip ospf database router adv-router 2.2.2.2 |
OSPF Router with ID (3.3.3.3) (Process ID 3)
Router Link States (Area 0)
Routing Bit Set on this LSA
LS age: 1688
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: 8000000B
Checksum: 0x3CA8
Length: 48
Area Border Router
Number of Links: 2
Link connected to: a Stub Network
(Link ID) Network/subnet number: 2.2.2.2
(Link Data) Network Mask: 255.255.255.255
Number of TOS metrics: 0
TOS 0 Metrics: 1
Link connected to: a Transit Network
(Link ID) Designated Router address: 10.0.1.2
(Link Data) Router Interface address: 10.0.1.2
Number of TOS metrics: 0
TOS 0 Metrics: 1
From this output, we can determine that R2 is the elected DR. In addition to this, we also know that a Type 2 LSA is generated to represent the routers attached to the segment. Type 2 Link State Advertisements are described in the following section.