Sub topic 7
From Down to Full: The Neighbor State Machine
This chapter assumes you know what a Hello packet is, what the router ID is, and how DR and BDR election works on a broadcast segment. It follows one OSPF neighbor relationship from first contact to a fully synchronized adjacency and shows where it can stall.
Neighbors versus adjacencies
A neighbor is a router you have heard from and that agrees with you on the basic link parameters. An adjacency is a neighbor you have also synchronized link-state databases with. OSPF tracks both with one state machine per neighbor, per interface. Only routers in the Full state exchange routing information that SPF uses. A neighbor that is stuck in any other state contributes nothing to your routing table.
The states in order
| State | What it means | What triggers the next state |
|---|---|---|
| Down | No Hello has been received from this neighbor. | A Hello arrives. |
| Attempt | Used only on non-broadcast networks where a neighbor is configured statically. You are sending Hellos but have heard nothing back. | A Hello arrives. |
| Init | You received a Hello, but it does not list your router ID in its neighbor field. | You receive a Hello that lists your router ID. |
| 2-Way | Both sides see each other. Communication is bidirectional. | On multi-access links, DR and BDR election finishes. Then the pair decides whether to form an adjacency. |
| ExStart | The two routers pick a master and a slave and choose the initial DBD sequence number. | Master and slave are agreed. |
| Exchange | The routers send Database Description (DBD) packets that list LSA headers. | Both sides have sent and received all DBDs. |
| Loading | A router requests LSAs it is missing or that are older than its neighbor's copy. | All requested LSAs have arrived. |
| Full | The databases are synchronized. | None. The adjacency stays in this state until the dead timer expires or the link fails. |
The decision at 2-Way
2-Way is the only state where OSPF decides whether to go further. The rule depends on the network type.
- On point-to-point links, every neighbor becomes adjacent.
- On broadcast and non-broadcast multi-access segments, a router forms an adjacency only with the DR and the BDR. Two DROther routers stay in 2-Way with each other permanently.
A DROther in 2-Way with another DROther is normal. It is the most common false alarm when people read show ip ospf neighbor for the first time.
What happens in ExStart through Full
Each step uses a different packet type.
- ExStart. Each router sends an empty DBD with the I (initial), M (more) and MS (master) bits set. The router with the higher router ID becomes the master and controls the sequence numbers. Duplicate router IDs break this negotiation.
- Exchange. The routers swap DBD packets that carry only LSA headers (type, ID, advertising router, sequence number, age), not the LSAs themselves. Each side compares the headers against its own database.
- Loading. For every header that is new or newer, the router sends a Link State Request (LSR). The neighbor answers with a Link State Update (LSU) containing the full LSAs. The receiver acknowledges them with Link State Acknowledgment (LSAck) packets.
- Full. No requests remain. Both routers list each other in their Router LSAs, and SPF can use the link.
If nothing is missing at the end of Exchange, a router can skip Loading and go straight to Full.
Where adjacencies stall
The state where a neighbor is stuck tells you which kind of problem to look for.
| Stuck in | Typical causes |
|---|---|
| Down or missing from the table | The interface is down, OSPF is not enabled on the interface, the interface is passive, an ACL or firewall drops protocol 89 or multicast 224.0.0.5, or the subnets do not match. |
| Init | Hellos arrive but yours do not reach the neighbor, for example because of a one-way ACL, a multicast problem on a Layer 2 switch, or an authentication mismatch on one side. |
| 2-Way | Expected between two DROther routers. Otherwise, both routers have priority 0 and no DR can be elected. |
| ExStart or Exchange | An MTU mismatch, a duplicate router ID, or unicast DBD packets being dropped. Neighbors flap between ExStart and Down. |
| Loading | LSR or LSU packets are lost because of large packets and fragmentation problems, or an LSA is corrupted. |
Some mismatches prevent the neighbor from even reaching Init, because the Hello is rejected. These are the Hello and dead intervals, the area ID, the area type flags (stub or not), the authentication settings, and the subnet and mask on non-point-to-point links. A mismatch in any of them leaves the neighbor absent from the table.
Observing the states
Use the neighbor table first, then turn on adjacency debugging when you need to see the transitions.
show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/DR 00:00:33 10.0.12.2 GigabitEthernet0/0
3.3.3.3 1 2WAY/DROTHER 00:00:37 10.0.12.3 GigabitEthernet0/0The State column combines the neighbor state with the neighbor's role on that segment. FULL/DR means synchronized with the designated router. 2WAY/DROTHER is the healthy non-adjacent pair described above. On a point-to-point link, the role shows as -.
debug ip ospf adjThe debug output prints each transition (for example 2 Way Communication to neighbor 2.2.2.2 and Nbr 2.2.2.2 has smaller interface MTU). Run it briefly and turn it off with undebug all, because it can be verbose on busy routers.
Leaving Full
An adjacency does not last forever. It drops back to Down when no Hello arrives within the dead interval (40 seconds by default on broadcast and point-to-point links), when the interface goes down, or when you clear the process. When it drops, the router removes the neighbor from its Router LSA, floods the change, and every router in the area reruns SPF. A neighbor that flaps repeatedly therefore costs CPU on every router in the area, which is why a stalled or unstable adjacency is worth fixing even when traffic still has a backup path.
Exercise
Router A shows router B as 2WAY/DROTHER on a shared Ethernet segment and router C as FULL/DR. A user reports that A and B cannot see each other's LSAs directly. Is this a fault, and how do A and B learn each other's LSAs?
Show answer
It is not a fault. A and B are both DROther routers, so they stay in 2-Way and do not form an adjacency. Each of them sends its LSAs to the DR (and the BDR), and the DR floods them to all routers on the segment, so both still get each other's information.
Exercise
A neighbor repeatedly cycles between ExStart and Down. Hellos are being exchanged normally and the Hello timers match. Name the most likely cause and one way to confirm it.
Show answer
An MTU mismatch between the two interfaces (a duplicate router ID is the other likely cause). Compare the interface MTUs with show interfaces, or run debug ip ospf adj and look for a message that the neighbor has a smaller interface MTU.