USD ($)
$
United States Dollar
India Rupee

OSPF States Types: Neighbor & Interface

Created by Deepak Sharma in Articles 19 May 2024
Share

Understanding OSPF States 

In OSPF protocol, there are two different type of OSPF states exist. These are the in-depth and advance topics, so before go through the following blog, I recommend to have up to CCNA level knowledge and should know about what is OSPF and how it works


Type #1 OSPF Interface States
Type #2 OSPF Neighbor States


In order to understand OSPF interface states, first we need to understand OSPF interfaces and its data structure 


OSPF Interfaces and Data Structure

OSPF is a link state protocol in which OSPF router first understands its own links and the state of the links. OSPF speaking router does that even before sending hellos, before sending LSAs or before forming adjacencies.

Link = Interface

OSPF router maintains a data structure for each OSPF enabled interface. The command "show ip ospf interface" depicts various components of this data structure 

The components of interface data structure are

1. IP Address and Mask

Configured on interface and OSPF packets originated from this interface will have this source address


2. Area ID

Configure either on OSPF interface or process and OSPF packets originated from this interface will have this Area ID


3. Process ID

It is local to the router and has no value outside the router. Cisco supports multiple OSPF processes


4. Router ID

Highest loopback or highest interface IP, it has unique value in the network


5. Network Type

These are the OSPF interface network types

● Broadcast

● Point to Point

● NBMA

● Point to Multipoint

● Virtual Link


6. Cost

It is the OSPF metric from 1 to 65535. You can change cost using "ip ospf cost" interface level command. Default ospf interface cost is 1.


Type #1 OSPF Interface States

In this type of state, An interface enabled with OSPF, transitions into 5 interface OSPF states before stating functioning. These states are as follows


1# Down

It's an initial interface state in which no protocol traffic is passing through and interface is not functional


2# Point-to-Point

This state comes into picture only when interfaces are connect to OSPF network type point-to-point, point-to-multipoint and virtual link. 

In this state an interface is functional and starts sending Hello packets in every HellowInterval to form adjacency with the neighbor


3# Waiting

It is applicable only to broadcast and NBMA OSPF network type. When OSPF interface is in this state, it starts sending and receiving Hello packets and set the wait timer.

In this state, router also attempt to identify DR and BDR.


4# Backup

When OSPF router is a BDR on a network and establish adjacencies with other routers on multi access network


5# Loopback

In this state, interface is loopback. The OSPF interface address still advertises in router LSA


Now similarly to understand OSPF neighbor states, we need to know OSPF neighbor and its data structure


OSPF Neighbors and Its Data Structure

The OSPF routers which form 2 way relation with other OSPF speaking routers are neighbors. Here we discuss an OSPF router relationship with the neighbors on the network. The purpose of the neighbor relationship is to form adjacencies for exchanging routing information

OSPF router adjacency forms in the following four phases


Phase 1# Neighbor Discovery

When Hello packets are received from the neighbor routers


Phase 2# Bidirectional communication

When both neighbor routers have each other's router ID in their Hello packets


Phase 3# Database Synchronization

When both neighbor routers have same information in their link state database after exchanging the following with each other

- Database Description

- Link State Request

- Link State Update Packets

In this case, one router becomes master who controls the exchange of data description packets and other becomes slave


Phase 4# Full Adjacency

An OSPF router, sends Hello packets containing the information stored in the interface data structure to its neighbor to inform about itself. Similarly neighbor routers maintain a neighbor data structure learned from other routers' Hello packets. This is 2 way communication with each other.

The command "show ip ospf neighbor" gives more insight for understanding OSPF neighbor data structure

The components of OSPF neighbor data structure are as follows


1. Neighbor ID

This is the router ID of the neighbor.


2. Neighbor IP Address

This is the IP address of the neighbor's interface attached to the network


3. Area ID

This ID has to be same for two OSPF routers to become neighbors. The area ID is present in the Hello packets received on an interface.


4. Interface

The interface attached to the network on which neighbor is located.


5. Neighbor Priority

This is the router priority of the neighbor which is advertised in Hello packets. The DR/BDR election uses the router priority.


6. State

This is the state of the neighbor


7. PollInterval

This value is used only in NBMA networks


8. Neighbor Options

This is an optional value for OSPF capabilities supported by neighbor.


9. Inactivity Timer

It is RouterDeadInterval. This timer is reset whenever router receives Hello packet from the neighbor.


10. Designated Router (DR)

The Address is present in the DR field of the neighbor's Hello packets.


