OSPF: link-state routing
Inside one organisation, routers have to agree on the best way through a mesh of links, and change their minds when a link fails. Watch five OSPF routers meet with Hellos, flood pieces of a shared map, run Dijkstra's shortest-path-first algorithm, and recompute when a cable is cut.
5 quick questions
Pick an answer to see why. Your score saves with your progress.
01R1 hears no Hello from R2 for a while. With the usual timers, when does R1 declare R2 dead?
Hellos go out every 10 s and the dead interval is 40 s, four missed Hellos. If the port itself goes down, the router reacts at once instead.
02What does a router put in its own link-state advertisement (router-LSA)?
Each router describes only itself. Flooding gathers everyone's piece, so each router can build the whole map and compute routes on its own.
03With the default reference of 100 Mb/s, what is the cost of a 10 Mb/s link and of a 1 Gb/s link?
Cost = 100 Mb/s ÷ speed, but never below 1. So 10 Mb/s costs 10, while 100 Mb/s, 1 Gb/s and 10 Gb/s all cost 1. That is why operators often raise the reference bandwidth.
04In the figure, why does R1 send traffic for R5 through R2 (R1, R2, R3, R5) instead of the two-hop path R1, R3, R5?
SPF picks the lowest total cost, not the fewest hops. Three cheap 100 Mb/s links beat one slow 10 Mb/s link plus another hop.
05Why do large OSPF networks use areas?
Area border routers pass summaries between an area and area 0, so a change in one area does not make every router in the network rerun SPF on a huge map.
Glossary
- OSPF
- Open Shortest Path First: a link-state routing protocol used inside one organisation's network. OSPFv2 (RFC 2328) carries IPv4 routes.
- Hello
- A small OSPF packet each router sends on every link, by default every 10 seconds, to find and keep its neighbours.
- Dead interval
- How long a router waits without hearing a neighbour's Hello before declaring it down: 40 seconds by default.
- Adjacency
- Two neighbours that have synchronised their maps and now exchange updates (state Full).
- LSA
- Link-state advertisement: one router's description of its own links and their costs, one piece of the shared map.
- LSDB
- Link-state database: all the LSAs a router holds. After flooding it is identical on every router in the area.
- Cost
- A number on each link; lower is better. A path's cost is the sum of its links. By default 100 Mb/s ÷ link speed.
- SPF
- Shortest path first: Dijkstra's algorithm, run by each router on the LSDB to find the cheapest path to every destination.
Notes and sources
- OSPF version 2 (RFC 2328) routes IPv4; OSPFv3 (RFC 5340) does the same for IPv6. OSPF packets ride directly on IP as protocol 89. Hellos go to 224.0.0.5; HelloInterval 10 s and RouterDeadInterval 40 s are the RFC's sample values for a LAN and the usual defaults. Neighbours must agree on the area and on both timers.
- Becoming adjacent runs ExStart, Exchange and Loading: Database Description packets list the LSA headers each side holds, Link State Requests ask for missing ones, Link State Updates carry them, and Link State Acknowledgments confirm them (RFC 2328 §10). On a shared LAN only the designated router (DR) and backup (BDR) become adjacent with everyone; these point-to-point links need no DR.
- RFC 2328 leaves each interface's cost (1 to 65535) to the operator. Cost = 100 Mb/s ÷ bandwidth, at least 1, is the long-standing default in common router software. With that reference, 1 Gb/s and 10 Gb/s links also get cost 1, so operators often raise the reference bandwidth.
- A router-LSA (type 1) lists the router's links and their costs. Routers refresh their LSAs every 30 minutes and a copy that is never refreshed ages out at 60 minutes (MaxAge). A higher sequence number marks the newer copy.
- SPF is Dijkstra's 1959 shortest-path algorithm (RFC 2328 §16.1). A link only counts if the routers at both ends list it, so one stale piece cannot keep a dead link alive. When two paths tie, OSPF can keep both (equal-cost multipath); this network has no ties.
- Area 0 (0.0.0.0) is the backbone; every other area attaches to it through an area border router, which passes summary LSAs (type 3) instead of the full map (RFC 2328 §3). Addresses here come from the RFC 5737 documentation ranges.
Quiz Unlocks after the last step.