OSPF Neighbor States Explained [step by step]
In order to become fully adjacent, OSPF routers go through several state changes. In this article, we gonna pass through OSPF states one by one from Down State to Full State and we will examine what are the requirements for an OSPF to pass from one state to another. First of all, both router interfaces should be up and reachable via Layer 3 connectivity.
OSPF Neighborship states:
- Attempt (only NBMA)
In this state, no information (Hellos) has been received from this neighbor, but hello packets can still be sent to the neighbor.
In the Full OSPF neighbor state, if an adjacent router doesn’t receive a hello packet from a neighbor within the Router Dead Interval time (Router Dead Interval = 4*Hello Interval by default) or if the manually configured neighbor is being removed from the configuration, then the neighbor state changes from Full to Down.
The router has received a Hello packet from its neighbor, but the receiving router’s ID was not included in the Hello packet.
When a router receives a hello packet from a neighbor, it should list the sender’s router ID in its hello packet as an acknowledgment that it received a valid Hello packet.
2-Way state indicates that bi-directional communication has been established between the routers.
- Each router has seen the other’s hello packet.
- The router receiving the hello packet sees its own Router ID within the received hello packet’s neighbor field. At this state, a router decides whether to become adjacent with this neighbor.
On broadcast media and non-broadcast multiaccess networks, a router can reach Full state only with the designated router (DR) and the backup designated router (BDR). It will be in the 2-way state with all other neighbors (DROther).
On Point-to-point and Point-to-multipoint networks, a router becomes full with all connected routers.
At the end of this state, the DR and BDR are elected (In the case of Broadcast and Non-Broadcast multiaccess networks.)
The DR and BDR election is a prerequisite for This state.
In this state, the routers and their DR and BDR establish a master-slave relationship and choose the initial sequence number for adjacency formation:
- The router with the higher router ID becomes the master and starts the exchange.
Note: the DR/BDR election can be done according to the higher priority configured on the router instead of the highest router ID (but in the Extract state only consider higher Router ID for the master role).
- The master is the only router that can increment the sequence number.
In the exchange state, OSPF routers exchange database descriptor (DBD) packets.
Each DBD packet has a sequence number that can be incremented only by the master which is explicitly acknowledged by the slave. Routers also send link-state request packets and link-state update packets (which contain the entire LSA) in this state.
The contents of the DBD received are compared to the information contained in the router’s link-state database to check if new or more current link-state information is available with the neighbor.
Based on the information provided by the DBDs, routers send link-state request packets. The neighbor then provides the requested link-state information in link-state update packets.
After exchanging all LSA, LSU, and LSAck packets, the routers’ databases are fully synchronized.
In the OSPF Full state, the routers are fully adjacent with each other.