Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 17

OSPF Neighbor Discovery and Adjacency Formation

Recommended resources

Welcome back! In our previous lesson, we outlined the high-level operation of OSPF, establishing that routers build a complete map of the network (the LSDB) by exchanging Link-State Advertisements (LSAs). However, before any of that can happen, the routers must first find each other and agree to communicate.

This lesson focuses on that critical first step: neighbor discovery and adjacency formation. We will explore how two OSPF-enabled routers go from being complete strangers to having a fully synchronized database. You will learn about the unique identifier each router needs, the specific messages they exchange, and the step-by-step process they follow to build a relationship. Mastering this process is fundamental to configuring and troubleshooting OSPF for your project.

By the end of this lesson, you will be able to explain the entire OSPF neighbor discovery and adjacency formation process, including the crucial roles of the Router ID and Hello packets.

1. The Foundation: Router ID and Hello Packets

Before two routers can even begin to talk, each one needs a unique name within the OSPF domain. This name is the Router ID (RID). It's a 32-bit number formatted like an IP address, and it must be unique for each router participating in OSPF.

A Cisco router determines its RID using the following priority:

  1. Manually configured: The ID set using the router-id <id> command in OSPF configuration mode. This is the recommended best practice as it provides deterministic control.
  2. Highest loopback IP address: If not manually configured, the router uses the highest IP address of any of its active loopback interfaces.
  3. Highest active physical IP address: If there are no loopback interfaces, the router falls back to using the highest IP address of any of its active physical interfaces.

Once OSPF is enabled on an interface and the router has an RID, it begins the discovery process using Hello packets. As we briefly mentioned in the last lesson, these packets are the foundation of neighbor relationships. They are used to:

  • Discover potential OSPF neighbors.
  • Establish and build neighbor adjacencies.
  • Maintain the relationship and ensure the neighbor is still alive.

The video below explains the Router ID selection process and lists the critical parameters within a Hello packet that must match between two routers for them to become neighbors.

OSPF Neighbor Discovery Process Explained

The "OSPF Neighbor Discovery Process Explained" video from the Network Direction channel provides a clear explanation of the Router ID and the matching parameters required for adjacency.

Please watch these two segments: Router ID: This part explains what a Router ID is, the three ways it's determined, and how to configure it. Hello Message Details: This section lists the key fields in a Hello packet that must be identical on both routers.

For two routers to form an adjacency, the following parameters in their exchanged Hello packets must match:

  • Area ID
  • Hello and Dead Timers
  • Subnet Mask
  • Authentication (if configured)
  • MTU (Maximum Transmission Unit)
This diagram details the fields within an OSPF Hello packet. The parameters listed above, such as Area ID, timers, and Network Mask, are all contained within this packet structure and are checked upon receipt to ensure compatibility between potential neighbors.

If any of these values differ, the routers will not become neighbors, which is a common source of troubleshooting issues in real-world networks. The Hello and Dead timers are particularly important. By default on Ethernet networks, Hellos are sent every 10 seconds. The Dead timer is typically four times the Hello interval, so 40 seconds. If a router doesn't receive a Hello from its neighbor within the Dead interval, it declares the neighbor "down" and tears down the adjacency.


2. The Seven States of OSPF Adjacency

The process of forming a full OSPF adjacency is not instantaneous. Routers progress through a series of seven distinct states. Think of it as a formal negotiation process where routers exchange credentials, summarize their knowledge, request missing information, and finally confirm synchronization.

This image illustrates the initial neighbor discovery phase. R1 sends a Hello, announcing itself. When R2 receives it, it moves into the 'Init' state. R2 then sends its own Hello, which includes R1 in its neighbor list. When R1 receives this, both routers have achieved two-way communication and enter the '2-Way' state.

The 2-Way state is a crucial milestone—the routers are now considered neighbors. However, to become fully adjacent (meaning they can synchronize databases), they must continue through the remaining states.

The following video provides an excellent, detailed walkthrough of all seven states, from Down to Full.

Free CCNA | OSPF Part 2 | Day 27 | CCNA 200-301 Complete Course

