OSPF Neighbor Establishment and LSAs
In the previous blog, we introduced OSPF and laid a good foundation for understanding the protocol and how it works. In this blog, we'll continue by delving deeper into the details of how OSPF operates and serves the network.
Fundamental OSPF Terms
Before we begin, let's define some fundamental OSPF terms:
- Router ID: The unique identifier for routers in the OSPF domain. By default, it's the highest IP address of active physical interfaces, but a loopback interface's IP address is preferred if configured. It's best to use a logical interface's IP address for stability. The router ID can also be manually configured.
- OSPF Neighbor Table: Includes all routers discovered on directly connected networks, including those with which the router forms adjacencies and those it doesn't. It contains information like the neighbor's router ID, state, and interface.
- OSPF Database Table (LSDB): Contains information about all possible routes to the networks in the area. In a fully converged state, all routers in an OSPF area have the same LSDB.
- OSPF Routing Table: Contains the best discovered paths to each destination.
Now that we've defined some basic terms, let's explore the key mechanisms involved in OSPF routing.
Neighbor Formation and Adjacency
Before we delve into the details of neighbor formation, let's first understand the roles of Designated Routers (DRs) and Backup Designated Routers (BDRs) in OSPF."
What are the Designated and Backup Designated Routers?
OSPF was initially designed with all routers forming full adjacencies, creating a full mesh. This is burdensome due to excessive communication and network overhead. However, in broadcast networks, this is curbed by using Designated Routers (DR) and Backup Designated Routers (BDR).
Instead of a full mesh, routers communicate with the DR/BDR via multicast group 224.0.0.6 for efficient communication, DR/BDR elections, and link-state updates. The DR/BDR then uses multicast group 224.0.0.5 to flood LSAs and communicate with other OSPF routers.
Now that we know what DRs and BDRs are, let's see how they are elected in an OSPF network.
How does DR and BDR Elections work?
The router with the highest priority will become the DR. If there's a tie, the router with the highest router ID wins. The second-highest priority router becomes the BDR, with the second-highest router ID breaking any ties. The default priority is 1, and a priority of 0 prevents a router from participating.
Important Notes:
- DR and BDR election is not preemptive. A better router arriving later won't take over.
- If the DR fails, the BDR becomes DR, and a new BDR is elected.
- The best router only becomes DR if both the current DR and BDR fail.
How does OSPF perform Neighbor Establishment and Convergence?
The OSPF turn-up process describes how routers establish neighbor relationships, exchange routing information, and build a converged network topology. This process is crucial for OSPF to function correctly and ensure efficient traffic forwarding.
- Init State:
- This state specifies that a router has received a hello packet from its neighbor.
- The hello packet would only contain the router ID of the sender router and not the receiver router.
- This signifies that one-way communication has been established.
- Two-Way State:
- After the OSPF router receives a hello packet, it exchanges hello packets with the OSPF router that sent the first hello packet.
- This continues until both routers see their router ID within the received hello packet.
- This establishes that two-way communication has been formed.
- Network Type Considerations:
- Broadcast Networks: The DR and BDR election takes place. OSPF routers only form full adjacency with DR and BDR routers. Other routers remain at a 2-way state.
- Non-Broadcast Networks: All OSPF routers form full adjacency with all neighbors and continue in the turn-up process.
- Exstart State:
- Routers that will proceed to form full adjacency establish a master-slave relationship with their neighbors.
- They choose the initial sequential number that will be used for full adjacency formation.
- The router with the higher router ID becomes the master.
- This master-slave relationship is needed as only the master can increment the sequence number.
- Master-Slave Relationship:
- By default, the DR/BDR is usually the master.
- However, since DR/BDR can be assigned based on priority, the DR/BDR could have a lower router ID and serve as the slave.
- This master-slave relationship is local to each neighbor relationship.
- Exchange State:
- OSPF routers begin to exchange database descriptor (DBD) packets.
- The master router initiates the exchange of DBD packets.
- DBD Packet Contents:
- Contain the Link State Advertisement (LSA) headers.
- Describe the contents of the entire link-state database.
- Do not contain the full LSAs themselves, but the LSA headers, which are a summary of the LSAs.
- Acknowledgment:
- As DBD packets are exchanged, only the slave can increment the sequence number of the packets.
- This serves as a form of acknowledgment of receipt from the slave.
- Loading State:
- Based on the DBDs and LSA headers exchanged, the OSPF routers determine the LSAs needed.
- They send link-state request packets to their neighbors.
- Neighbors reply with link-state update packets.
- Every link-state update needs to be acknowledged.
- Full State:
- At the end of the loading state, routers should be fully adjacent with their neighbors.
- This means that all databases are fully synchronized.
- At this state, the routers are ready to exchange routing information and participate in the OSPF routing process.
Having explored the neighbor establishment process, let's examine the different states that OSPF routers can be in and how these states vary depending on the network type.
What are the OSPF States in Different Network Types?
- An OSPF process running smoothly in a broadcast network would have all routers in a full state with DR and BDR routers while it would be at a 2-way state with all other routers.
- For a non-broadcast network, it is expected that the routers remain in a full state with all routers in the OSPF domain.
With a solid understanding of neighbor formation, let's shift our focus to Link State Advertisements (LSAs) and how they play a crucial role in OSPF routing.
How do LSAs Interpret Network Routes in OSPF?
OSPF uses Link State Advertisements (LSAs) to distribute network topology information from the perspective of each router. Different LSA types have distinct roles in describing various parts of the network. This allows routers to build a complete and synchronized view of the topology, enabling them to calculate efficient routes.
Here's a breakdown of the LSA types and their functions:
Conclusion
In this post, we've explored some key OSPF concepts, including the roles of DRs and BDRs, the neighbor establishment process, and the different types of LSAs. By understanding these mechanisms, you gain valuable insights into how OSPF establishes and maintains a robust and efficient routing environment. But how do you actually configure OSPF on your network devices? In our next blog post, we'll walk you through the steps involved in configuring OSPF, from basic settings to more advanced options. Get ready to put your knowledge into pract