OSPF LSA Types

Link-State Announcements

When OSPF neighbors become adjacent, the LSDBs synchronize between the OSPF routers. As an OSPF router adds or removes a directly connected network link to or from its database, the router floods the LSA out all active OSPF interfaces.

The OSPF LSA contains a complete list of networks advertised from that router.

LSA Types 1, 2, and 3 are used for building the SPF tree for intra-area and interarea route routes.
LSA Types 4, 5, and 7 are related to external OSPF routes (that is, routes that were redistributed into the OSPF routing domain).

Type Description
Type 1, router LSA LSA that advertises network prefixes within an Area.
Type 2, network LSA LSA that indicates the router attached to a broadcast segment within an Area.
Type 3, summary LSA that advertises network prefixes located in a different Area.
Type 4, ASBR Summary LSA used to locate the ASBR from a different Area.
Type 5, AS External LSA that advertises network prefixes that were redistributed into OSPF.
Type 7, NSSA External LSA for external network prefixes that were redistributed in a local NSSA Area.

LSA Header

Each LSA has a 20-byte common LSA header.

LSA Header Format
Field Description
LS Age Gives the time, in seconds, since the LSA originated.
The maximum age of the LSA is 3600 seconds; the refresh time is 1800 seconds.
If the LS age reaches 3600 seconds, the LSA must be removed from the database.
LS Type Represents the types of LSA.
Link-State ID
Identifies the portion of the network that is being described by the LSA.
This field changes according to the LS type.
Adv. Router RID of the router originating the LSA.
LS Sequence Number Detects old or duplicate LSAs.
LS Checksum Performs checksum on the LSA, not including LS age.
An LSA can be corrupted during flooding or while kept in the memory, so this checksum is necessary.

LSA Sequences

  • OSPF uses the sequence number to overcome problems caused by delays in LSA propagation in a network.
  • The LSA sequence number is a 32-bit number for controlling versioning.
  • When the originating router sends out LSAs, the LSA sequence number is incremented.
  • If a router receives an LSA sequence that is greater than the one in the LSDB, it processes the LSA.
  • If the LSA sequence number is lower than the one in the LSDB, the router deems the LSA old and discards the LSA.

LSA Age and Flooding

  • Every OSPF LSA includes an age that is entered into the local LSDB and that will increment by 1 every second.
  • When a router’s OSPF LSA age exceeds 1800 seconds (30 minutes) for its networks, the originating router advertises a new LSA with the LSA age set to 0.
  • As each router forwards the LSA, the LSA age is incremented with a calculated (minimal) delay that reflects the link.
  • If the LSA age reaches 3600 (60 minutes), the LSA is deemed invalid and is purged from the LSDB.
  • The repetitive flooding of LSAs is a secondary safety mechanism to ensure that all routers maintain a consistent LSDB within an area.

Type 1 Router LSA

  • Generated by each router for each area to which the router belongs.
  • These packets describe the states of the router’s link to the area and are flooded only within a particular area.
    • A Type 1 LSA entry exists for each OSPF-enabled link (that is, every interface and its attached networks).
  • All the router’s links in an area must be described in a single LSA.
  • Type 1 LSAs are the essential building blocks within the LSDB.
  • The Router LSA indicates whether it's an ABR, ASBR or an endpoint of a Virtual Link.

During the SPF tree calculation, network link types are one of the following:

Link Type Description
Transit A transit network indicates that an adjacency was formed and that a DR was elected on that link.
Point-to-Point P2P links indicate that an adjacency was formed on a network type that does not use a DR.
Interfaces using the OSPF point-to-point network type advertise two links:
One Link: P2P link type that identifies the OSPF neighbor RID for that segment.
Second Link: Stub network link that provides the subnet mask for that network.
Stub A stub network indicates that no neighbor adjacencies were established on that link.
Point-to-point and transit link types that did not become adjacent with another OSPF router are classified as a stub network link type.
When an OSPF adjacency forms, the link type changes to the appropriate type: point-to-point or transit.

Packet Format

