Link-State Routing: Principles, Mechanics, and a Worked Example

Link-State Routing: Principles, Mechanics, and a Worked Example

Verified Sources
Nov 4, 2026

Link-state routing is a class of routing algorithms where each router learns the full network topology (within its routing scope) by exchanging link-state information, then computes shortest paths locally using a shortest-path algorithm (commonly Dijkstra’s algorithm). In contrast to distance-vector routing, link-state routing does not rely on hop-by-hop iterative counting; instead it uses topology dissemination followed by local recomputation. Key elements include: link-state advertisement (LSA) flooding, a topology database (LSDB) maintained by every router, and the shortest-path first (SPF) calculation that yields the forwarding table.

A widely deployed link-state protocol is OSPF (Open Shortest Path First), defined as a link-state interior gateway protocol that floods LSAs and computes routes with SPF. Link-state routing also underpins IS-IS (Intermediate System to Intermediate System), which similarly floods link-state packets and uses SPF within routing levels.

Footnotes

  1. Open Shortest Path First (OSPF) Wikipedia - Overview of OSPF as a link-state IGP using LSAs and SPF, including area-based scope. ↩

  2. Intermediate System to Intermediate System (IS-IS) Wikipedia - Describes IS-IS as a link-state routing protocol using LSP flooding and SPF within routing levels. ↩

Core idea: “share topology, then compute”

In link-state routing, each router:

  1. Discovers the status and metric of its own links to neighbors.
  2. Creates a link-state advertisement describing those links.
  3. Floods the advertisement to other routers (typically via controlled flooding within an area).
  4. Each router stores received LSAs in a topology database.
  5. Each router runs SPF on the database to compute the shortest-path tree and select next hops.

This separation—dissemination of topology followed by local shortest-path computation—is the defining difference versus distance-vector routing.

Why it matters: once LSAs are fully flooded, SPF computation is deterministic given the same LSDB, producing consistent routes and typically faster convergence after topology changes than pure distance-vector mechanisms. OSPF’s operation is described around LSAs, flooding, and SPF computation.

Footnotes

  1. Open Shortest Path First (OSPF) Wikipedia - Overview of OSPF as a link-state IGP using LSAs and SPF, including area-based scope. ↩

Mental model

Think of link-state routing as building a “map” of the network locally (via LSDB) and then always asking: “What’s the shortest path from me to every destination?”

Scope matters

Link-state flooding and the LSDB are usually constrained (e.g., OSPF areas). This affects what each router actually knows and therefore which routes it can compute.

  1. 1
    Step 1

    Routers identify adjacent neighbors and track metrics/state for each local link (e.g., up/down, cost).

  2. 2
    Step 2

    Router creates an LSA that includes identifiers of links and their costs from that router to neighbors.

  3. 3
    Step 3

    Using controlled flooding, the LSA is propagated to all routers that share the scope (e.g., OSPF area).

  4. 4
    Step 4

    Routers store each LSA (indexed by origin and sequence/version) to maintain a consistent topology view.

  5. 5
    Step 5

    For each destination, compute shortest paths from the local router using SPF (typically Dijkstra) over the LSDB graph.

  6. 6
    Step 6

    Choose next-hop(s) along the SPF tree and install best routes (often considering tie-breaking and equal-cost multipath if supported).

Visualizing the SPF step with a graph

After LS flooding, each router has the same LSDB (within its scope). SPF treats the LSDB as a weighted graph:

  • vertices = routers (or nodes)
  • edges = links with costs/metrics

Then it computes shortest path distances from the local node to all others. Dijkstra’s algorithm is the canonical SPF approach used to compute least-cost paths from a single source over a weighted graph. OSPF explicitly uses SPF for route computation.

Footnotes

  1. Open Shortest Path First (OSPF) Wikipedia - Overview of OSPF as a link-state IGP using LSAs and SPF, including area-based scope. ↩

Assume router R1 is the local router that will compute routes. The network graph (within the routing area/scope) is:

  • Links:
    • R1—R2 cost 2
    • R1—R3 cost 5
    • R2—R3 cost 1
    • R2—R4 cost 2
    • R3—R4 cost 3

Each router would originate an LSA describing its own local links (e.g., R2’s LSA lists links to R1, R3, and R4 with their costs). Flooding disseminates these LSAs so that R1’s LSDB contains the full weighted graph.

Example SPF Computation from R1

  1. 1
    Step 1

    Set d(R1)=0d(R1)=0. For other routers, set d(⋅)=∞d(\cdot)=\infty.

  2. 2
    Step 2

    Pick the node with minimum tentative distance. Initially, that is R1 with 00.

  3. 3
    Step 3

    Using R1’s edges: update d(R2)=2d(R2)=2 and d(R3)=5d(R3)=5.

  4. 4
    Step 4

    Closest unsettled is R2 with distance 22.

  5. 5
    Step 5

    From R2: via edge R2—R3 cost 1 gives candidate d(R3)=2+1=3d(R3)=2+1=3, improving over 5. Via edge R2—R4 cost 2 gives d(R4)=2+2=4d(R4)=2+2=4.

  6. 6
    Step 6

    Closest unsettled is R3 with distance 33.

  7. 7
    Step 7

    From R3 to R4 cost 3 gives candidate d(R4)=3+3=6d(R4)=3+3=6, which does not beat 44, so keep d(R4)=4d(R4)=4.

  8. 8
    Step 8

    Shortest distances from R1 are: d(R2)=2d(R2)=2, d(R3)=3d(R3)=3, d(R4)=4d(R4)=4.

Shortest-path distances from R1 (SPF results)

Computed over the flooded link-state topology graph.

Deriving the forwarding next hops

From the computed shortest paths:

  • To R2: path is R1 → R2, next hop = R2
  • To R3: path is R1 → R2 → R3 (since 2+1=32 + 1 = 3 is less than direct 55), next hop = R2
  • To R4: path is R1 → R2 → R4 (cost 2+2=42+2=4), next hop = R2

This is exactly what the SPF result (shortest-path tree) supplies: the parent/predecessor relationships define the next hop for each destination.

How this maps to OSPF/IS-IS behavior

For OSPF, routers send and receive LSAs, populate the LSDB, and compute shortest paths using SPF (shortest-path first). OSPF also organizes topology into areas to control flooding scope and reduce database size.

For IS-IS, routers exchange link-state packets (LSPs) within configured routing levels; the protocol follows the same link-state idea of flooding topology information and running SPF to compute routes.

Footnotes

  1. Open Shortest Path First (OSPF) Wikipedia - Overview of OSPF as a link-state IGP using LSAs and SPF, including area-based scope. ↩ ↩2

  2. Intermediate System to Intermediate System (IS-IS) Wikipedia - Describes IS-IS as a link-state routing protocol using LSP flooding and SPF within routing levels. ↩

Concept check & edge cases

Knowledge Check

Question 1 of 4
Q1Single choice

In link-state routing, routers primarily disseminate: