OSPF LSAs

LSA components

  • 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

Link State Database – LSDB

When multiple instances of the same LSA are received, a router will:
  1. 1.
    Compare sequance number – the higher will be considered more recent
  2. 2.
    Compare checksum – the highest unsigned is considered more recent
  3. 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:
1
R#show ip ospf database
Copied!
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)
1
R(config-router)# timers pacing lsa-group SEC
2
R(config-router)# timers pacing {flood|retransmission} SEC
3
R# show ip ospf flood-list INTERFACE
4
!Displays the list of LSAs waiting to be flooded over an interface
Copied!

Reducing LSA Flooding

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.
1
R(config-if)#ip ospf flood-reduction
Copied!

Destination Types

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:
    1
    R# show ip ospf border-routers
    Copied!

LSA Types

  1. 1.
    Router LSA
  2. 2.
    Network LSA
  3. 3.
    Network Summary LSA
  4. 4.
    ASBR Summary LSA
  5. 5.
    AS External LSA
  6. 6.
    Group Membership LSA
  7. 7.
    NSSA External LSA
  8. 8.
    External Atribuites LSA
  9. 9.
    Opaque LSA (link-local scope)
  10. 10.
    Opaque LSA (area-local scope)
  11. 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:
1
R# show ip ospf database
2
! Lists a summary of all the LSAs in the database
3
R# show ip ospf database TYPE [LSA-ID]
4
! TYPE: router|network|summary|asbr-summary|external|nssa-external
5
! Detailed view of each LSA
6
R# show ip ospf database TYPE adv-router ROUTER-ID
7
! Detailed view of LSAs advertised by router ROUTER-ID
8
R# show ip ospf database TYPE self-originate
9
! Detailed view of LSAs advertised by the current router
Copied!

Router LSA – Type 1

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:
1
R5#sh ip ospf database
2
3
OSPF Router with ID (5.5.5.5) (Process ID 1)
4
5
Link ID ADV Router Age Seq# Checksum Link count
6
1.1.1.1 1.1.1.1 1 (DNA) 0x80000006 0x007315 3
7
2.2.2.2 2.2.2.2 287 (DNA) 0x80000004 0x00B356 2
8
3.3.3.3 3.3.3.3 20 (DNA) 0x80000006 0x00C337 2
9
5.5.5.5 5.5.5.5 510 0x80000003 0x003027 1
10
! Output omitted
11
Router Link States (Area 568)
12
13
Link ID ADV Router Age Seq# Checksum Link count
14
5.5.5.5 5.5.5.5 261 0x80000009 0x008CA3 1
15
6.6.6.6 6.6.6.6 268 0x80000002 0x0059D5 1
16
8.8.8.8 8.8.8.8 388 0x80000002 0x0003EA 2
17
! Output omitted
18
Router Link States (Area 1245)
19
20
Link ID ADV Router Age Seq# Checksum Link count
21
1.1.1.1 1.1.1.1 1015 0x80000003 0x009944 1
22
2.2.2.2 2.2.2.2 349 0x80000003 0x00CCE3 1
23
4.4.4.4 4.4.4.4 290 0x80000005 0x007C3B 5
24
5.5.5.5 5.5.5.5 1013 0x80000006 0x00DDA3 3
Copied!
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
1
R5#sh ip ospf database router 4.4.4.4
2
3
OSPF Router with ID (5.5.5.5) (Process ID 1)
4
5
Router Link States (Area 1245)
6
7
LS age: 1502
8
Options: (No TOS-capability, DC)
9
LS Type: Router Links
10
Link State ID: 4.4.4.4
11
Advertising Router: 4.4.4.4
12
LS Seq Number: 80000009
13
Checksum: 0x9325
14
Length: 84
15
Number of Links: 5
16
17
Link connected to: another Router (point-to-point)
18
(Link ID) Neighboring Router ID: 5.5.5.5
19
(Link Data) Router Interface address: 45.45.0.4
20
Number of TOS metrics: 0
21
TOS 0 Metrics: 64
22
23
Link connected to: a Stub Network
24
(Link ID) Network/subnet number: 45.45.0.0
25
(Link Data) Network Mask: 255.255.255.0
26
Number of TOS metrics: 0
27
TOS 0 Metrics: 64
28
29
Link connected to: a Transit Network
30
(Link ID) Designated Router address: 14.14.0.1
31
(Link Data) Router Interface address: 14.14.0.4
32
Number of TOS metrics: 0
33
TOS 0 Metrics: 10
34
35
Link connected to: a Transit Network
36
(Link ID) Designated Router address: 24.24.0.2
37
(Link Data) Router Interface address: 24.24.0.4
38
Number of TOS metrics: 0
39
TOS 0 Metrics: 10
40
41
Link connected to: a Stub Network
42
(Link ID) Network/subnet number: 4.4.4.4
43
(Link Data) Network Mask: 255.255.255.255
44
Number of TOS metrics: 0
45
TOS 0 Metrics: 1
Copied!
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:
1
R1#sh ip ospf database router 5.5.5.5
2
3
OSPF Router with ID (1.1.1.1) (Process ID 1)
4
5
Router Link States (Area 0)
6
7
Routing Bit Set on this LSA
8
LS age: 1 (DoNotAge)
9
Options: (No TOS-capability, DC)
10
LS Type: Router Links
11
Link State ID: 5.5.5.5
12
Advertising Router: 5.5.5.5
13
LS Seq Number: 80000003
14
Checksum: 0x3027
15
Length: 36
16
Area Border Router
17
AS Boundary Router
18
Number of Links: 1
19
20
Link connected to: a Virtual Link
21
(Link ID) Neighboring Router ID: 1.1.1.1
22
(Link Data) Router Interface address: 45.45.0.5
23
Number of TOS metrics: 0
24
TOS 0 Metrics: 74
Copied!

