How OSPF Routers Build Adjacency Explained

Adjacency is a relationship that allows OSPF routers to share routing information. OSPF routers undergo a seven-state process to establish adjacency. This tutorial provides a detailed explanation of these states.

OSPF Adjacency States

Unlike other routing protocols, an OSPF router does not share routing information with all connected routers. It shares routing information only with adjacent neighbor routers. On an OSPF network, two routers first establish neighbor relationships with each other. Only neighbors become adjacent. The entire process goes through the following seven states.

  1. Down state
  2. Init state
  3. Two-way state
  4. Exstart state
  5. Exchange state
  6. Loading state
  7. Full state

Routers use the first three states to establish neighbor relationships and the last four to establish adjacent relationships.

Down state

In the down state, a router knows nothing about its neighbors. An OSPF process always starts in the down state. In this state, it selects the OSPF RID. An OSPF RID is a unique identity of the router on the OSPF network. Routers use it to identify each other. It is a 32-bit numeric ID. It has the same format as an IP address uses in decimal notation. A router checks the value of the following three options in sequence to select the RID.

  • The value of the router-id command
  • The IP address of an active loopback interface
  • The IP address of an active interface

If it finds the value of an option, it does not check the value of the next option. After selecting the RID, the router sends Hello packets from all active interfaces and waits for a response from other OSPF routers. It uses the Hello protocol to send Hello packets. A Hello packet includes all the parameters that other OSPF routers need to determine whether they will form a neighborship with the sender router. It uses OSPF multicast address 224.0.0.5 to send Hello packets. It sends Hello Packets at a regular interval. The interval is called the Hello interval. It also listens to OSPF multicast address 224.0.0.5 to receive Hello packets from other OSPF routers.

Down state of the OSPF Adjacency building process

Init state

A router enters this state when it receives a Hello packet from a router not listed in its neighbor list. The router matches the received Hello packet's parameters with the locally configured parameters. If the required parameters for the neighborship match, it adds the sender router to the neighbor list. After adding the sender router to the neighbor list, it replies with its Hello Packet. The Hello Packet contains the sender's RID in the neighbor list field.

Init state of the OSPF Adjacency building process

Two-way state

A router enters this state when it receives a reply from a router not available in its neighbor list. This message informs the router that another router, which has added this router to its neighbor list, exists on the network. If this router is willing to build the neighborship, it can reply with another Hello packet. If the router replies, both routers enter the two-way state. If two routers reach this state, it means that both routers have met all OSPF configuration requirements to become neighbors. At this point, they are neighbors and ready to exchange their routing information.

Two-way state of the OSPF Adjacency building process

Exstart state

How routers will share routing information depends on the network type. In a broadcast multi-access network, they share routing information through the DR and BDR. In a point-to-point network, they directly share routing information. In a broadcast multi-access network, an election process occurs at this point to select the designated router (DR) and the backup designated router (BDR) for the segment. Routers select a DR and a BDR for every segment. Apart from the DR and BDR, all other routers in the segment are known as DROTHERs. The only exception to a segment not having a DR and BDR is on a WAN point-to-point link.

DR and BDR election process

In each segment, routers form adjacencies only with the DR and BDR. An OSPF router talks to a DR using the IP multicast address 224.0.0.6. The DR and the BDR talk to all OSPF routers using the 224.0.0.5 multicast IP address. In each adjacency, every router compares its RID with the RID of the DR. If it has a higher RID, it becomes the master. If it has a lower RID, it becomes the slave. Master starts the exchange process. The remaining router in the adjacency will be the slave.

The exchange process

Note that the DR is not necessarily the master of the exchange process. The router with the higher RID will be the master of the exchange process.

Exchange state

After finalizing their roles in the exchange process, they share a list of LSAs in their databases. An LSA is a small portion of a database. It contains information only about a specific link. Each LSA has a unique ID. Routers use it to check which LSAs they already have and then request only the LSAs they do not have from the other router.

Exchange state of the OSPF Adjacency building process

Let us take an example. The master sends a list of LSAs from its database to the slave. The list contains information about ten LSAs. The slave checks its database and finds four of those LSAs. Therefore, it will only request six LSAs using a Link-State Request packet. Similarly, the master compares the list it receives from the slave and requests the LSAs it does not have in its database.

Loading state

In the loading state, the master and slave provide the requested LSAs and incorporate the received LSAs into their respective databases. Then, they send an acknowledgment LSA to update each other.

OSPF neighbor loading state

Full state

Master and slave will repeat the exchange and loading states until they have an identical database. Once the master and the slave are synchronized, you can consider them to be in a full state.

Full state of the OSPF Adjacency building process

Conclusion

OSPF routers share routing information only with adjacent routers. To become adjacent, two routers undergo a seven-step process: Down State, Init State, Two-Way State, Exstart State, Exchange State, Loading State, and Full State. This tutorial explained these steps in detail through examples. Learning these steps helps you understand how OSPF routers share routing information.

ComputerNetworkingNotes CCNA Study Guide How OSPF Routers Build Adjacency Explained

We do not accept any kind of Guest Post. Except Guest post submission, for any other query (such as adverting opportunity, product advertisement, feedback, suggestion, error reporting and technical issue) or simply just say to hello mail us ComputerNetworkingNotes@gmail.com