OSPF: Open Shortest Path First

Graduate Depth 53 in the knowledge graph I know this Set as goal
Unlocks 4 downstream topics
ospf link-state igp interior-gateway-protocol

Core Idea

OSPF is a widely-used interior gateway protocol (IGP) that routers within an autonomous system use to exchange topology information and compute shortest paths. OSPF organizes networks into areas to reduce overhead, supports equal-cost multipath routing, and converges quickly to topology changes.

Explainer

You already know Dijkstra's algorithm: given a weighted graph and a source node, it computes the shortest path to every other node. OSPF is what happens when you deploy Dijkstra's algorithm across a real network of routers. Each router runs OSPF to discover the network topology, share that topology with its neighbors, and then independently compute the best forwarding paths. The key insight is that every OSPF router builds the same complete map of the network, then runs the same shortest-path computation locally — there is no central authority deciding routes.

OSPF is a link-state protocol. Each router advertises the state of its directly connected links (which neighbors it can reach and at what cost) using Link-State Advertisements (LSAs). These LSAs are flooded throughout the network: when a router receives a new LSA, it forwards copies to all its other neighbors. Through this flooding process, every router accumulates a complete Link-State Database (LSDB) — essentially an adjacency list representation of the entire network graph. Each router then runs Dijkstra's algorithm on this shared database to build its own routing table. Because all routers have the same LSDB, they all compute consistent, loop-free paths.

The challenge with pure link-state flooding is scalability. In a network with thousands of routers, every link change triggers a flood of LSAs to every router, and every router must re-run Dijkstra on the full graph. OSPF solves this with areas — logical subdivisions of the network. Area 0 (the backbone area) connects all other areas. Routers within an area exchange detailed LSAs only with each other; Area Border Routers (ABRs) summarize routes between areas. This hierarchy means a link failure in Area 3 triggers re-computation only within Area 3 — routers in Area 1 see only a summarized route change, not the internal topology details. The result is faster convergence and smaller LSDBs.

OSPF also supports equal-cost multipath (ECMP) routing: when Dijkstra finds multiple paths with the same total cost, OSPF installs all of them in the routing table and load-balances traffic across them. This is a significant advantage over protocols that select a single best path. Combined with fast convergence (routers detect link failures through hello packets and can recompute paths within seconds), OSPF remains the dominant interior gateway protocol for enterprise and service provider networks.

Practice Questions 5 questions

Prerequisite Chain

Counting to 10Counting to 20Understanding ZeroThe Number ZeroCounting to FiveOne-to-One CorrespondenceCombining Small Groups Within 5Addition Within 10Addition Within 20Two-Digit Addition Without RegroupingTwo-Digit Addition with RegroupingAddition Within 100Repeated Addition as MultiplicationMultiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Two-Digit by One-Digit DivisionDivision with RemaindersRemainders and Quotients in DivisionDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueReading and Writing DecimalsComparing and Ordering DecimalsAdding and Subtracting DecimalsMultiplying DecimalsDividing DecimalsDividing FractionsMixed Number ArithmeticOrder of OperationsOperators and ExpressionsArithmetic Operators and Operator PrecedenceComparison Operators and Boolean TestsLogical Operators and Boolean AlgebraBoolean Algebra and Fundamental LawsCombinational Circuit DesignFlip-Flops and LatchesBinary Counters: Design and AnalysisBinary ArithmeticSubnetting and CIDR NotationIP Routing and ForwardingRouting Algorithms and ProtocolsDijkstra's Shortest Path Algorithm in RoutingOSPF: Open Shortest Path First

Longest path: 54 steps · 217 total prerequisite topics

Prerequisites (1)

Leads To (1)