OSPF LSAs
- Sequence number
- InitialSequenceNumber = 0x80000001
- MaxSequenceNumber= 0x7FFFFFFF
- When MaxSequnceNumber is reached, and a new update must be sent, the LSA is flushed by setting the Age to MaxAge and reflooding it over all adjacencies. Then, a new version of the LSA is sent with sequence number set to InitialSequenceNumber
- Checksum – Age is not used in checksum since it’s always changing
- Age
- When a LSA is originated it starts with Age=0. Every time the LSA is flooded out an interface it’s age will be increased with InfTransDelay (1 sec)
- LSAs are also aged when they reside in the LSDB.
- When the Age reaches MaxAge (3600 sec = 1 hour), the LSA is reflooded and is flushed from the database
- When a router needs to flush a LSA it sets the Age to MaxAge
When multiple instances of the same LSA are received, a router will:
- 1.Compare sequance number – the higher will be considered more recent
- 2.Compare checksum – the highest unsigned is considered more recent
- 3.Compare Age – Normally, the highest is considered more recent but if the age differs by more than 15 minutes (MaxAgeDiff) the LSA with the lower Age is considered more recent. If one of the LSAs reached MaxAge it is considered more recent. If none of the previous are true, then the LSAs are considered identical
All valid LSAs received by a router are stored in its LSDB. To view the LSDB, use:
R#show ip ospf database
Every LSRefreshTime (30min) – the router that originated the LSA floods a new copy of the LSA with an incremented sequence number and an age of zero. Upon receipt, the other OSPF routers replace the old copy of the LSA and begin aging the new copy.
To avoid inefficient LSA updates, LSA group pacing can be enabled. It adds a delay (default 240 sec) to the LSA Update in order to group more LSAs in a single update.(enabled by default)
R(config-router)# timers pacing lsa-group SEC
R(config-router)# timers pacing {flood|retransmission} SEC
R# show ip ospf flood-list INTERFACE
!Displays the list of LSAs waiting to be flooded over an interface
LSAs are flooded with DoNotAge=1 and will not be refreshed unless they change. The LSA Age will be incremented as it passes from router to router but it will not age while in the LSDB.
R(config-if)#ip ospf flood-reduction
A LSA Destination can be a network or a router.
- If the destination is a network, it is added to the Routing Table.
- If the destination is a router, it is the route to an ABR or an ASBR. They are kept in an internal table:R# show ip ospf border-routers
- 1.Router LSA
- 2.Network LSA
- 3.Network Summary LSA
- 4.ASBR Summary LSA
- 5.AS External LSA
- 6.Group Membership LSA
- 7.NSSA External LSA
- 8.External Atribuites LSA
- 9.Opaque LSA (link-local scope)
- 10.Opaque LSA (area-local scope)
- 11.Opaque LSA (AS scope)
To better understand the different types of LSAs, we will use the following example
LSAs Example Topology
Here, we have The backbone area and 3 non-backbone areas (Area 367, Area 1245 and Area 568). Area 568 is configured as an NSSA area where R8 injects a route to 88.88.88.0 as E1. A virtual link exists between R1 and R5. R6 redistributes OSPF into EIGRP while R7 advertises a default route into OSPF and a route to 77.77.77.0 as E2.
The following show commands will be used in the following segment:
R# show ip ospf database
! Lists a summary of all the LSAs in the database
R# show ip ospf database TYPE [LSA-ID]
! TYPE: router|network|summary|asbr-summary|external|nssa-external
! Detailed view of each LSA
R# show ip ospf database TYPE adv-router ROUTER-ID
! Detailed view of LSAs advertised by router ROUTER-ID
R# show ip ospf database TYPE self-originate
! Detailed view of LSAs advertised by the current router
Type 1 LSAs are generated by every router. On each interface running OSPF, the router will generate a Type 1 – Router LSA which will be flooded to all routers in the same area. The LSA ID of a Type 1 LSA is equal to the Router ID that advertised it. For example, on R5:
R5#sh ip ospf database
OSPF Router with ID (5.5.5.5) (Process ID 1)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 1 (DNA) 0x80000006 0x007315 3
2.2.2.2 2.2.2.2 287 (DNA) 0x80000004 0x00B356 2
3.3.3.3 3.3.3.3 20 (DNA) 0x80000006 0x00C337 2
5.5.5.5 5.5.5.5 510 0x80000003 0x003027 1
! Output omitted
Router Link States (Area 568)
Link ID ADV Router Age Seq# Checksum Link count
5.5.5.5 5.5.5.5 261 0x80000009 0x008CA3 1
6.6.6.6 6.6.6.6 268 0x80000002 0x0059D5 1
8.8.8.8 8.8.8.8 388 0x80000002 0x0003EA 2
! Output omitted
Router Link States (Area 1245)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 1015 0x80000003 0x009944 1
2.2.2.2 2.2.2.2 349 0x80000003 0x00CCE3 1
4.4.4.4 4.4.4.4 290 0x80000005 0x007C3B 5
5.5.5.5 5.5.5.5 1013 0x80000006 0x00DDA3 3
On R5 we have 4 Router LSAs in Area 0 (over the Virtual Link to R1), 3 Router LSAs in area 568 and 4 Router LSAs in area 1245. You can see that the Router LSAs are flooded inside the area because R5 has LSAs for R1 and R2 in area 1245 even if they are not directly connected. You can also see that only routers that are inside the area appear in the Router LSAs.
A Type 1 – Router LSA, contains information about the links a router has in an area. For example, seen from R4, the links of R5 in area 1245 appear like this
R5#sh ip ospf database router 4.4.4.4
OSPF Router with ID (5.5.5.5) (Process ID 1)
Router Link States (Area 1245)
LS age: 1502
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: 80000009
Checksum: 0x9325
Length: 84
Number of Links: 5
Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 5.5.5.5
(Link Data) Router Interface address: 45.45.0.4
Number of TOS metrics: 0
TOS 0 Metrics: 64
Link connected to: a Stub Network
(Link ID) Network/subnet number: 45.45.0.0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 64
Link connected to: a Transit Network
(Link ID) Designated Router address: 14.14.0.1
(Link Data) Router Interface address: 14.14.0.4
Number of TOS metrics: 0
TOS 0 Metrics: 10
Link connected to: a Transit Network
(Link ID) Designated Router address: 24.24.0.2
(Link Data) Router Interface address: 24.24.0.4
Number of TOS metrics: 0
TOS 0 Metrics: 10
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
Notice that this LSA is for area 1245, therefor it has no information about R5’s links in other areas. Also notice the different kinds of links:
- another router (point-to-point) – Connection to another router (identified by Router ID) over a point-to-point link. Information about the actual subnet used will be found in the following Stub link. On a point-to-multipoint links, only one stub entry is used for all routers, since they share the same subnet information
- Stub – contains subnet information regarding point-to-point or loopback links
- Transit Network – contains information regarding the DR on a multi-acesss link. Detailed information about this link can be found in a Type 2 – Network LSA generated by the DR
- Virtual Link – contains information regarding the other end of a Virtual Link.
You can see the virtual link in area 0:
R1#sh ip ospf database router 5.5.5.5
OSPF Router with ID (1.1.1.1) (Process ID 1)
Router Link States (Area 0)
Routing Bit Set on this LSA
LS age: 1 (DoNotAge)
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 5.5.5.5
Advertising Router: 5.5.5.5
LS Seq Number: 80000003
Checksum: 0x3027
Length: 36
Area Border Router
AS Boundary Router
Number of Links: 1
Link connected to: a Virtual Link
(Link ID) Neighboring Router ID: 1.1.1.1
(Link Data) Router Interface address: 45.45.0.5
Number of TOS metrics: 0
TOS 0 Metrics: 74
Network LSAs are generated by the DR on every multi-access network. The LSA ID is equal to the IP address of the DR that advertised it. This type of LSA is similar to the Router LSA because it is flooded to all routers in an area. You can verify this on R5:
R5#sh ip ospf database
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
123.123.0.3 3.3.3.3 1262 (DNA) 0x80000001 0x003DDA
!Output Omitted
Net Link States (Area 568)
Link ID ADV Router Age Seq# Checksum
56.8.0.5 5.5.5.5 439 0x80000001 0x003357
!Output Omitted
Net Link States (Area 1245)
Link ID ADV Router Age Seq# Checksum
14.14.0.4 4.4.4.4 981 0x80000002 0x00589C
24.24.0.4 4.4.4.4 981 0x80000002 0x008F4D
!Output Omitted
In each area where R5 is part of, we have a multi-access network. Therefor we have one Network LSA in Area 0 (over the virtual link), one network LSA in area 568(because we used the default NON_BROADCAST network type), and 2 Network LSAs in area 1245 (because we use ethernet connections on the links from R1 to R4 and R5). This information is flooded to all routers in the area.
Here’s a detailed look at one Type 2 LSA:
R5#sh ip ospf database network 14.14.0.4
OSPF Router with ID (5.5.5.5) (Process ID 1)
Net Link States (Area 1245)
Routing Bit Set on this LSA
LS age: 1400
Options: (No TOS-capability, DC)
LS Type: Network Links
Link State ID: 14.14.0.4 (address of Designated Router)
Advertising Router: 4.4.4.4
LS Seq Number: 80000002
Checksum: 0x589C
Length: 32
Network Mask: /24
Attached Router: 4.4.4.4
Attached Router: 1.1.1.1
The LSA contains the attached routers along with subnet information (Link State ID + Network Mask). There is no cost information, because this information is found on each of the Type 1 LSAs generated by the Attached Routers.
Network Summary LSAs are originated only by ABRs. An ABR has connections in Area 0 and and at least one non-backbone area. The ABR will advertise intra-area routes of the non-backbone area inside area 0, and will advertise intra-area and inter-area routes from area 0 to the non-backbone areas.
For example, on R7:
R7#sh ip ospf database
!Output omitted
Summary Net Link States (Area 367)
Link ID ADV Router Age Seq# Checksum
1.1.1.1 3.3.3.3 1753 0x80000002 0x006DB3
2.2.2.2 3.3.3.3 1753 0x80000002 0x003FDD
3.3.3.3 3.3.3.3 1753 0x80000002 0x00AC76
4.4.4.4 3.3.3.3 1753 0x80000002 0x0047C3
5.5.5.5 3.3.3.3 1753 0x80000002 0x009B2B
8.8.8.8 3.3.3.3 209 0x80000001 0x0095E5
14.14.0.0 3.3.3.3 1756 0x80000002 0x009669
24.24.0.0 3.3.3.3 1756 0x80000002 0x009B50
45.45.0.0 3.3.3.3 1756 0x80000002 0x000F72
56.8.0.0 3.3.3.3 506 0x80000002 0x00BF9B
123.123.0.0 3.3.3.3 1756 0x80000002 0x0082AC
!Output Omitted
You can see that the ABR (R3) is advertising Summary LSAs into Area 367 with information regarding all known routes in area 0, except those internal to Area 367.
In the same time, in Area 0, R3 advertise Summary LSAs with information regarding Intra-Area routes of Area 367:
R3#sh ip ospf database | i 3.3.3.3|Link|Summary
!Output Omitted
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
6.6.6.6 3.3.3.3 1897 0x80000002 0x008686
7.7.7.7 3.3.3.3 1897 0x80000002 0x0058B0
36.7.0.0 3.3.3.3 1897 0x80000002 0x006793
Also in Area 0, R1, R2 and R5 advertise Summary LSAs for their non-backbone areas.
R1#sh ip ospf database | e 3.3.3.3
!Output Omitted
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
4.4.4.4 1.1.1.1 1970 0x80000002 0x001FFD
4.4.4.4 2.2.2.2 2034 0x80000002 0x000118
4.4.4.4 5.5.5.5 6 (DNA) 0x80000001 0x00C611
5.5.5.5 1.1.1.1 1970 0x80000002 0x007365
5.5.5.5 2.2.2.2 2034 0x80000002 0x00557F
5.5.5.5 5.5.5.5 6 (DNA) 0x80000001 0x0016FD
8.8.8.8 5.5.5.5 1 (DNA) 0x80000001 0x000EB9
14.14.0.0 1.1.1.1 1973 0x80000002 0x006EA3
14.14.0.0 2.2.2.2 2036 0x80000002 0x00B44F
14.14.0.0 5.5.5.5 6 (DNA) 0x80000001 0x007A48
24.24.0.0 1.1.1.1 1973 0x80000002 0x00D71C
24.24.0.0 2.2.2.2 2036 0x80000002 0x0055A4
24.24.0.0 5.5.5.5 6 (DNA) 0x80000001 0x007F2F
45.45.0.0 1.1.1.1 1973 0x80000002 0x00E6AC
45.45.0.0 2.2.2.2 2036 0x80000002 0x00C8C6
45.45.0.0 5.5.5.5 6 (DNA) 0x80000001 0x000C82
56.8.0.0 5.5.5.5 6 (DNA) 0x80000001 0x003A6E
!Output Omitted
When an ABR originates a type 3 LSA, it includes the cost from itself to the destination LSA it is advertising. If an ABR knows multiple routes to a destination, it originates a single type 3 LSA with the lowest cost of the multiple routes.
Here’s how a Type 3 LSA looks like:
R7# sh ip ospf data summ 4.4.4.4
OSPF Router with ID (7.7.7.7) (Process ID 1)
Summary Net Link States (Area 367)
Routing Bit Set on this LSA
LS age: 104
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 4.4.4.4 (summary Network Number)
Advertising Router: 3.3.3.3
LS Seq Number: 80000004
Checksum: 0x43C5
Length: 28
Network Mask: /32
TOS: 0 Metric: 21
When another router receives a type 3 LSA, it will not run SPF and will insert the route in the routing table with a cost equal to the cost included in the LSA plus the cost of the route to the ABR.
R7# sh ip route | i 4.4.4.4
O IA 4.4.4.4 [110/31] via 36.7.0.3, 00:20:05, FastEthernet0/1
You can see that the route to 4.4.4.4 has a metric of 31 in the routing table, but it was advertised in the LSA with a metric of 21.
A Type 4 LSA – ASBR Summary advertises an ASBR, not a subnet. To advertise external destinations, the Type 5 LSAs are used. They advertise external routes with an ASBR as the next hop. This ASBR can be found in the Type 4 LSAs. Each ASBR advertises a Type 4 LSA with its own Router ID as the LSA ID. These LSAs are flooded by the ABRs in all areas (except stub areas). You will find the LSA generated by R7 on R4, beeing advertised by the 2 ABRs in area 1245:
R4# show ip ospf database
!Output Omitted
Summary ASB Link States (Area 1245)
Link ID ADV Router Age Seq# Checksum
7.7.7.7 1.1.1.1 190 0x80000003 0x00DE27
7.7.7.7 2.2.2.2 224 0x80000003 0x00C041
!Output Omitted
Here’s a detailed look at this LSA:
R4#sh ip ospf database asbr-summary 7.7.7.7
OSPF Router with ID (4.4.4.4) (Process ID 1)
Summary ASB Link States (Area 1245)
Routing Bit Set on this LSA
LS age: 502
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(AS Boundary Router)
Link State ID: 7.7.7.7 (AS Boundary Router address)
Advertising Router: 1.1.1.1
LS Seq Number: 80000003
Checksum: 0xDE27
Length: 28
Network Mask: /0
TOS: 0 Metric: 20
AS External LSAs are also originated by ASBRs. They advertise a destination external to the OSPF domain or an external default route. They are flooded throughout the AS. The ASBR creates one LSA for each prefix that it injects into OSPF, inluding, if necessary, one for the default route. The LSA-ID is the injected prefix.
R4# show ip ospf database
!Output Omitted
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
0.0.0.0 7.7.7.7 765 0x80000003 0x006430 1
77.77.77.0 7.7.7.7 5 0x80000001 0x003666 0
79.79.0.0 7.7.7.7 5 0x80000001 0x00568F 0
Here’s a detailed view of one of them:
R4#sh ip ospf database external 77.77.77.0
OSPF Router with ID (4.4.4.4) (Process ID 1)
Type-5 AS External Link States
Routing Bit Set on this LSA
LS age: 176
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 77.77.77.0 (External Network Number )
Advertising Router: 7.7.7.7
LS Seq Number: 80000001
Checksum: 0x3666
Length: 36
Network Mask: /24
Metric Type: 2 (Larger than any link state path)
TOS: 0
Metric: 20
Forward Address: 0.0.0.0
External Route Tag: 0
The Forward Address contains the next hop address for the destination. Normally, it is set to 0.0.0.0 which means that the Advertising Router should be used as a next hop. The exception occurs when a Type 7 LSA is translated to a Type 5 LSA, which by default sets the Next Hop Address to the ASBR that first advertised the prefix.
Also notice the Metric Type information. When the metric type is set to 2, then the router will use the metric in the LSA to compute the route metric:
R4#sh ip route | i 77.77.
O E2 77.77.77.0 [110/20] via 24.24.0.2, 01:01:40, FastEthernet0/0
When the metric type is set to 1, the router will add the metric to the ASBR to the metric in the Type 5 LSA.
NSSA External LSAs are originated by ASBRs in NSSAs. They are flooded only within the NSSA area in which it was originated. The ABRs will translate to Type 5 AS Summary LSA before flooding to area 0. Such a LSA can be seen on R5:
R5# show ip ospf database
!Output Omitted
Type-7 AS External Link States (Area 568)
Link ID ADV Router Age Seq# Checksum Tag
88.88.88.0 8.8.8.8 548 0x80000002 0x0085C6 0
Type 7 LSAs differ from Type 5 LSAs in that they set the Next Hop to the ASBR address instead of 0.0.0.0 – which means use the Advertising Router’s address. This will propagate by default into the translate Type 5 LSAs that go into area 0. We can observe this by looking first at the Type 7 LSA:
R5#sh ip ospf database nssa-external 88.88.88.0
OSPF Router with ID (5.5.5.5) (Process ID 1)
Type-7 AS External Link States (Area 568)
Routing Bit Set on this LSA
LS age: 208
Options: (No TOS-capability, Type 7/5 translation, DC)
LS Type: AS External Link
Link State ID: 88.88.88.0 (External Network Number )
Advertising Router: 8.8.8.8
LS Seq Number: 80000004
Checksum: 0xFDCC
Length: 36
Network Mask: /24
Metric Type: 1 (Comparable directly to link state metric)
TOS: 0
Metric: 20
Forward Address: 8.8.8.8
External Route Tag: 0
Here, we have the Forward address set to the ASBR ID. When the ABR translates it into a Type 5 LSA, it will have the same forward address:
R4#sh ip ospf database external 88.88.88.0
OSPF Router with ID (4.4.4.4) (Process ID 1)
Type-5 AS External Link States
Routing Bit Set on this LSA
LS age: 349
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 88.88.88.0 (External Network Number )
Advertising Router: 5.5.5.5
LS Seq Number: 80000004
Checksum: 0xECF3
Length: 36
Network Mask: /24
Metric Type: 1 (Comparable directly to link state metric)
TOS: 0
Metric: 20
Forward Address: 8.8.8.8
External Route Tag: 0
This behavior can be changed if we use:
R(config-router)# area AREA nssa translate type7 suppress-fa
This will suppress the ASBR address in the Forward Address field and replace it with 0.0.0.0, meaning “use the advertising router”. This can be useful in situation where the ASBR cannot be reached from outside its area.
Also notice that this route was injected with a metric type of 1. This means that in the routing table, the metric in this LSA will be added to the metric to the ASBR. Here’s the proof: the route has a metric of 149. 20 represent the LSA and 129 represent the distance to the ASBR.
R4#sh ip route | i 88.88
O E1 88.88.88.0 [110/149] via 45.45.0.5, 00:08:55, Serial1/0
R4#sh ip route | i 8.8.8
O IA 8.8.8.8 [110/129] via 45.45.0.5, 01:09:54, Serial1/0
Last modified 1yr ago