Network LSA – Type 2

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:
1
R5#sh ip ospf database
2
Net Link States (Area 0)
3
4
Link ID ADV Router Age Seq# Checksum
5
123.123.0.3 3.3.3.3 1262 (DNA) 0x80000001 0x003DDA
6
!Output Omitted
7
Net Link States (Area 568)
8
9
Link ID ADV Router Age Seq# Checksum
10
56.8.0.5 5.5.5.5 439 0x80000001 0x003357
11
!Output Omitted
12
Net Link States (Area 1245)
13
14
Link ID ADV Router Age Seq# Checksum
15
14.14.0.4 4.4.4.4 981 0x80000002 0x00589C
16
24.24.0.4 4.4.4.4 981 0x80000002 0x008F4D
17
18
!Output Omitted
Copied!
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:
1
R5#sh ip ospf database network 14.14.0.4
2
3
OSPF Router with ID (5.5.5.5) (Process ID 1)
4
5
Net Link States (Area 1245)
6
7
Routing Bit Set on this LSA
8
LS age: 1400
9
Options: (No TOS-capability, DC)
10
LS Type: Network Links
11
Link State ID: 14.14.0.4 (address of Designated Router)
12
Advertising Router: 4.4.4.4
13
LS Seq Number: 80000002
14
Checksum: 0x589C
15
Length: 32
16
Network Mask: /24
17
Attached Router: 4.4.4.4
18
Attached Router: 1.1.1.1
Copied!
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 LSA – Type 3

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:
1
R7#sh ip ospf database
2
!Output omitted
3
Summary Net Link States (Area 367)
4
5
Link ID ADV Router Age Seq# Checksum
6
1.1.1.1 3.3.3.3 1753 0x80000002 0x006DB3
7
2.2.2.2 3.3.3.3 1753 0x80000002 0x003FDD
8
3.3.3.3 3.3.3.3 1753 0x80000002 0x00AC76
9
4.4.4.4 3.3.3.3 1753 0x80000002 0x0047C3
10
5.5.5.5 3.3.3.3 1753 0x80000002 0x009B2B
11
8.8.8.8 3.3.3.3 209 0x80000001 0x0095E5
12
14.14.0.0 3.3.3.3 1756 0x80000002 0x009669
13
24.24.0.0 3.3.3.3 1756 0x80000002 0x009B50
14
45.45.0.0 3.3.3.3 1756 0x80000002 0x000F72
15
56.8.0.0 3.3.3.3 506 0x80000002 0x00BF9B
16
123.123.0.0 3.3.3.3 1756 0x80000002 0x0082AC
17
!Output Omitted
Copied!
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:
1
R3#sh ip ospf database | i 3.3.3.3|Link|Summary
2
!Output Omitted
3
Summary Net Link States (Area 0)
4
Link ID ADV Router Age Seq# Checksum
5
6.6.6.6 3.3.3.3 1897 0x80000002 0x008686
6
7.7.7.7 3.3.3.3 1897 0x80000002 0x0058B0
7
36.7.0.0 3.3.3.3 1897 0x80000002 0x006793
Copied!
Also in Area 0, R1, R2 and R5 advertise Summary LSAs for their non-backbone areas.
1
R1#sh ip ospf database | e 3.3.3.3
2
!Output Omitted
3
Summary Net Link States (Area 0)
4
5
Link ID ADV Router Age Seq# Checksum
6
4.4.4.4 1.1.1.1 1970 0x80000002 0x001FFD
7
4.4.4.4 2.2.2.2 2034 0x80000002 0x000118
8
4.4.4.4 5.5.5.5 6 (DNA) 0x80000001 0x00C611
9
5.5.5.5 1.1.1.1 1970 0x80000002 0x007365
10
5.5.5.5 2.2.2.2 2034 0x80000002 0x00557F
11
5.5.5.5 5.5.5.5 6 (DNA) 0x80000001 0x0016FD
12
8.8.8.8 5.5.5.5 1 (DNA) 0x80000001 0x000EB9
13
14.14.0.0 1.1.1.1 1973 0x80000002 0x006EA3
14
14.14.0.0 2.2.2.2 2036 0x80000002 0x00B44F
15
14.14.0.0 5.5.5.5 6 (DNA) 0x80000001 0x007A48
16
24.24.0.0 1.1.1.1 1973 0x80000002 0x00D71C
17
24.24.0.0 2.2.2.2 2036 0x80000002 0x0055A4
18
24.24.0.0 5.5.5.5 6 (DNA) 0x80000001 0x007F2F
19
45.45.0.0 1.1.1.1 1973 0x80000002 0x00E6AC
20
45.45.0.0 2.2.2.2 2036 0x80000002 0x00C8C6
21
45.45.0.0 5.5.5.5 6 (DNA) 0x80000001 0x000C82
22
56.8.0.0 5.5.5.5 6 (DNA) 0x80000001 0x003A6E
23
!Output Omitted
Copied!
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:
1
R7# sh ip ospf data summ 4.4.4.4
2
3
OSPF Router with ID (7.7.7.7) (Process ID 1)
4
5
Summary Net Link States (Area 367)
6
7
Routing Bit Set on this LSA
8
LS age: 104
9
Options: (No TOS-capability, DC, Upward)
10
LS Type: Summary Links(Network)
11
Link State ID: 4.4.4.4 (summary Network Number)
12
Advertising Router: 3.3.3.3
13
LS Seq Number: 80000004
14
Checksum: 0x43C5
15
Length: 28
16
Network Mask: /32
17
TOS: 0 Metric: 21
Copied!
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.
1
R7# sh ip route | i 4.4.4.4
2
O IA 4.4.4.4 [110/31] via 36.7.0.3, 00:20:05, FastEthernet0/1
Copied!
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.

