USD ($)
$
United States Dollar
India Rupee

Explore OSPF LSA Types in the OSPF database

By Aadharsh Gupta in 14 May 2023 | 11:12 pm
Aadharsh Gupta

Aadharsh Gupta

Student
Faithful User
Forums Top User
Posts: 6
Likes: 15
Member since: 14 May 2023

Please explain how can I explore OSPF LSA Types in the OSPF database with a scenario examples.

14 May 2023 | 11:12 pm
3 Likes
Deepak Sharma

Deepak Sharma

Instructor
Faithful User
Expert Vendor
Golden Classes
King Seller
Fantastic Support
Loyal Writer
Posts: 7
Likes: 36
Followers: 146
Member since: 28 Mar 2023
Location: India/Delhi

In OSPF, there are several LSA types that are used to exchange routing information between OSPF routers. The most common OSPF LSA types are:


Type 1 - Router LSA

Type 2 - Network LSA

Type 3 - Summary LSA

Type 4 - ASBR Summary LSA

Type 5 - External LSA


Now let's take a look at most command OSPF LSA types from 1 to 5 with configuration examples and database entry for each type based on the scenario:


Type 1 - Router LSA

The Type 1 LSA is generated by every router in an OSPF area to describe its directly connected links and the state of those links. This LSA type is used to build the topology database within an area. Here is an example configuration for Router 1 in Area 0:


router ospf 1

 network 10.0.0.0 0.255.255.255 area 0

 network 192.168.1.0 0.0.0.255 area 1

 network 192.168.2.0 0.0.0.255 area 2


In this configuration, we're specifying the networks that are connected to Router 1 and assigning them to their respective OSPF areas. When Router 1 starts OSPF, it will generate a Type 1 LSA for each of its interfaces, which will be flooded throughout Area 0.


Here is an example of a Router 1 Type 1 LSA in the OSPF database for Area 0:


Link ID         ADV Router      Age  Seq#       Checksum Link count

10.0.0.1        10.0.0.1        246  0x80000003 0x00F7D5  1

10.0.0.2        10.0.0.1        248  0x80000003 0x00F7D4  1

192.168.1.1     10.0.0.1        331  0x80000003 0x00DD49  1

192.168.2.1     10.0.0.1        331  0x80000003 0x00DA51  1


In this database entry, we can see that Router 1 has four links, one of which is its loopback interface (Link ID 10.0.0.1) and the other three are its interfaces to the networks in Area 1 and Area 2.


Type 2 - Network LSA

The Type 2 LSA is generated by the Designated Router (DR) on a multi-access network to describe the set of routers that are connected to the network. Here is an example configuration for Router 2 in Area 1:


router ospf 1

 network 192.168.1.0 0.0.0.255 area 1


In this configuration, we're specifying that Router 2 is connected to the 192.168.1.0/24 network, which is part of Area 1. When Router 2 becomes the DR for this network, it will generate a Type 2 LSA to describe the set of routers that are connected to this network. Here is an example of a Type 2 LSA for the 192.168.1.0/24 network in the OSPF database for Area 1:


Link ID         ADV Router      Age  Seq#       Checksum

192.168.1.0     10.0.0.2        130  0x80000001 0x002F0F


In this database entry, we can see that the Designated Router for the 192.168.1.0/24 network is Router 2 (ADV Router 10.0.0.2). This LSA is flooded throughout Area 1 and is used by other routers in the area to determine the topology of the network.


Type 3 - Summary LSA

The Type 3 LSA is generated by an Area Border Router (ABR) to describe routes to networks outside of its own OSPF area. Here is an example configuration for Router 3, which is the ABR between Area 0 and Area 2:


router ospf 1

 network 10.0.0.0 0.255.255.255 area 0

 network 192.168.2.0 0.0.0.255 area 2

 redistribute connected subnets


In this configuration, we're specifying that Router 3 is connected to both Area 0 and Area 2, and we're also configuring it to redistribute connected subnets into OSPF. When Router 3 generates a Type 3 LSA for the 192.168.2.0/24 network, it will advertise it into Area 0 as a summary route. Here is an example of a Type 3 LSA for the 192.168.2.0/24 network in the OSPF database for Area 0:


Link ID         ADV Router      Age  Seq#       Checksum  Route

192.168.2.0     10.0.0.3        181  0x80000002 0x0024C4  192.168.2.0/24