Router LSA - Packet Capture
Field Description
Link State ID /
Adv. Router
Should have the same value - RID of advertising router.
Flags Bit V - Determine whether it's an endpoint of a virtual link.
Bit E - Determine whether this router is an ASBR
Bit B - Determine whether this router is an ABR
Number of Links Includes the number of router links.
Link ID, Link Data
and Type
Link ID and Link Data - represents the 4-byte IP address value, depending on the network type
Type - represent the 4 types of router links
Metric Contains the OSPF cost of a specific link.
Different Router Link Types

Router LSA Example

A few important things to note:

  • In normal situations, the LS Age field should be less than 1800.
  • In the case of a Router LSA, the Link State ID field and Advertising Router should have the same value.
  • This router is an ABR and has three router links.

With every point-to-point link, there is a stub link to provide the subnet mask of the link. In this example, two point-to-point links and one stub link are associated with these two point-to-point links because the network type is point-to-multipoint. So, if there are 300 point-to-point links, the router will generate 300 point-to-point links as well as 300 stub links to address the subnet associated with each point-to-point link.

The point-to-multipoint network type is a better choice in this case, for two reasons:

  • Only one subnet is required per point-to-multipoint network.
  • The size of the router LSA is cut in half because there will be only one stub link
    to address the subnet on a point-to-multipoint network.

Type 2 Network LSA

  • A Type 2 LSA represents a multi-access network segment that uses a DR.
  • The DR always advertises the Type 2 LSA and identifies all the routers attached to that network segment.
  • If a DR has not been elected, a Type 2 LSA is not present in the LSDB because the corresponding Type 1 transit link type LSA is a stub.
  • Like Type 1 LSAs, Type 2 LSAs are not flooded outside the originating OSPF area.
  • When the DR changes for a network segment, a new Type 2 LSA is created, causing SPF to run again within the OSPF area.

Network LSA Packet Format

Network LSA - Packet Capture
Field Description
Link State ID Interface IP Address of DR
Adv. Router RID of DR
Network Mask Indicates the network mask associated with the transit link
Attached Router Includes the RIDs of each router attached to the transit link.
The DR router also lists itself in attached routers.

Network LSA Example

Two important things to remember here:

  • The Link State ID field always contains the IP address of the DR.
  • The Advertising Router field always contains the RID of the DR.

Type 3 Summary LSA

  • Type 3 LSAs represent networks from other areas.
  • The role of the ABRs is to participate in multiple OSPF areas and ensure that the networks associated with Type 1 LSAs are reachable in the non-originating OSPF areas.
  • ABRs do not forward Type 1 or Type 2 LSAs into other areas.
  • When an ABR receives a Type 1 LSA, it creates a Type 3 LSA referencing the network in the original Type 1 LSA; the Type 2 LSA is used to determine the network mask of the multi-access network. The ABR then advertises the Type 3 LSA into other areas.
  • If an ABR receives a Type 3 LSA from Area 0 (the backbone), it regenerates a new Type 3 LSA for the nonbackbone area and lists itself as the advertising router, with the additional cost metric.
  • An ABR advertises only one Type 3 LSA for a prefix, even if it is aware of multiple paths from within its area (Type 1 LSAs) or from outside its area (Type 3 LSAs). The metric for the best path is used when the LSA is advertised into a different area.

How metric is calculated?

The advertising router for Type 3 LSAs is the last ABR that advertises the prefix. The metric in the Type 3 LSA uses the following logic:

  • If the Type 3 LSA is created from a Type 1 LSA, it is the total path metric to reach the originating router in the Type 1 LSA.
  • If the Type 3 LSA is created from a Type 3 LSA from Area 0, it is the total path metric to the ABR plus the metric in the original Type 3 LSA.

Example 1:

  • R4 does not know if the 10.56.1.0/24 network is directly attached to the ABR (R5) or if it is multiple hops away.
  • R4 knows that its metric to the ABR (R5) is 1 and that the Type 3 LSA already has a metric of 1, so its total path metric is 2 to reach the 10.56.1.0/24 network.

Example 2:

  • R3 does not know if the 10.56.1.0/24 network is directly attached to the ABR (R4) or if it is multiple hops away.
  • R3 knows that its metric to the ABR (R4) is 65 and that the Type 3 LSA already has a metric of 2, so its total path metric is 67 to reach the 10.56.1.0/24 network.

Summary LSA Packet Format

