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.
- Down state
- Init state
- Two-way state
- Exstart state
- Exchange state
- Loading state
- 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.

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.

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.

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.

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.

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.

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.

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.

This tutorial is part of the tutorial "OSPF Configuration and Concepts Explained.". Other parts of this tutorial are as follows:
Chapter 01 OSPF (Open Shortest Path First) Protocol
Chapter 02 RIP V/s OSPF | Differences between RIP and OSPF
Chapter 03 IGP, EGP, and Autonomous System Explained
Chapter 04 OSPF Features, Advantages, Disadvantages
Chapter 05 OSPF Fundamental Terminology Explained
Chapter 06 OSPF LSA Types and LSA Flooding Explained
Chapter 07 OSPF Area Types and Concept Explained
Chapter 08 OSPF Hello Protocol and Packets Explained
Chapter 09 OSPF RID (Router ID) Explained
Chapter 10 OSPF Neighborship Condition and Requirement
Chapter 11 OSPF DR BDR Selection Process Explained
Chapter 12 How OSPF Routers Build Adjacency Explained
Chapter 13 Shortest Path First (SPF) Algorithm Explained
Chapter 14 OSPF Single-Area Configuration Explained
Chapter 15 OSPF Stub area, Totally Stub area, NSSA, and Totally NSSA
Chapter 16 OSPF Virtual Links Explained
Chapter 17 OSPF Authentication Password and MD5 Explained
Chapter 18 OSPF Multi-Area Configuration Explained
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.
By ComputerNetworkingNotes Updated on 2026-05-06