In this database entry, we can see that the Type 3 LSA is generated by Router 3 (ADV Router 10.0.0.3) and is advertising the 192.168.2.0/24 network as a summary route. This LSA is flooded throughout Area 0 and is used by other routers in the area to reach the 192.168.2.0/24 network.


Type 4 - ASBR Summary LSA

The Type 4 LSA is generated by an ABR to describe the location of an Autonomous System Boundary Router (ASBR) that is advertising external routes into OSPF. Here is an example configuration for Router 3, which is also the ASBR in this scenario:


router ospf 1

 network 10.0.0.0 0.255.255.255 area 0

 network 192.168.2.0 0.0.0.255 area 2

 redistribute connected subnets

 redistribute static metric-type 1 subnets


In this configuration, we're specifying that Router 3 is redistributing both connected and static routes into OSPF, and we're also configuring the metric-type to be 1 for these routes. When Router 3 generates a Type 5 LSA to advertise the external routes, it will also generate a Type 4 LSA to describe its own location as an ASBR. Here is an example of a Type 4 LSA in the OSPF database for Area 0:


Link ID         ADV Router      Age  Seq#       Checksum

10.0.0.3        10.0.0.3        181  0x80000001 0x0074F6


In this database entry, we can see that the Type 4 LSA is generated by Router 3 (ADV Router 10.0.0.3) and is advertising its own router ID as the location of the ASBR. This LSA is flooded throughout Area 0 and is used by other routers in the area to determine the location of the ASBR.


Type 5 - External LSA

The Type 5 LSA is generated by an ASBR to advertise external routes into OSPF. Here is an example configuration for Router 3, which is the ASBR in this scenario:


router ospf 1

 network 10.0.0.0 0.255.255.255 area 0

 network 192.168.2.0 0.0.0.255 area 2

 redistribute connected subnets

 redistribute static metric-type 1 subnets


In this configuration, we're specifying that Router 3 is redistributing both connected and static routes into OSPF, and we're also configuring the metric-type to be 1 for these routes. When Router 3 generates a Type 5 LSA to advertise the external routes, it will also generate a Type 4 LSA to describe its own location as an ASBR. Here is an example of a Type 5 LSA in the OSPF database for Area 2:


Link ID         ADV Router      Age  Seq#       Checksum  Route

192.168.3.0      10.0.0.3        182  0x80000001 0x007728  E2 192.168.3.0/24


In this database entry, we can see that the Type 5 LSA is generated by Router 3 (ADV Router 10.0.0.3) and is advertising the external route for the 192.168.3.0/24 network. The E2 in the Route column indicates that the cost of this external route is being advertised without modification by OSPF. This LSA is flooded throughout Area 2 and is used by other routers in the area to reach the 192.168.3.0/24 network.


Overall, understanding the different OSPF LSA types and how they are generated and flooded through the network is crucial for building and maintaining an efficient and reliable OSPF topology. 


14 May 2023 | 11:38 pm
6 Likes
Aadharsh Gupta

Aadharsh Gupta

Student
Faithful User
Forums Top User
Posts: 6
Likes: 15
Member since: 14 May 2023
quote-right
Reply to Deepak Sharma

In OSPF, there are several LSA types that are used to exchange routing information between OSPF routers. The most common OSPF LSA types are:

Thanks for the explanation, what are the commands to check the OSPF database for LSA Type 1, Type 3 and Type 5

15 May 2023 | 08:26 am
4 Likes
Robert Travis

Robert Travis

Student
Faithful User
Forums Top User
Posts: 3
Likes: 12
Member since: 16 Mar 2023

Here are some of the examples of OSPF LSA Types. I have also included the OSPF database commands. Hope this will help you.

LSA Type 1:
let's say we have a router with three interfaces connected to different networks. When OSPF is enabled on these interfaces, the router generates a Type 1 LSA for each interface. These LSAs will contain information about the router's ID, the interface IP addresses, and the state of each interface.

Here's an example configuration for a Cisco router with three interfaces:

interface GigabitEthernet0/0
 ip address 192.168.1.1 255.255.255.0
 ip ospf 1 area 0

interface GigabitEthernet0/1
 ip address 192.168.2.1 255.255.255.0
 ip ospf 1 area 0

interface GigabitEthernet0/2
 ip address 192.168.3.1 255.255.255.0
 ip ospf 1 area 0


If we look at the Type 1 LSAs generated by this router, we'll see information about each interface:

Router#show ip ospf database router

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

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
192.168.1.1     192.168.1.1     405         0x80000001 0x007D0B 2
192.168.2.1     192.168.1.1     371         0x80000001 0x00818D 2
192.168.3.1     192.168.1.1     384         0x80000001 0x008020 2


