Sub topic 12
Hello packets and adjacencies
Before a link-state router can flood anything, it needs to know who its neighbors are. Hello packets do this job. This chapter assumes you know the link-state idea from the previous chapters: every router floods its local links and then runs Dijkstra on a shared database. Here you will see how routers find each other, agree to cooperate, and notice when a neighbor disappears.
Why discovery comes first
A link-state advertisement describes a router's links to its neighbors. A router cannot write one without first knowing which neighbors are alive and reachable in both directions. Discovery also keeps the protocol cheap. Distance-vector protocols resend whole tables on a timer. Link-state protocols send small hellos often and flood the large topology data only when something changes.
Hello packets have three jobs:
- Discover neighbors on a link.
- Check that both sides agree on the parameters needed to work together.
- Detect failure when the hellos stop arriving.
What a hello carries
This chapter uses OSPFv2 as the working example. IS-IS follows the same pattern with different packet formats. An OSPF hello is sent to the multicast address 224.0.0.5 (all OSPF routers) and contains:
- The sender's router ID.
- The area ID.
- The hello interval and the dead interval.
- The network mask (on broadcast and point-to-point networks).
- The router priority, used for designated router election.
- The current designated router (DR) and backup designated router (BDR).
- The list of router IDs the sender has heard from recently.
The last item makes discovery two-way. A router only considers a neighbor usable once it sees its own router ID in that neighbor's hello list. That proves traffic flows in both directions.
Parameters that must match
A router silently drops a hello whose key parameters disagree with its own interface. The result is no neighbor and often no log message.
| Parameter | Must match? | Typical symptom if wrong |
|---|---|---|
| Area ID | Yes | No neighbor appears |
| Hello and dead intervals | Yes | No neighbor appears |
| Subnet and mask (broadcast links) | Yes | No neighbor appears |
| Authentication type and key | Yes | No neighbor appears |
| Stub or NSSA area flags | Yes | No neighbor appears |
| Router ID | Must differ | Flapping or missing routes |
| MTU | Checked later, in database exchange | Stuck in ExStart or Exchange |
The default OSPF timers are a 10-second hello and a 40-second dead interval on broadcast and point-to-point links. Non-broadcast links use 30 and 120 seconds. The dead interval is usually four times the hello interval. If no hello arrives within the dead interval, the neighbor is declared down.
The neighbor state machine
Each neighbor moves through a series of states:
- Down: no hello has been received.
- Init: a hello was received, but it does not list our router ID yet.
- 2-Way: both sides see each other. This is bidirectional communication.
- ExStart: the routers choose a master and slave for the database exchange.
- Exchange: they swap summaries of their link-state databases.
- Loading: they request the entries they are missing.
- Full: the databases are synchronized. This is a full adjacency.
Neighbor versus adjacency
A neighbor is a router you have a 2-Way relationship with. An adjacency is a neighbor you have gone on to synchronize databases with, reaching Full. The two terms are not interchangeable, and the difference matters on shared links.
On a point-to-point link, every neighbor becomes adjacent. On a broadcast segment such as Ethernet with many routers, full adjacency between every pair would cost n(n-1)/2 database exchanges and flood each change many times. OSPF avoids this by electing a designated router (DR) and a backup (BDR). Every other router, called a DROther, forms a full adjacency only with the DR and BDR. Two DROthers stay in 2-Way with each other, which is normal and not a fault.
The election uses the priority field from the hello. The highest priority wins, with the highest router ID breaking ties. A priority of 0 means the router will never be DR or BDR. The election is not preemptive. A new router with a higher priority does not displace a working DR.
A small simulation
The following code models the hello logic: parameter checking, the bidirectional test, and the Init to 2-Way transition. It does not model the database exchange.
from dataclasses import dataclass
@dataclass(frozen=True)
class Hello:
router_id: str
area: str
hello_interval: int
dead_interval: int
seen: frozenset = frozenset()
class Interface:
def __init__(self, router_id, area="0", hello=10, dead=40):
self.router_id = router_id
self.area = area
self.hello = hello
self.dead = dead
self.neighbors = {} # router_id -> state
def hello_packet(self):
return Hello(self.router_id, self.area, self.hello, self.dead,
frozenset(self.neighbors))
def receive(self, h):
mine = (self.area, self.hello, self.dead)
if (h.area, h.hello_interval, h.dead_interval) != mine:
return None # parameter mismatch: drop silently
state = "2-Way" if self.router_id in h.seen else "Init"
self.neighbors[h.router_id] = state
return state
a = Interface("1.1.1.1")
b = Interface("2.2.2.2")
print(a.receive(b.hello_packet())) # Init: B has not heard A yet
print(b.receive(a.hello_packet())) # 2-Way: A's hello lists B
print(a.receive(b.hello_packet())) # 2-Way: B's hello now lists A
c = Interface("3.3.3.3", hello=30, dead=120)
print(a.receive(c.hello_packet())) # None: timers differRunning it prints Init, 2-Way, 2-Way, and None.
Failure detection
The dead interval is the main failure detector. With default timers a silent link failure can take up to 40 seconds to notice. Two things shorten this:
- Interface signals. If the physical link goes down, the router tears down the neighbor immediately without waiting for the timer.
- Faster timers or BFD. Lowering hello and dead intervals costs CPU and risks false alarms. Bidirectional Forwarding Detection (BFD) runs lightweight probes at millisecond scale and tells the routing protocol when a path fails.
When a neighbor goes down, the router originates a new LSA that omits the link and floods it. This is what starts reconvergence.
Common problems
- Stuck in Init. This router hears the neighbor, but the neighbor does not hear it. Look for an access list or firewall blocking multicast 224.0.0.5, or a one-way link fault.
- Stuck in 2-Way. This is expected between two DROthers. It is a fault only if one of the routers should be the DR or BDR.
- Stuck in ExStart or Exchange. The usual cause is an MTU mismatch between the two interfaces.
- Flapping neighbor. Look for packet loss on the link, a duplicate router ID, or timers set too tightly.
Exercise
Routers R1, R2, and R3 share one Ethernet segment. R1 is the DR and R2 is the BDR. What state does R3 show for each of R1 and R2, and what state does R3 reach with a fourth router R4 that is also a DROther?
Show answer
R3 reaches Full with R1 (the DR) and Full with R2 (the BDR). With R4, another DROther, R3 stays in 2-Way. Both routers see each other's hellos, but they do not synchronize databases directly. They learn each other's topology data through the DR.
Exercise
Router A shows B in Init, while B shows no neighbors at all. Which direction of traffic is probably broken, and why?
Show answer
Traffic from B to A works, because A hears B's hellos. Traffic from A to B is not arriving or is being dropped, perhaps by an access list blocking 224.0.0.5. If B heard A's hellos it would list A as a neighbor. Because B never hears A, B's hellos never list A, so A never sees its own router ID in them and stays in Init.