11. Backup Designated Router (BDR)

The Address is present in the BDR field of the neighbor's Hello packets.


12. Master and Slave

It defines which router will control the database synchronization. This relationship is exchanges in ExStart state.


13. Database Description (DD) Sequence Number

The Sequence Number of DD packet currently sent to the neighbor.


14. Last Received DD Packet

This information is used to determine whether the next DD packet is a duplicate.


15. Link State Retransmission List

This component is a list of flooded LSAs on the adjacency, but not yet acknowledged.


16. Database Summary List

These are LSAs sent to the neighbor in Database Description packets during database synchronization. These LSAs make up the link state database when the router goes into exchange state.


17. Link State Request List

Link State Request packets are sent to the neighbor for copies of these LSAs; as the requested LSAs are received in Link State Update packets, the Request List is depleted.




Type #2 OSPF Neighbor States

An OSPF neighbor router goes through 8 OSPF neighbor states before the neighbor becomes fully adjacent

 

1# OSPF Down State

These are the initial OSPF states of a neighbor. No Hellos received from the neighbor in the last RouterDeadInterval, Hellos are sent every PollInterval.

If a neighbor transitions to Down state from some higher state then following are cleared

- Link State retransmission List

- Database Summary List

- Link tate request List


2# OSPF Attempt State

The attempt state is only valid to neighbors on NBMA networks where neighbors are manually configured. A router sends Hello packets in Attempt state. A

DR-eligible router transitions a neighbor to the Attempt state when the interface to the neighbor first becomes Active or when the router is the DR or BDR.


3# OSPF Init State

An OSPF router include its own and neighbor's router ID in Hello packets. In Init state, a Hello packet is received from neighbor but can not see its own router ID in the packet. 2 way communication is not completed yet.


4# OSPF 2-Way State

In this state router sees his own router ID in the Hello packets received from the neighbor. On multi-access networks, neighbors must be in this state to be eligible to be elected as the DR or BDR


5# OSPF ExStart State

In Cisco OSPF ExStart state, the router and its neighbor forms master and slave relationship with each other to determine the initial DD sequence number for exchanging of Database Description packets. The neighbor with the highest interface address becomes master.


6# OSPF Exchange State

The router sends database description (DBD) packets summarizing its link state database to neighbors. It may also send Link State Request (LSR) packets and requesting most updated LSA to neighbors.


7# OSPF Loading State

The router sends Link State Request packets to neighbors in the Loading state, requesting more recent LSAs that have been discovered in the Exchange state but have not yet been received.


8# OSPF Full State

Neighbors in this state are fully adjacent, and the adjacencies will appear in Router LSAs and Network LSAs.


Now let's look at the OSPF neighbor states in the process of database synchronization


Step #1 OSPF is enabled on R1 and becomes active on the multi-access network. It starts sending Hello packets. The Neighbor field of the packet is empty because not yet received Hello packet from any neighbor. The DR and BDR fields are set to 0.0.0.0.


Step #2 When R2 receives Hello from R1, it creates a neighbor data structure for R1 and set R1's state to Init. Now R2 sends a Hello packet to R1 with R1's router ID in the neighbor field and its own interface IP address in the DR field.


Step #3 When R1 receives a Hello from R2, it sees its own router ID in the packet. R1 creates a neighbor data structure for R2 and sets R2's state to ExStart for the master/slave negotiation. 

R1 sends the packet to R2 contains the following

1. It generates an empty Database Description (DD) packet with a random sequence number x

2. It sets I-bit to indicate that this is R1's initial DD packet for this exchange 3. It sets M-bit to indicate that this is not the last DD packet

4. It also sets MS-bit to indicate that R1 is claiming itself as the master


Step #4 When R2 received the DD packet, it transitions R1's state to ExStart. 

Now R2 sends the packet to R1 contains the following

1. DD packet with a DD sequence number of y

2. R2 sets MS-bit because it has the higher router ID than R1 

3. Empty DD packet because this one is used for the master/slave negotiation


Step #5 R1 upon receiving the packet from R2, it accept R2 as the master and transitions R2's state to Exchange. 

R1 sends packet to R2 contains the following

1. It generate a DD packet with R2's DD sequence number of y

2. It sets MS = 0, indicating that R1 is the slave

3. R1's LSA headers from its Link State Summary list to populate


Step #6 When R2 receives DD packet from R1, it changes its neighbor state to Exchange. Now It sends a DD packet to R1, containing LSA headers from its Link State Summary list. It also increments the DD sequence number to y+1.


