A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

OSPF: Open Shortest Path First

Graduate Depth 85 in the knowledge graph I know this Set as goal
4topics build on this
343prerequisites beneath it
See this on the map →
Dijkstra's Shortest Path Algorithm in RoutingLink-State Routing ProtocolsBGP: Border Gateway Protocol
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

Understanding ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication 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 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersIntroduction to ExponentsOrder of OperationsInteger Order of OperationsVariable ExpressionsThe Distributive PropertyVariables and Expressions ReviewIntroduction to PolynomialsAdding and Subtracting PolynomialsMultiplying PolynomialsFactorialPermutationsCombinationsCounting Principles: Addition and Multiplication RulesIntroduction to Graph TheoryPropositional Logic FoundationsLogical EquivalencesBoolean AlgebraBoolean Type and Truth ValuesComparison Operators and Boolean TestsLogical Operators and Boolean AlgebraBoolean Algebra and Fundamental LawsLogic Gates FundamentalsImplementing Boolean Functions with GatesKarnaugh Map SimplificationCombinational Circuit DesignFlip-Flops and LatchesBinary Counters: Design and AnalysisBinary ArithmeticSubnetting and CIDR NotationIP Routing and ForwardingRouting Algorithms and ProtocolsDijkstra's Shortest Path Algorithm in RoutingLink-State Routing ProtocolsOSPF: Open Shortest Path First

Longest path: 86 steps · 343 total prerequisite topics

Prerequisites (2)

Leads To (1)