Summary LSA - Packet Capture
Field Description
Link State ID Network ID
Adv. Router RID of ABR
Network Mask This fields contains the network mask associated with the network
Metric Represents the cost of the network
TOS Normally set to 0

Summary LSA Example

Two things to remember:

  • The Link State ID field is the network 9.9.9.0, and the network mask is /24.
  • The Link State ID field in summary LSAs Type 3 will always contain the network number that the summary LSA is generated for, along with the network mask.

Type 4 ASBR Summary LSA

  • A Type 4 LSA locates the ASBR for a Type 5 LSA.
  • A Type 5 LSA is flooded through the OSPF domain, and the only mechanism to identify the ASBR is the RID. Routers examine the Type 5 LSA, check to see whether the RID is in the local area, and if the ASBR is not local, they require a mechanism to locate the ASBR. Type 4 LSAs provide a way for routers to locate the ASBR when the router is in a different area from the ASBR.
  • A Type 4 LSA is created by the first ABR, and it provides a summary route strictly for the ASBR of a Type 5 LSA.

Metric's logic to reach ASBR

The metric for a Type 4 LSA uses the following logic:

  • When the Type 5 LSA crosses the first ABR, the ABR creates a Type 4 LSA with a metric set to the total path metric to the ASBR.
  • When an ABR receives a Type 4 LSA from Area 0, the ABR creates a new Type 4 LSA with a metric set to the total path metric of the first ABR plus the metric in the original Type 4 LSA.

An ABR advertises only one Type 4 LSA for every ASBR, even if the ASBR advertises thousands of Type 5 LSAs.

ASBR Summary Packet Format

Summary ASBR - Packet Capture
Field Description
Link State ID RID of ASBR
Adv. Router RID of ABR
Network Mask Field must be 0
Metric Cost to reach ASBR

ASBR Summary LSA Example

Two important things to remember:

  • The Link State ID is always the RID of the ASBR.
  • The Network Mask field must always be 0 because this is the information about a router (ASBR), not a network,

Type 5 External LSA

  • The external LSA defines routes to destinations external to the AS.
  • The external route is flooded throughout the entire OSPF domain as a Type 5 LSA, except to stubby areas.
  • Type 5 LSAs are not associated with a specific area and are flooded throughout the OSPF domain.
  • Only the LSA age is modified during flooding for Type 2 external OSPF routes.

To install an external LSA in the RIB, two essential things must take place:

  1. The calculation router must see the ASBR through the intra-area or inter-area route, which means that it should have either a Type 1 Router LSA or a Type 4 ASBR Summary LSA, in case of multiple areas.
  2. The forwarding address must be known through an intra- or inter-area route.

External Route Calculation

Intra-Area Externals Inter-Area Externals
- ASBR can reach Link A in cost X
- I can reach ASBR via SPT in cost Y
- Implies I can reach Link A via SPT in cost X + Y
- ASBR can reach Link A in cost X
- ABR can reach ASBR via SPT in cost Y
- I can reach ABR via SPT in cost Z
- Implies I can reach Link A via SPT in cost X + Y + Z

External LSA Packet Format

External LSA - Packet Capture
Field Description
Link State ID External network number.
Adv. Router RID of ASBR
Network Mask Network mask of the external network.
Bit E Specifies the external type.
If set, it's an External Type 2; otherwise, it's a Type 1.
Forwarding Address Indicates the address to which data traffic to the advertised network should be forwarded.
0.0.0.0 means that the traffic should be forwarded to the ASBR.
External Route Tag Not used by OSPF
  • Link State ID: External network number.
  • Advertising Router: RID of ASBR.
  • Netmask: Network mask of the external network.
  • Bit E: Specifies the external type.
    • If set, it’s an External Type 2; otherwise, it’s a Type 1.
  • Forwarding Address: Indicates the address to which data traffic to the advertised network should be forwarded.
    • 0.0.0.0 means that the traffic should be forwarded to the ASBR.
  • External Route Tag: Not used by OSPF

External LSA Example