OSPF LSA Type 3:
let's say we have two routers connected to each other through a link with subnet 192.168.1.0/24. Router 1 is connected to two networks, 192.168.1.0/24 and 192.168.2.0/24. Router 2 is connected to two networks, 192.168.1.0/24 and 192.168.3.0/24.

When OSPF is enabled on these interfaces, each router generates Type 1 LSAs for its interfaces, and a Type 3 LSA for the subnet that's being advertised. Router 1 will generate a Type 3 LSA for 192.168.3.0/24, and Router 2 will generate a Type 3 LSA for 192.168.2.0/24. These LSAs will be flooded to all other routers in the same area.

Here's an example configuration for Router 1:

interface GigabitEthernet0/0
 ip address 192.168.1.1 255.255.255.0
 ip ospf 1 area 0

interface GigabitEthernet0/1
 ip address 192.168.2.1 255.255.255.0
 ip ospf 1 area 0

router ospf 1
 network 192.168.1.0 0.0.0.255 area 0
 network 192.168.2.0 0.0.0.255 area 0

And here's an example configuration for Router 2:

interface GigabitEthernet0/0
 ip address 192.168.1.2 255.255.255.0
 ip ospf 1 area 0

interface GigabitEthernet0/1
 ip address 192.168.3.1 255.255.255.0
 ip ospf 1 area 0

router ospf 1
 network 192.168.1.0 0.0.0.255 area 0
 network 192.168.3.0 0.0.0.255 area 0


If we look at the Type 3 LSAs generated by each router, we'll see information about the subnets being advertised:

Router 1#show ip ospf database network

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

                Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
192.168.2.0     192.168.1.1     491         0x80000001 0x00B3B9

Router 2#show ip ospf database network

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

                Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
192.168.3.0     192.168.1.2     364         0x80000001 0x009CE1

OSPF LSA Type 5:
Type 5 LSAs are used to advertise external routes into OSPF. Let's say we have a router that's connected to a network that's not part of the OSPF domain. We can redistribute the external routes into OSPF and advertise them using Type 5 LSAs.

Here's an example configuration for a router with an external route:

interface GigabitEthernet0/0
 ip address 192.168.1.1 255.255.255.0

router bgp 100
 network 10.0.0.0 mask 255.255.255.0
 neighbor 192.168.1.2 remote-as 200

router ospf 1
 redistribute bgp 100 subnets


In this example, the router is connected to a network with the IP address range 10.0.0.0/24. We're redistributing these routes into OSPF using the redistribute bgp 100 subnets command. This will generate Type 5 LSAs that advertise the external routes to other routers in the OSPF domain.

If we look at the Type 5 LSAs generated by this router, we'll see information about the external routes:

Router#show ip ospf database external

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

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
10.0.0.0        192.168.1.1     765         0x80000001 0x00F4B4 0


Thank you!!!

Regards,

15 May 2023 | 02:33 pm
6 Likes
Aadharsh Gupta

Aadharsh Gupta

Student
Faithful User
Forums Top User
Posts: 6
Likes: 15
Member since: 14 May 2023

Thanks @Robert Travis for the good explanation!! 


15 May 2023 | 05:22 pm
2 Likes
Pramila Sharma

Pramila Sharma

Student
Faithful User
Forums Top User
Posts: 3
Likes: 4
Member since: 26 Apr 2023

Can someone please make me understand OSPF LSA Type 4 ? I watched few OSPF videos and other documents but not able to understand LSA Type 4. This forum topic seems appropriate. Thanks in advance.

15 May 2023 | 08:41 pm
3 Likes
Dcancerian

Dcancerian

Student
Faithful User
Posts: 4
Likes: 10
Member since: 28 Mar 2023

Hello,


I have recently gone through this blog where OSPF LSA Type 4 is briefly explained in an easiest possible way with a short example.

https://uninets.com/blog/understanding-ospf-lsa-type-4


OR

https://uninets.online/blog/understanding-ospf-lsa-type-4


I hope this will help.


Regards,

15 May 2023 | 09:08 pm
3 Likes
Hemant Pandaya

Hemant Pandaya

Student
Faithful User
Forums Top User
Posts: 6
Likes: 4
Member since: 15 Sep 2023

Nice explanation!! but I believe more in practicals rather than only theory. Anyways it is a good read.

16 Oct 2023 | 11:21 pm
0 Likes

Report

Please describe about the report short and clearly.