Jeremy's IT Lab offers a comprehensive look at the OSPF neighbor states in his "OSPF Part 2" video.

Please watch from OSPF Neighbors. This section will walk you through each of the seven neighbor states step-by-step, explaining what happens at each stage. As you watch, focus on the purpose of each state and the types of OSPF messages exchanged.

To summarize the process you just saw in the video, here are the seven states of OSPF neighbor adjacency:

  1. Down: The initial state. No Hello packets have been received from the neighbor.
  2. Init: A Hello packet has been received from a neighbor, but it does not contain our own Router ID. This means communication is one-way so far.
  3. 2-Way: Bi-directional communication is established. The router has seen its own RID in a Hello packet from the neighbor. At this point, the routers are officially neighbors. On multi-access networks (like Ethernet), an election for a Designated Router (DR) and Backup Designated Router (BDR) occurs here.
  4. ExStart: The routers decide which will be the Master and which will be the Slave for the database synchronization process. This is decided by the higher Router ID, which becomes the Master. This is done by exchanging empty Database Description (DBD) packets.
  5. Exchange: The routers, led by the Master, exchange DBD packets that contain summaries (headers) of the LSAs in their respective Link-State Databases. This allows them to see what information the other router has.
  6. Loading: Routers request the full details for any LSAs they are missing based on the DBD exchange. They send Link-State Request (LSR) packets for missing pieces. The other router responds with Link-State Update (LSU) packets containing the requested LSAs. Each LSU is confirmed with a Link-State Acknowledgment (LSAck).
  7. Full: The LSDBs are fully synchronized. The routers are now fully adjacent. They will continue to exchange Hellos to maintain the relationship.

3. Check Your Understanding

To ensure you've grasped the sequence and key details, try to answer these questions based on the video.

Question 1: Can you place the OSPF neighbor states in the correct order, from 1 to 7?

  • Exchange
  • Down
  • Loading
  • ExStart
  • Full
  • Init
  • 2-Way
Answer 1. **Down** 2. **Init** 3. **2-Way** 4. **ExStart** 5. **Exchange** 6. **Loading** 7. **Full**

Question 2: In which OSPF neighbor state are the Master and Slave roles decided for the LSA exchange?
A. 2-Way
B. Exchange
C. ExStart
D. Loading

Answer **C. ExStart.** The Master/Slave election happens in the ExStart state to determine which router will initiate the DBD packet exchange in the subsequent Exchange state.

Question 3: What are the default OSPF Hello and Dead timers on an Ethernet connection?
A. Hello 5s, Dead 20s
B. Hello 10s, Dead 40s
C. Hello 30s, Dead 120s
D. Hello 60s, Dead 180s

Answer **B. Hello 10 seconds, Dead 40 seconds.** These are the standard default timers for OSPF on broadcast multi-access networks like Ethernet.

Conclusion

In this lesson, we dissected the intricate process of OSPF neighbor discovery and adjacency formation. You now understand that this is a formal, multi-step negotiation, not an instant connection. We've seen how a unique Router ID is essential and how Hello packets serve as the primary vehicle for discovering, verifying, and maintaining neighbor relationships.

Key Takeaways:

  • Every OSPF router requires a unique Router ID (RID), determined either manually (best practice), by the highest loopback IP, or by the highest active physical IP.
  • Hello packets are sent to discover neighbors and maintain adjacencies. For two routers to become neighbors, their Area ID, timers, subnet, MTU, and authentication settings must match.
  • The adjacency process follows seven states: Down, Init, 2-Way, ExStart, Exchange, Loading, and Full.
  • Routers become neighbors at the 2-Way state but are only fully adjacent at the Full state, which signifies that their Link-State Databases are synchronized.
  • The exchange process involves DBDs (summaries), LSRs (requests), and LSUs (the actual updates containing LSAs).

In the next lesson, we will expand on a topic briefly mentioned today: the election of a Designated Router (DR) and Backup Designated Router (BDR). You'll learn why this election is necessary on multi-access networks like Ethernet and how it optimizes the LSA flooding process.