Establishing OSPF Neighbor Adjacencies
Before routers start sharing OSPF information about the networks they know about, they must first form neighbor adjacencies by exchanging hello packets on the multicast IP address of 224.0.0.5 on all OSPF-enabled interfaces. Once the neighbor adjacency is established, they exchange hello packets to maintain the neighbor relationship.
The image above shows the information in each hello packet exchanged between OSPF-enabled routers. The information marked with an asterisk must match on both routers to form an OSPF relationship.
Let’s go through each parameter in more detail:
Router ID
The router ID is a unique 32-bit number identifying a network router. Each router must have a different router ID to ensure uniqueness. By default, the router ID is set to the highest IPv4 address on a loopback interface if one exists.
However, if there is no loopback interface with an IPv4 address configured, the router ID will be set to the highest IPv4 address on any active interface. Manually configuring the router ID is also possible using the "router-id" command.
Note: It is highly recommended to manually set the router ID because it ensures that it remains stable and will not change even if an interface goes down, regardless of using a physical or loopback IPv4 address for the router ID.
Hello/Dead Interval
The Hello and Dead Interval in OSPF determines how often a router sends hello packets to its neighbors and the duration of waiting time before declaring a neighboring router unavailable.
Broadcast and point-to-point links have a default Hello Interval of 10 seconds, while the default Dead Interval is four times the Hello Interval (40 seconds). An adjacency can only be formed if these intervals are the same on the neighboring routers. Although these timers can be changed to speed up the convergence process, it is not recommended, especially not in unstable networks where it can create flapping.
“Flapping”: This is a term used in networking when an interface (network) constantly switches (goes) up and down because of hardware issues such as faulty cables, SFP, misconfiguration such as speed or duplex mismatch, and so on.
Neighbors
The Neighbors parameter includes a list of neighboring routers that have sent hello packets to the router. If the router identifies itself in the Neighbors field of a hello packet received from a neighbor, it means that they have established a two-way communication link.
Area ID
The Area ID represents the area to which the router belongs. For routers to establish communication, it is necessary for the interfaces connecting to be part of the same OSPF area on that segment.
Router Priority
Router priority is a value assigned to a router to determine its eligibility to become the designated router (DR) or the backup designated router (BDR) for a network segment. The router with the highest priority becomes the DR, and the router with the second-highest priority becomes the BDR.
The router priority ranges from 0 to 255 with a default value of 1. If two or more routers have the same priority value, the router with the highest OSPF router ID becomes the DR. The DR and BDR roles are important for efficient OSPF network operation, as they reduce the number of adjacencies that each router needs to maintain and decrease the amount of OSPF traffic on the network.
DR and BDR IP Address
These IPv4 addresses represent the IPv4 addresses of the elected DR and BDR routers on a network segment. When routers notify the DR about a topology change, they send the updates to DR multicast IPv4 address 224.0.0.6, where they exclusively communicate with the DR (or BDR). Then, the DR updates the rest of the routers on the segment (DROTHERs) via the 224.0.0.5 multicast IPv4 address.
“DROTHER”: A router that is neither DR nor BDR is called a Non-designated Router (DROTHER)
Note: Keep in mind that point-to-point links (serial links) do not involve DR/BDR election as only two routers can be connected on such a segment, making DR or BDR usage unnecessary.
Authentication Data
The Authentication Data is an optional parameter. In the case of enabled router authentication, both routers need to share identical authentication data, such as authentication type and key (password).
Stub Area Flag
The Stub Area Flag identifies the type of area in which that router belongs. Two routers must belong in an area of the same type to establish a neighborly connection. By default, each area is of type “normal.”