OSPF · Chapter 01 of 04

OSPF Fundamentals: Link-State Routing and the LSDB

OSPF is a link-state routing protocol: every router floods link-state advertisements describing its connections, so all routers in an area hold an identical topology database and independently compute shortest paths with Dijkstra's SPF algorithm. Cost, derived from interface bandwidth, is the metric, and OSPF converges by re-flooding only what changed.

Updated 31 August 2026 · RST Forum faculty

In this guideShow

Distance-vector protocols route on second-hand information — each router trusts its neighbours' summaries. Link-state protocols take the opposite bet: give every router the complete map, first-hand, and let each one compute its own paths. OSPF (RFC 2328 for OSPFv2) is the open-standard implementation of that bet and the default interior gateway protocol of the enterprise world.

The mechanics follow from the idea. Each router describes itself — its interfaces, their costs, its neighbours — in link-state advertisements (LSAs). LSAs are flooded reliably until every router in the area has an identical copy of every LSA: the link-state database (LSDB). Each router then runs Dijkstra's shortest-path-first algorithm over the LSDB with itself as the root, producing a shortest-path tree, from which routes enter the routing table with administrative distance 110.

Cost: the metric

OSPF cost is per-interface: reference bandwidth divided by interface bandwidth. The default reference of 100 Mbps is a museum piece — it gives FastEthernet, Gigabit and 100-Gigabit interfaces the identical cost of 1. Every real deployment raises it (auto-cost reference-bandwidth 100000 makes 100 Gbps cost 1, 10 Gbps cost 10, 1 Gbps cost 100), identically on every router — cost must be computed from the same reference network-wide or path selection becomes nonsense. Path cost is the sum of outgoing interface costs along the path; lowest total wins, and equal totals load-balance (four ways by default).

Why link-state converges fast and clean

  • Change-driven flooding: a link failure floods one updated LSA; there is no periodic re-advertisement of the world (LSAs refresh only every 30 minutes).
  • First-hand data: no counting to infinity, no holddown guesswork — the map is authoritative, and every router recomputes from it.
  • Loop freedom: an SPF tree computed over a consistent database cannot contain loops; transient micro-loops during reconvergence are the only exposure.
  • Fast reaction: failure detection (carrier loss, dead timer, or BFD in the milliseconds range) triggers immediate flooding and SPF — modern boxes reconverge in well under a second.

The cost of the map

The price is memory and CPU: every router stores every LSA in the area and runs SPF over all of it — and any change anywhere in the area makes every router in the area recompute. OSPF's answer is hierarchy: split the domain into areas, keep the full topology inside each area, and pass only summarised reachability between them through area 0. That structure — and the LSA types that implement it — is the subject of chapter three.

Minimum viable configuration

R1(config)# router ospf 1
R1(config-router)# router-id 1.1.1.1
R1(config-router)# auto-cost reference-bandwidth 100000
R1(config-router)# network 10.1.0.0 0.0.255.255 area 0
! or, per interface — the modern style:
R1(config)# interface gi0/0
R1(config-if)# ip ospf 1 area 0

Set the router ID explicitly, always — it names this router in every LSA and every neighbour's output, and letting it float with a loopback address makes every debugging session start with an identity parade. Verify the database view with show ip ospf database and the results with show ip route ospf; the next chapter covers what happens between two routers before any of this database exists.

Free chapters, real racks, CCIE faculty — that's the whole model.

Browse coursesEnroll