As a link-state routing protocol every OSPF router uses LSA (Link State Advertisement) to learn the exact same topology data. Exchanged LSAs are stored in LSDB (Link State Database) in which SPF (Shortest Path First) algorithm is executed to find the best route for every reachable subnet.
OSPF routers use various types of LSAs. Here we will start our discussion with first three types of LSAs.
Type 1 or Router LSA, Type 2 or Network LSA and Type 3 or Summary LSA.
So, very first start with Type 1 LSA or Router LSA.
Type 1 or Router LSA
The Type 1 LSA in one area will list interfaces and neighbors in that area only.
Each OSPF router originates a Type 1 LSA for itself and floods it throughout the area in which it is attached. To flood the Type 1 LSA every router sends it to its neighbors inside the same area and neighbors in turn to their neighbors inside the same area. The process continues until every router on that area has a copy of that LSA.
Type 1 LSA lists some information including RID or Router ID and the information about the attached links to it and neighbors information also.
Type 1 LSA identifies each OSPF router based on its Router ID.
Type 1 LSA also lists attached links which are defined as Stub Network, Transit Network and Point-to-Point Network.
The LSID (Link State Identifier) of Type 1 LSA is of 32-bits which is actually the OSPF RID of every router as in OSPF every router identifies every other router with its RID.
All internal routers create only one Type 1 LSA while an ABR (Area Border Router) can create multiple Type 1 LSAs one per area basis with a single RID and then floods those Type 1 LSAs to appropriate areas.
Verification of Type 1 LSA or Router LSA:
The output of the command show ip ospf database on R1 of Process 1 lists several columns in which two most important are Link ID and ADV Router or Advertised Router. In this particular scenario we have four different ADV Router ID, 126.96.36.199, 188.8.131.52, 184.108.40.206 and 220.127.116.11. That means here we have four routers in this area (Area 0). Eventually both the Link ID and ADV Router are same in case of Type 1 LSA because OSPF does routing that is based on Router ID or in other words we can say that in an OSPF topology every OSPF router identifies every other OSPF router by its Router ID.
From above output of command show ip ospf database router 18.104.22.168 we are seeing there are three different types of networks are listed followed by Link connected to: type. Here we need some explanation.
Transit Networks are those on which DR is elected. Type 1 LSA lists the DR’s IP address and also mentions that the link is attached to a transit network to ensure that a Type 2 LSA exists for that network.
Point-to-point Networks are those on which no DR is found but a neighbor is reachable. Type 1 LSA lists the neighbor’s RID for this type of area.
Stub Networks are those in which no DR is elected. Type 1 LSA lists the router’s interface subnet ID and mask with OSPF interface cost for this type of area.