USD ($)
$
United States Dollar
India Rupee

OSPF States in Networking (Cisco)

Created by Deepak Sharma in Articles 4 Oct 2024
Share
«What is OSPF and How it Works?

Open Shortest Path First (OSPF) is a widely used link-state routing protocol that enables routers to determine the best path for data packets within an IP network. OSPF operates as an Interior Gateway Protocol (IGP) and utilizes the Shortest Path First (SPF) algorithm, also known as Dijkstra's algorithm, to calculate optimal routes.

There are two types of OSPF states:

1. OSPF Interface States: These states determine how an interface interacts with the OSPF process and include parameters such as the Hello interval, Dead interval, and network type.

2. OSPF Neighbor States: It describes the various stages a router goes through to establish and maintain relationships with neighboring routers. These states are crucial for forming adjacencies and exchanging routing information. Neighbor states include transitions such as Down, Init, 2-Way, Exstart, Exchange, Loading, and Full.

This article covers the two types of OSPF states in networking.  After reading this article, you will have a complete understanding of the OSPF interface states and OSPF Neighbor states in order.

OSPF Interface State

In OSPF, interfaces represent the connections between routers, configured with parameters like the Hello interval and Dead interval, which are vital for maintaining neighbor relationships.

OSPF uses Hello packets to discover and maintain these relationships, allowing routers to share routing information effectively. Notably, OSPF routers establish their link states even before sending Hello packets or forming adjacencies.

After initial communication, OSPF routers exchange Link State Advertisements (LSAs) to build a Link State Database (LSDB). This database is used to calculate the best paths through the network using the Shortest Path First (SPF) algorithm.

If you seek to achieve the certification and live CCNP training online then feel free to contact our learning advisors. 



banner image

Components of the OSPF Interface Data Structure

The command "show ip ospf interface" depicts various components of the Interface data structure 

The components of the interface data structure are:

1. IP Address and Mask: Configured on the interface, this address serves as the source for OSPF packets originating from it.

2. Area ID: Identifies the OSPF area assigned to the interface or process. OSPF packets from this interface will carry this Area ID.

3. Process ID: Unique to each router, this ID indicates the OSPF process to which the interface belongs. Cisco routers can support multiple OSPF processes.

4. Router ID: This unique identifier for the router is typically the highest IP address of any loopback interface or the highest IP address of an active interface.

5. Network Type: The various OSPF network types configured on an interface include:

● Broadcast

● Point-to-Point

● Non-Broadcast Multi-Access (NBMA)

● Point-to-Multipoint

● Virtual Link

6. Cost: This metric, ranging from 1 to 65535, represents the overhead for using this interface in OSPF routing decisions. The default cost is 1 but can be modified using the "ip ospf cost" command.

7. Link State Database (LSDB): This database contains all the Link State Advertisements (LSAs) received from neighboring routers. Each router maintains its own LSDB, which is synchronized with its neighbors.

8. Routing Table: Derived from the LSDB, this table contains the best paths to reach various destinations within the network.

9. Neighbor Table: This table keeps track of adjacent routers and their states, helping OSPF manage communication efficiently.

OSPF Interface States Explained

Interface states represent the operational status of OSPF-enabled interfaces on a router. These states are crucial for determining how interfaces interact with the OSPF protocol and facilitate the establishment of neighbor relationships

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

banner image

1. Down

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

2. Point-to-Point

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

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

3. Waiting

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

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

4. Backup

When an OSPF router is a BDR on a network and establishes adjacencies with other routers on a multi-access network

5. Loopback

In this state, the 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 Neighbor State

OSPF (Open Shortest Path First) neighbor states represent the stages a router goes through to establish and maintain relationships with other OSPF routers. Initially, routers send Hello packets to discover neighbors. When they recognize each other's router IDs in these packets, they confirm bidirectional communication.

Following this, they synchronize their Link State Databases (LSDBs) through various exchanges to ensure consistent routing information. Achieving full adjacency allows OSPF routers to share and update routing information effectively.

OSPF Neighbor Discovery and Adjacency Phases

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 the 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 the master who controls the exchange of data description packets and the other becomes a 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.

Components of the OSPF Neighbor Data Structure

The command "show ip ospf neighbor" gives more insight into understanding the OSPF neighbor data structure.

The components of the 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 the 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 the 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 the neighbor.

9. Inactivity Timer: It is RouterDeadInterval. This timer is reset whenever the router receives a 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 exchanged in the ExStart state.

13. Database Description (DD) Sequence Number: The Sequence Number of the 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 an 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.

OSPF Neighbor States

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

 banner image

1. Down State

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

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

● Link State retransmission List

● Database Summary List

● Link State Request List

2. Attempt State

The attempt state is only valid to neighbors on NBMA networks where neighbors are manually configured. A router sends Hello packets in the 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. Init State

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

4. 2-Way State

In this state, the router sees his 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. ExStart State

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

6. 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 request the most updated LSA to neighbors.

7. 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. Full State

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

Steps in OSPF Neighbor State Transition

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

banner image

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.

banner image

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.

banner image

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

banner image

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

banner image

Step 5: R1 Upon receiving the packet from R2, it accepts R2 as the master and transitions R2's state to Exchange. 

R1 sends the packet to R2 containing the following

1. It generates 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

banner image

Step 6: When R2 receives a 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.

banner image

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 the last of its LSA summaries and sets M = 0,

banner image

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.

banner image

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.

banner image

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.

OSPF States - Summing Up

OSPF (Open Shortest Path First) operates through a series of states to establish and maintain neighbor relationships among routers. These states include Down, Attempt, Init, 2-Way, ExStart, Exchange, Loading, and Full. The process begins with routers in the Down state, where no Hello packets have been exchanged.

As they progress, they establish bidirectional communication and exchange routing information until they reach the Full state, indicating complete adjacency and synchronized databases. Understanding these states is crucial for effective OSPF troubleshooting and optimization in network environments.

OSPF MD5 Authentication: Securing OSPF»
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

Related Articles

#Explore latest news and articles

OSPF ABR vs ASBR: Differences Insight 24 Sep 2024

OSPF ABR vs ASBR: Differences Insight

Explore the distinctions between ABR and ASBR in OSPF. Delve into OSPF ABR configuration details to understand their roles and functionalities.
OSPF MD5 Authentication: Securing OSPF 23 Sep 2024

OSPF MD5 Authentication: Securing OSPF

Dive into OSPF MD5 authentication and troubleshooting steps. Discover the importance and setup of OSPF authentication in networks.
OSPF LSA Types: Cisco Explained 29 Jul 2024

OSPF LSA Types: Cisco Explained

Learn about OSPF LSA types, explained in detail with Cisco-specific insights. Understand output of OSPF database commands for various LSA types. Read More!

FAQ

There are two types OSPF interface states and OSPF neighbor states.
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.
In this state, OSPF speaking routers sees its own router ID in the received Hello packed.
In the Exchange state, OSPF routers exchange Database Description (DBD) packets to synchronize their link-state databases.
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).

Comments (0)

Share

Share this post with others

Contact learning advisor

Captcha image
Dussehra Special Sale! 🎉Get up to 60% OFF on our expert-led video courses with Lab!
Dussehra Special Sale! 🎉Get up to 60% OFF on our expert-led video courses with Lab!
Limited-time offer – Grab your opportunity to boost your skills now.
Day
Hr
Min
Sec
Grab Discount