OSPF adjacencies are formed when OSPF neighbors exchange routing information.
Building the Adjacency
Before OSPF routers distribute the routing information among their neighbors, they will go through the following operational states.
OSPF Down State
This state means that no information has been received from the neighbor yet.
OSPF Attempt State
The Attempt state is valid only for neighbors on NBMA networks. At this point, the router started to send hello packets upon every Hello interval to contact the configured neighbor.
OSPF Init State
The Init state is a one-way Hello. Meaning that a Hello packet has been received but the router does not see its own Router ID in the received hello packet yet.
OSPF 2-Way State
The OSPF router reaches the 2-way state when it has seen its own Router ID in the neighbor’s field hello packet. At this point, bi-directional communication is established. At this point, the DR and the BDR are elected.
OSPF Exstart State
The Exstart State is used for initialization of the database synchronization process. The neighbors establish master/slave relationship and determine the initial DBD sequence number, router with highest RID is the master. The process is as follows:
- Both OSPF neighbors claim to me the master forwarding DBD with the following parameters::
- DBD with MS (Master/Slave) bit set to 1
- Self-generated DBD sequence number.
- Router with lower Router ID will be slave and replay with DBD with the following parameters:
- MS bit = 0
- DD sequence number set to elected Master’s sequence number.
- It’s I (first DBD) bit packet with LSA summaries.
- Exstart process is complete.
During this state, the neighbors will check their MTU size. If MTU does not match DBD exchange might not happen and the process will be stuck in “EXSTART/EXCHANGE” state.
OSPF Exchange State
In Exchange State, the router sends DBD packets describing its entire link-state database. Each DBD packet is explicitly acknowledged and only one outstanding DBD packet is allowed at a time. The process is as follows:
- DBD Exchange process starts.
- If router (Master) receives LSA that is not present in its own database or the neighbor has a more updated copy of known link-state advertisement. The router (Master) place the LSA on the Link State Request List.
- The router (Master) sends an LSR (link state request) packet asking for a complete copy of the LSA from the list.
- The router (Slave) sends LSU (link-state update) packet and adds the LSA on a Link State Retransmission list.
- The Router (Master) sends back an LSAck (link-state acknowledgment) to the router (slave) informing that the LSA that received.
- The router (slave) removes acknowledged LSA from the Link State Retransmission list.
In this state, the M bit of the DBD packets set to 1. The M bit indicates more DBD packets to come.
OSPF Loading State
In the Loading State, the router (master) sends LSR packets, requesting the most recent LSAs that have been discovered in the Exchange state but have not been received.
If Master or Slave routers don’t have more entries in the Link State Request List, then the Master router set the M bit to zero and forward an LSU packet to the slave router. The slave router responds with an LSAck with the same sync number and M bit Zero.
OSPF Full State
This state indicates full adjacency. The complete LSDB has been exchanged between the neighbors and are synchronized.