Things to remember:

  • The Link State ID represents the external network number.
  • The advertising router contains the RID of the ASBR.
  • Metric Type: 2 means that the metric 20, remains the same throughout the OSPF domain.
  • A forwarding address of 0.0.0.0 means that the traffic should be forwarded directly to the ASBR.
    • The route to the nonzero forwarding address must be known through an intra-area or interarea route; otherwise, the external route will not get installed in the routing table.
    • Forwarding address is selected on ASBR using the following rules:
      • If there is a loopback configured in the area, then the IP address of looback is selected as forwarding address.
      • If first condition is not met, then IP address of first interface on the OSPF interface list is selected as forwarding address.

Type 7 NSSA External LSA

  • An ASBR injects external routes as Type 7 LSAs in an NSSA.
  • The ABR does not advertise Type 7 LSAs outside the originating NSSA, but it converts the Type 7 LSA into a Type 5 LSA for the other OSPF areas.
  • If the Type 5 LSA crosses Area 0, the second ABR creates a Type 4 LSA for the Type 5 LSA.
R4# show ip ospf database
! Output omitted for brevity
            OSPF Router with ID (192.168.4.4) (Process ID 1)
..
                Summary ASB Link States (Area 1234)

Link ID         ADV Router      Age         Seq#       Checksum
192.168.5.5     192.168.4.4     193         0x80000001 0x002A2C

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
172.16.6.0      192.168.5.5     176         0x80000001 0x0045DB0

R5# show ip ospf database nssa-external OSPF Router with ID (192.168.5.5) (Process ID 1) Type-7 AS External Link States (Area 56) LS age: 122 Options: (No TOS-capability, Type 7/5 translation, DC, Upward) LS Type: AS External Link Link State ID: 172.16.6.0 (External Network Number ) Advertising Router: 192.168.6.6 LS Seq Number: 80000001 Checksum: 0xA371 Length: 36 Network Mask: /24 Metric Type: 2 (Larger than any link state path) MTID: 0 Metric: 20 Forward Address: 10.56.1.6 External Route Tag: 0

NSSA LSA Packet Format

  • Link State ID: External network number
  • Advertising Router: RID of ASBR

Packet format for Type 7 LSA is very similar of Type 5 LSA.

NSSA LSA Example

Few things to remember:

  • The P bit is used to tell the NSSA ABR whether to translate Type 7 LSAs into Type 5 LSAs.
    • No Type 7/5 translation means P bit = 0
    • Type 7/5 translation means P bit = 1
  • If P bit = 0, the NSSA ABR must not translate this LSA into a Type 5 LSA. This happens when the NSSA ASBR is also an NSSA ABR.
  • If P bit = 1, the NSSA ABR (if multiple NSSA ABRs exist, the one with the lowest
    router ID) must translate this Type 7 LSA into a Type 5 LSA.

P stands for propagation. Basically, this is used for propagation control. The ABR makes the decision based on the value of this bit.

Summary

LSA Type 1

  • Generated by every router in the OSPF domain
  • Describes its directly connected links
  • Used to build the graph for intra-area SPF

LSA Type 2

  • Generated byDR on broadcast and non-broadcast network types
    • Not flooded outside area
  • Describes who is adjacent with the DR
    • Link cost to the DR
    • Implies link cost to all other adjacent to that DR
  • Used to reduce redundant information in the database

LSA Type 5

  • Generated by ASBR
    • Flooded to all non-stub areas
  • Describes routes ASBR is redistributing

LSA Type 3

  • Generated by ABR
    • Flooded from Area 0 into non-backbone areas and vice-versa
  • Describes ABR’s reachability to links in other areas
    • Includes cost, but hides ABR’s actual path to destination
  • SPF not run for ABR advertised routes
    • ABR can reach link A via SPT in cost X
    • I can reach ABR via SPT in cost Y
    • Implies I can reach link A via SPT in cost X + Y

LSA Type 4

  • Generated by ABR
  • Describes ABR’s reachability to ASBRs in other areas
  • SPF not run to reach inter-area ASBR
    • ABR can reach ASBR via SPT in cost X
    • I can reach ABR via SPT in cost Y
    • Implies I can reach ASBR via SPT in cost X + Y

1 thought on “OSPF LSA Types”

Leave a Reply

Related Post

OSPF AdjacenciesOSPF Adjacencies

OSPF creates adjacencies between neighboring routers for the purpose of exchanging routing information. Not every neighbor becomes adjacent in a broadcast environment. The Hello protocol is responsible for establishing and