OSPF
Open Shortest Path First · Routing (control plane)
Static routes do not survive a link failure. OSPF has every router describe its own links, floods those descriptions to all the others, and lets each one independently compute the shortest path to everywhere. When a link fails, the description changes and everyone recomputes.
Understand these first
- Why does this protocol exist?
- Static routes do not survive a link failure or a topology change. Routers inside one organisation need to discover the network for themselves and recompute when it changes.
- Which problem does it solve?
- Let every router in an area build the same map of the network, independently, and compute its own shortest path across it.
- Who participates?
- Routers in one area. All are peers — there is no client and no server, though a designated router is elected on a shared segment to limit how many adjacencies are needed.
- Which layer uses it?
- Directly on IP with protocol number 89. No transport layer at all — OSPF handles its own reliability.
- What does it depend on?
- IP for delivery and multicast for discovery: hellos go to 224.0.0.5, so routers find each other without being configured with each other's addresses.
- What depends on it?
- The routing table, and therefore every packet the router forwards. BGP often relies on OSPF to make its next hops reachable.
- What state does each participant maintain?
- A neighbour table with a state per neighbour (Down, Init, Two-Way, ExStart, Exchange, Loading, Full), a link-state database that must be identical on every router in the area, and the routing table computed from it.
- Which fields matter?
- hello: helloInterval / deadInterval — Must match exactly or the adjacency never forms. A mismatch is one of the most common real misconfigurations.
- hello: neighbours list — Seeing your own router id in a neighbour's hello is what proves two-way communication.
- LSA: advertisingRouter / sequenceNumber — Who wrote this and which version. The sequence number is what stops flooding from looping forever.
- LSA: links and costs — The graph itself. Each router describes only its own links; the map is the union of everyone's descriptions.
- What does normal behaviour look like?
- Hellos every few seconds, adjacencies forming through their states to Full, databases synchronised, SPF run once, and then near-silence until something changes.
- What does failure look like?
- An adjacency stuck in Init (hellos are arriving but this router is not listed in them — one direction is broken) or in ExStart. Or a neighbour going Down when hellos stop for the dead interval. Or, most confusingly, an adjacency that is Full while traffic still takes the wrong path.
- How can I prove the diagnosis from packets?
- Compare the link-state databases: they must be identical on every router in the area. If they are, the topology is agreed and the path follows from the costs. If they are not, flooding has failed and the divergence points at where.
- How does it interact with the rest of the stack?
- OSPF is pure control plane: it decides, and the data plane forwards on what it decided. This app emits those as separate trace events, and the distinction matters — a Full adjacency proves the protocol is healthy, not that packets are getting through.
Cost is a configured number, conventionally derived from bandwidth. It is not a measurement, and it is not hop count.
Guided course — 5 lessons
Read in order. Every lesson pauses the capture on the packets it is talking about, and every one reads at three levels — so the time below is an estimate from the number of steps, not a measurement of anybody.
- 1OSPF-01How Two Routers Become NeighboursWhy saying hello takes more than one packet≈15 min · 9 steps · 3 questions · guidedNot started
- 2OSPF-02Everyone Draws the Same MapWhat routers exchange, and why nobody has to be trusted≈15 min · 8 steps · 3 questions · guided · after ospf-becoming-neighboursNot started
- 3OSPF-03What Gets Advertised, and What SpeaksA passive interface, and the difference between the two halves of OSPF≈10 min · 7 steps · 3 questions · guided · after ospf-becoming-neighbours, ospf-shortest-path-firstNot started
- 4OSPF-04When an Adjacency Will Not FormStuck at ExStart, and the checklist that will not find it≈10 min · 7 steps · 3 questions · guided · diagnosis lab · after ospf-becoming-neighbours, ospf-what-is-advertisedNot started
- 5OSPF-05When One Area Is Not EnoughAreas, Area 0, and the three things this simulator does not model≈10 min · 7 steps · 3 questions · guided · after ospf-shortest-path-first, ospf-when-adjacencies-failNot started
Troubleshooting labs — 1
A symptom, a capture, and no answer given. Each one is a lesson from the course above, listed again here because the diagnosis is worth coming back for.
Packet explorer — 9 scenarios, no coaching
Four routers come up and discover each other. Watch the neighbour table climb through Init, 2-Way and Full — and note that the very first hello carries an empty neighbour list, which is exactly what makes the second one meaningful.
Everyone ends up with the same mapEach router describes only its OWN links, floods that description, and acknowledges what it receives. Open the LSDB tab on any two routers and compare them — they converge to the same four entries, and each one then does its own arithmetic.
Shortest means cheapest, not fewest hopsTwo paths to the branch, both exactly two router hops. OSPF takes the southern one because it costs 10 against 20. Hop count never enters into it — a fact that separates OSPF from the distance-vector protocols that came before it.
Moving traffic without touching a routeThe southern path is winning. An operator raises R1's cost toward R3 from 5 to 50 — the link stays up, nothing is withdrawn — and the traffic moves north. Not one route was configured anywhere; the graph simply changed and everyone recomputed.
A link fails and nobody is told what to doThe southern link goes down mid-capture. R1 re-describes its links, floods the change, and every router recomputes — arriving at the northern path without a single instruction being sent. Compare how fast this is against a neighbour that dies silently.
Troubleshooting: the neighbour that never appearsR3 is configured with a 5-second hello where everyone else uses 2. Both routers send hellos forever, neither reports an error, and the adjacency never forms. Read the rejection note — then check how you would have found this in a real capture.
Troubleshooting: half the network is missingR3 has OSPF switched off. It is cabled, powered and forwarding — and completely absent from everyone's database, so the cheap southern path might as well not exist. Traffic takes the expensive route and nothing anywhere reports a fault.
Advertised, but not spoken onR1's office interface is passive. Count the hellos on the office LAN — there are none — and then look for 10.0.1.0/24 in R4's table, where it appears anyway. The network is advertised because the interface is in OSPF; no adjacency can form because no hello is ever sent.
Troubleshooting: stuck at ExStartR3's interfaces are configured for jumbo frames and everyone else's are not. The neighbours find each other, agree on every timer, and then refuse each other's Database Descriptions because the MTU in them does not match. Read the rejection, then check which path the traffic takes instead.
Reference material
The terms this module introduces, and the specifications behind them. Both lists come from the lessons themselves rather than from a list kept beside them.
That you can explain how every router arrives at the same answer without anybody being in charge.
Where OSPF sits in a real request
These captures run OSPF as one stage of a longer chain, and hand its result to whatever comes next.
The office journeys stop at the gateway. This one starts before it: two routing protocols fill one routing table, then ARP and DNS do their usual jobs, then an application opens a connection across the result. Nothing in the application's packets refers to a routing protocol — and that is what the routing protocols are for.
Control plane and data planeTwo captures of one network. In the first, the routers talk only to each other and no user traffic exists at all. In the second, user traffic crosses the network — while the routing protocols carry on saying hello in the background, because they never stop. Not one of their packets carries a byte of anybody's data. OSPF and BGP create forwarding information; the routing table selects a path; IP forwards packets; TCP, TLS and HTTP carry the application. Each of those depends on the one before it having already finished.
Diagnosis: the intranet is gone, the internet is fineExternal sites load. The internal application server does not respond at all. That split — outside works, inside does not — narrows this before you open a single packet.
Diagnosis: the link is up and the routes never arriveThe circuit to the provider is up and the interface counters climb. Nothing outside the company is reachable, and the internal network is completely unaffected.
Diagnosis: nothing is broken and it still does not workEvery device is up. Every protocol session is established. Every configuration matches the documentation. The application is unreachable anyway — this is the case that teaches what a routing table actually is.