OSPF Neighbor States discussion

OSPF Neighbor States discussion

OSPF (Open Shortest Path First) is a routing protocol that establishes routing paths within a network. In an OSPF network, regions are used to organize logically related routers. Ideally, all areas should be physically connected to the backbone (Area 0), which serves as a centralized point for routing information.

A router experiences multiple state changes during OSPF adjacency formation before fully adjacent to its neighbor. The OSPF RFC 2328 defines certain state.

⭐Related : Introduction to OSPF LSA Types
⭐Related : Introduction to OSPF Area Types

OSPF Neighbor States discussion
Fig 1.1- OSPF Neighbor States discussion

There are eight different states while OSPF adjacency formation before fully adjacent to its neighbor as below

  • OSPF Down State 
  • OSPF Attempt State 
  • OSPF INIT State 
  • OSPF 2-Way State 
  • OSPF Exstart State 
  • OSPF Exchange State 
  • OSPF Loading State 
  • OSPF Full State 
Lets talk about all these states in detail to understand more.

 1. OSPF Down State 

When your routers are in the down state, they are one of the starting states in the OSPF domain and don't know anything about one another. The moment has arrived to implement an OSPF network. Here the router sends hello packet but in exchange there is no information (hellos) have been received from neighboring router. So we may have three reason for this state

  • No Hello Packets: No Hello packets are being exchanged between the routers. This means router has no information about the other's OSPF configuration, like router ID or area ID.
  • Not Reachable: The Down state doesn't imply a non-existent neighbor, just one that's currently unreachable from an OSPF standpoint. There could be a physical link, but OSPF communication isn't established yet.
  • Starting state: The Down state is the starting point for the neighbor discovery process. Routers periodically send Hello packets on OSPF-enabled interfaces, hoping to initiate communication with potential neighbors.

 2. OSPF Attempt State 

Attempt state is used by OSPF in non-broadcast multi-access environments like Frame Relay and X.25, as opposed to Init state. Only when neighbors are statically configured with the neighbor command does OSPF make use of this state. It is not necessary for it to find them dynamically in this case. In this situation, it will use unicast rather than multicast as it already knows the neighbors.

  • NBMA networks: In broadcast networks, routers can "hear" Hello packets from all neighbors on the same segment. In NBMA environments, routers rely on unicast Hello packets specifically addressed to neighboring routers.
  • Manual Configuration: On NBMA links, you need to manually configure neighbors in the routing protocol configuration. The Attempt state reflects the router's effort to initiate communication with these pre-configured neighbors.
  • Not Applicable Everywhere: This state is not relevant in broadcast networks (like Ethernet) where routers discover neighbors automatically through Hello broadcasts.

What Happens in the Attempt State?

  • Initiating the Conversation: The router sends unicast Hello packets to the configured neighbor's IP address at regular intervals determined by the Hello Interval setting.
  • Waiting for a Response: The router waits for a Hello packet back from the neighbor within a specific timeframe (Dead Interval).
  • No Response, No Progress: If the router doesn't receive a Hello packet from the neighbor within the Dead Interval, it remains in the Attempt state.

 3. OSPF INIT State 

INIT state of the OSPF where router initiates the hello packet for the initial communication. The Hello packet is sent to multicast address of where the information of the router called RID (Area ID, Hello Interval, Hold Timer, Flag and MTU information)

  • Hello Received: A router receives a Hello packet from a potential neighbor. This packet contains information about the neighbor, like its router ID and area ID.
  • Verification, Not Recognition: The receiving router acknowledges that a neighbor exists on the network segment but doesn't yet have enough information to identify it uniquely.

Routers stuck in the INIT state for an extended period might indicate configuration errors, missing Hello packets due to connectivity problems, or firewall rules blocking OSPF communication.

 4. OSPF 2-Way State 

This state designates that bi-directional communication has been established between two routers. Bi-directional means that each router sees the hello packet from the other router. This state is attained when the router receiving the hello packet sees its own Router ID within the received hello packet neighbor field. 

At this state, a router decides whether to become adjacent with this neighbor. On broadcast media and non-broadcast multi-access networks, a router becomes full only with the designated router (DR) and the backup designated router (BDR). it stays in the 2-way state with all other neighbors. On Point-to-point and Point-to-multipoint networks, a router becomes full with all connected routers.

At the end of this stage, the DR and BDR for broadcast and non-broadcast multi-access networks are elected

  • Broadcast Networks (Ethernet): In environments like Ethernet, routers typically form full adjacencies with only a designated router (DR) and a backup designated router (BDR) per subnet to minimize redundant LSA flooding. Other routers in the 2-Way state receive routing information from the DR/BDR, promoting efficiency.
  • Point-to-Point and NBMA Networks (Frame Relay): On point-to-point links or NBMA networks, routers typically form full adjacencies with all directly connected neighbors in the 2-Way state. They exchange routing information directly with each other.

 5. OSPF Exstart State 

Once the DR and BDR are elected, the actual process of the exchange link state information can start between the routers and their DR and BDR.

In this state, the routers and their DR and BDR establish a primary-secondary relationship and choose the initial sequence number for adjacency formation. The router with the higher router ID becomes the primary and starts the exchange, and as such, is the only router that can increment the sequence number. 

You would logically conclude that the DR/BDR with the highest router ID is the primary for this process. The DR/BDR election could be because of a higher priority configured on the router instead of highest router ID. Thus, it is possible that a DR plays a secondary role. Also, that primary/secondary election is on a per-neighbor basis.

 6. OSPF Exchange State 

In the exchange state, OSPF routers exchange database descriptor (DBD) packets. Database descriptors contain link-state advertisement (LSA) headers only and describe the contents of the entire link-state database. Each DBD packet has a sequence number which can be incremented only by primary which is explicitly acknowledged by secondary. 

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 routers link-state database to check if new or more current link-state information is available with the neighbor.

 7. OSPF Loading State 

In this state, the actual exchange of link state information occurs. 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. 

During the adjacency, if a router receives an outdated or lost LSA, it sends a link-state request packet for that LSA. All link-state update packets are acknowledged.

 8. OSPF Full State 

In this state, routers are fully adjacent with each other. All the router and network LSAs are exchanged and the routers' databases are fully synchronized.

Full is the normal state for an OSPF router. If a router is stuck in another state, it is an indication that there are problems when the adjacencies are formed. The only exception to this is the 2-way state, which is normal in a broadcast network. 

Routers achieve the FULL state with their DR and BDR in NBMA/broadcast media and FULL state with every neighbor in the residual media such as point-to-point and point-to-multipoint.

⭐Related : Top OSPF Protocol Interview Questions and Answers
⭐Related : OSPF protocol : OSPF Packet Types

Continue Reading...

Free Tools...