OSPF Neighbor States

Today I am going to talk about OSPF neighbor states and what goes on under the hood when a new OSPF topology first comes online. Before a link reaches a full state and the network is fully converged with a complete identical topology map. For broadcast and non-broadcast multi-access topologies, link neighbors must go through 7 neighbor states before they can become fully adjacent neighbors. By fully adjacent I mean that the topology has selected the DR, BDR, DRother(if there are any), and the shortest path algorithm is being calculated with this topology. The neighbor states start from down, to init, to two-way, to exstart, to exchange, to loading, and then to a full state. Here is a table below of the neighbor states.

Down- The first neighbor state in OSPF is the down state. This is the state when OSPF is freshly configured, and hello packets have not been received at all. Hello packets are a type 1 message that are sent periodically to discover neighbors, so if neighbors on a link are in a down state that means that no hello packets have been received and are not aware of any directly connected neighbors. The down state is not exclusive to when links first come online, but also when one neighbor on a link stops receiving hello packets for a certain time interval (dead interval timer.) When a neighbor hasn’t received a hello packet within the dead timer interval, it assumes that the neighbor is no longer reachable or active which is why it goes back to the down state. 

Init- The second neighbor state in the OSPF adjacency process is the init state. When an OSPF router receives a hello packet, it becomes aware of a directly connected neighbor on the link it received that hello packet from. These hello packets provide important information such as RID which is the identifier for a router in OSPF. So if Router1 receives a hello packet from Router2 with an RID of 2.2.2.2, it will now be aware that it has a neighbor on that specific link with an RID of 2.2.2.2. The init state is the state that essentially proves that a one-way communication has been established. The init state is specifically the state where a router receives a hello packet from its neighbor, but the hello packet does not have the local router’s RID in the neighbor list so bidirectional communication has not been established yet. The neighbor list in hello packets is a list of router’s RID that the local router has received a hello packet from. So if Router2 receives a hello packet from Router1, Router2 will add Router1’s RID in that neighbor list. 

Two-Way- The third neighbor state is the two-way state and this state is confirmation that bidirectional communication has been established between two neighbors. When a router receives a hello packet from a neighbor but doesn’t see its own RID in the neighbor list that means that the communication is currently one-way. The absence of a router seeing its own RID in the neighbor list means that the sending router of that hello packet is sending but not receiving. Once the local router receives a packet and sees its own RID in the neighbor list, that is when the neighbor state will transition from the init state to the two-way state. The router seeing its own RID in the neighbor list proves that the neighbor that sent that hello packet can not only send to the local router but is also receiving hello packets in return hence the name two-way. Something big happens in the two-way state and it’s the DR (Designated Router) and the BDR (Backup Designated Router) election. This election occurs in broadcast networks, and decides the role of every router in the topology and which routers will form full adjacencies or which routers will remain in the two-way state. The DR is selected by choosing the router with the highest priority and the highest RID as a tiebreaker.  The BDR has the second highest priority, or second highest RID if it was a tie-breaker. Once the DR and BDR are chosen, any remaining routers on the segment will become a DROther which remain in a two-way state except on any link connecting to a DR or BDR. 

Exstart- Once the topology has determined which routers will be allowed to reach a fully adjacent state, they will then enter an exstart state. This is the state where the master and slave are determined. The master and slave dynamic sets the hierarchy for how DBD packets will be exchanged during the exchange state. The master of the neighbor will set the initial sequence number, and initiate a DBD exchange while the slave will acknowledge the DBD packets it received by sending their own DBD packets with the same sequence number that the master has selected. During the exstart phase, the neighboring routers exchange empty DBD packets with their RIDs. The neighbor with the highest RID will become the master while the other router becomes the slave.

Exchange- Once the master and slave are chosen in the exstart phase, the neighbors will finally enter the exchange state. This is the OSPF neighbor state where both routers will send DBD packets to each other. The master will initiate the DBD exchange and the slave will acknowledge those DBD packets by sending their own DBD packets with the same sequence number the master set. DBD packets are not the full LSAs but are LSA headers (summaries) that allow the receiving router to compare LSDBs and identify which LSAs are missing, newer, or outdated. The LSA headers provide just enough detail for every LSA to be uniquely identified. Some of the information in LSA headers is LSA type (1,2,3,4…), LS Age, LS length, Link State ID, LS checksum, sending router RID and LS sequence number. Both routers while comparing LSDBs for missing or outdated LSAs will build an LSR list of missing LSAs. 

Loading- Once the neighboring routers have fully transferred to each other all of the DBD packets and have finished their LSR list, they will now enter the loading state. This state is one of the most important OSPF neighbor states in my opinion as full LSAs are actually being transmitted here allowing the OSPF neighbors to have a complete identical topology map. When the OSPF neighbors reach the loading state, the routers take the LSR list and start building and sending LSR packets. These packets are capable of carrying multiple requests, and are only inquiring for LSAs that are actually needed to avoid exchanging the entire LSDB. Once a router receives the LSR packets, they then build LSU packets that carry the requested LSAs and are flooded in the OSPF area. Once the router that sends the LSU that carries the requested LSA or LSAs, that router will then send an LSAck which only has LSA headers to confirm that it has successfully received the LSU. Every router that will be forming a full adjacency will continue to go through the LSR, LSU and LSAck exchange until the LSR list is completely empty and the LSDB are synchronized. 

Full- Once the LSR list for every router that will form a full adjacency is empty, all of them will finally reach the full state. When a router is in the full state, that means that they have exchanged DBDs, compared LSDBs, and sent LSRs, LSUs and LSAcks. This means that every router in this state has a fully synchronized and identical LSDB. Every LSA in the LSDB matches what every other fully adjacent router has. And its from this state where the SPF or Dijkstra’s algorithm can be implemented to calculate the shortest paths to every reachable destination. 

Leave a Reply

Your email address will not be published. Required fields are marked *