The Network Layer: Routing

OSPF

/ O-S-P-F /

OSPF, Open Shortest Path First, is the workhorse link-state routing protocol inside corporate and ISP networks. If RIP is the simple 'ask the neighbors' scheme, OSPF is the 'everyone gets the whole map and computes their own routes' scheme made robust and scalable. 'Open' means it is a public, vendor-neutral standard anyone can implement.

Here is how it runs. Each OSPF router discovers its directly connected neighbors and measures the cost to each link (typically configured inversely to bandwidth). It packages this as a link-state advertisement and floods it reliably to every router in its area, so all routers build an identical link-state database — a complete map of that area. Each router then runs Dijkstra's algorithm (OSPF calls it shortest-path-first, SPF) on that database, rooted at itself, to compute least-cost paths and fill its forwarding table. When a link changes, only the affected router floods an update and everyone recomputes, giving fast, loop-free convergence.

Crucially, OSPF scales through hierarchy: a large network is divided into areas, all attached to a central backbone (area 0). Routers keep a full detailed map only of their own area and exchange just summaries across area boundaries, which slashes the flooding and computation that pure link-state would otherwise demand. OSPF carries its own packets directly over IP (protocol number 89), not over TCP or UDP, and uses cost as an unbounded metric, unlike RIP's 16-hop ceiling.

An honest caveat: OSPF is an interior gateway protocol — it routes within a single administrative domain (an autonomous system), not between separate organizations on the wider Internet, which is BGP's job. Its richness costs configuration complexity and per-area state, but for serious intra-domain routing that trade is well worth it, which is why OSPF, not RIP, dominates real deployments.

A bank's network is split into area 0 (backbone) plus areas 1 and 2 for two campuses. A router in area 1 holds the full area-1 map and runs Dijkstra on it, but sees only summarized routes into area 2 — so an area-2 link flap does not force area-1 routers to recompute everything.

OSPF areas contain flooding and SPF computation, so local churn stays local — that is how link-state scales.

OSPF routes inside one autonomous system (an interior gateway protocol). Routing between autonomous systems on the Internet is BGP's job, not OSPF's.

Also called
Open Shortest Path FirstOSPFv2開放最短路徑優先協定