ASBR Summary LSA – Type 4

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:
1
R4# show ip ospf database
2
!Output Omitted
3
Summary ASB Link States (Area 1245)
4
5
Link ID ADV Router Age Seq# Checksum
6
7.7.7.7 1.1.1.1 190 0x80000003 0x00DE27
7
7.7.7.7 2.2.2.2 224 0x80000003 0x00C041
8
!Output Omitted
Copied!
Here’s a detailed look at this LSA:
1
R4#sh ip ospf database asbr-summary 7.7.7.7
2
3
OSPF Router with ID (4.4.4.4) (Process ID 1)
4
5
Summary ASB Link States (Area 1245)
6
7
Routing Bit Set on this LSA
8
LS age: 502
9
Options: (No TOS-capability, DC, Upward)
10
LS Type: Summary Links(AS Boundary Router)
11
Link State ID: 7.7.7.7 (AS Boundary Router address)
12
Advertising Router: 1.1.1.1
13
LS Seq Number: 80000003
14
Checksum: 0xDE27
15
Length: 28
16
Network Mask: /0
17
TOS: 0 Metric: 20
Copied!

AS External LSA – Type 5

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.
1
R4# show ip ospf database
2
!Output Omitted
3
Type-5 AS External Link States
4
5
Link ID ADV Router Age Seq# Checksum Tag
6
0.0.0.0 7.7.7.7 765 0x80000003 0x006430 1
7
77.77.77.0 7.7.7.7 5 0x80000001 0x003666 0
8
79.79.0.0 7.7.7.7 5 0x80000001 0x00568F 0
Copied!
Here’s a detailed view of one of them:
1
R4#sh ip ospf database external 77.77.77.0
2
3
OSPF Router with ID (4.4.4.4) (Process ID 1)
4
5
Type-5 AS External Link States
6
7
Routing Bit Set on this LSA
8
LS age: 176
9
Options: (No TOS-capability, DC)
10
LS Type: AS External Link
11
Link State ID: 77.77.77.0 (External Network Number )
12
Advertising Router: 7.7.7.7
13
LS Seq Number: 80000001
14
Checksum: 0x3666
15
Length: 36
16
Network Mask: /24
17
Metric Type: 2 (Larger than any link state path)
18
TOS: 0
19
Metric: 20
20
Forward Address: 0.0.0.0
21
External Route Tag: 0
Copied!
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:
1
R4#sh ip route | i 77.77.
2
O E2 77.77.77.0 [110/20] via 24.24.0.2, 01:01:40, FastEthernet0/0
Copied!
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 LSA – Type 7

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:
1
R5# show ip ospf database
2
!Output Omitted
3
Type-7 AS External Link States (Area 568)
4
5
Link ID ADV Router Age Seq# Checksum Tag
6
88.88.88.0 8.8.8.8 548 0x80000002 0x0085C6 0
Copied!
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:
1
R5#sh ip ospf database nssa-external 88.88.88.0
2
3
OSPF Router with ID (5.5.5.5) (Process ID 1)
4
5
Type-7 AS External Link States (Area 568)
6
7
Routing Bit Set on this LSA
8
LS age: 208
9
Options: (No TOS-capability, Type 7/5 translation, DC)
10
LS Type: AS External Link
11
Link State ID: 88.88.88.0 (External Network Number )
12
Advertising Router: 8.8.8.8
13
LS Seq Number: 80000004
14
Checksum: 0xFDCC
15
Length: 36
16
Network Mask: /24
17
Metric Type: 1 (Comparable directly to link state metric)
18
TOS: 0
19
Metric: 20
20
Forward Address: 8.8.8.8
21
External Route Tag: 0
Copied!
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:
1
R4#sh ip ospf database external 88.88.88.0
2
3
OSPF Router with ID (4.4.4.4) (Process ID 1)
4
5
Type-5 AS External Link States
6
7
Routing Bit Set on this LSA
8
LS age: 349
9
Options: (No TOS-capability, DC)
10
LS Type: AS External Link
11
Link State ID: 88.88.88.0 (External Network Number )
12
Advertising Router: 5.5.5.5
13
LS Seq Number: 80000004
14
Checksum: 0xECF3
15
Length: 36
16
Network Mask: /24
17
Metric Type: 1 (Comparable directly to link state metric)
18
TOS: 0
19
Metric: 20
20
Forward Address: 8.8.8.8
21
External Route Tag: 0
Copied!
This behavior can be changed if we use:
1
R(config-router)# area AREA nssa translate type7 suppress-fa
Copied!
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.
1
R4#sh ip route | i 88.88
2
O E1 88.88.88.0 [110/149] via 45.45.0.5, 00:08:55, Serial1/0
3
R4#sh ip route | i 8.8.8
4
O IA 8.8.8.8 [110/129] via 45.45.0.5, 01:09:54, Serial1/0
Copied!