Step #7 When R1 receives the packet, it sends an acknowledging packet containing the same sequence number as in the DD packet it just received from R2. 

The process of R2 sending a single DD packet and wait for an acknowledgement with same sequence number before sending the next packet continues. It keeps happening until when R2 sends the DD packet with last of its LSA summaries and set M = 0,


Step #8 When R1 receives this packet for sending the last of

its own LSA summaries. R1 comes to know that the Exchange process is done. However if it has entries in its Link State Request list then it transitions its state to Loading.


Step #9 When R2 receives R1's last DD packet, it transitions R1's state to full because it has no entries in its Link State Request list.


Step #10 R1 sends Link State Request packets, and R2 sends the requested LSAs in Link State Update packets until R1's Link State Request list is empty. RT1 will then transition R2's state to Full.



Frequently Asked Questions


Question 1: What are the types of OSPF states (cisco)?

Answer 1: There are two types OSPF interface states and OSPF neighbor states.


Question 2: What are OSPF neighbor states?

Answer 2: The neighbor states are the different phases of the neighbor relationship between OSPF routers. The states include Down, Init, Two-way, ExStart, Exchange, Loading, and Full.

 

Question 3: How does OSPF determine the Two-way state?

Answer 3: In this state, OSPF speaking routers sees its own router ID in the received Hello packed.

 

Question 4: What happens in the OSPF neighbor state Exchange?

Answer 4: In the Exchange state, OSPF routers exchange Database Description (DBD) packets to synchronize their link-state databases.


Question 5: When Cisco OSPF router stuck in ExStart state?

Answer 5: If there is no issue at physical layer then there are some common reasons for an OSPF router to stuck in ExStart state are mismatched OSPF network type, MTU mismatch, Auth mismatch, Hello or Dead interval mismatch, neighbor IP address mismatch, or OSPF process errors.


Question 6: When does an OSPF router enter the Full state?

Answer 6: OSPF routers enter the Full state when they have exchanged all link-state information and have synchronized their link-state databases.


Question 7: What are OSPF interface states?

Answer 7: These ospf states cisco represent the different states of an OSPF-enabled interface. These states include Down, Loopback, Waiting, Point-to-Point, and DR (Designated Router) or BDR (Backup Designated Router).


Question 8: What is the purpose of the OSPF interface state Down?

Answer 8: The Down state indicates that the OSPF interface is administratively down or that there is a physical issue preventing OSPF from running on the interface.


Question 9: When does an OSPF interface enter the Waiting state?

Answer 9: The Waiting state occurs when the OSPF router is waiting for a designated router (DR) and backup designated router (BDR) to be elected on a multi-access network.


Question 10: How do OSPF neighbor states and OSPF interface states relate to each other?

Answer 10: Neighbor states describe the relationship between OSPF routers, while interface states describe the state of OSPF-enabled interfaces. The interface state affects the neighbor relationship, as different interface types and states can influence the neighbor states and the overall OSPF network topology.


Question 11: What are the types of OSPF packets?

Answer 11: OSPF uses 5 types of packets to establish and maintain neighbor relationships, these are Hello packets, Database Description (DBD) packet, Link State Request (LSR) packet, Link State Update (LSU) packet, and Link State Acknowledgement (LSAck) packet.



Don't Miss to Checkout our Next Articles

Securing OSPF with MD5 Authentication

Insight into the Differences Between OSPF ABR and ASBR


Other Popular & Useful Articles

Private VLANs: Overview for Cisco Switches

Configuring Cisco Stack Switches

Deepak Sharma

He is a senior solution network architect and currently working with one of the largest financial company. He has an impressive academic and training background. He has completed his B.Tech and MBA, which makes him both technically and managerial proficient. He has also completed more than 450 online and offline training courses, both in India and ...

More... | Author`s Bog | Book a Meeting

Comments (0)

Deepak Sharma

Deepak Sharma

Senior Instructor (Part Time) at UniNets Instructor role
★★★★★ 4.95
Faithful User
Expert Vendor
Golden Classes
King Seller
Fantastic Support
Loyal Writer

Upcoming batches

+91 84484 40748

Enquire Now

Share to your friends

Share

Share this post with others

Contact learning advisor

New Cisco ACI Training Live Batch Starts June 15th!
New Cisco ACI Training Live Batch Starts June 15th!
Advance your career? Don't miss out on our Cisco Application Centric Infrastructure (ACI) training ...
Enroll Now