Skip to main content

Link-state and distance vector routing

Short answer

Link-state routing floods LSPs so all routers know the topology and run Dijkstra; in the example, A's shortest paths are B via B, C via B, D via B, E via B. Distance-vector exchanges neighbour tables and uses the Bellman-Ford equation D_x(y)=min_v{c(x,v)+D_v(y)}; it converges to the same routes but slowly, with count-to-infinity.

Describe the working mechanism of link-state routing and distance vector routing with the help of Dijkstra's algorithm and Bellman-Ford algorithm.

Both are dynamic (adaptive) routing methods. In link-state routing every router learns the whole map and runs Dijkstra's algorithm; in distance-vector routing every router only exchanges distance tables with its neighbours and uses the Bellman-Ford equation.

Example network used below (link costs shown):

        A
     2 / \ 6
      /   \
     B --3-- C
     |     / |
    7|   2/  |4
     |   /   |
     D --1-- E

Link-state routing (Dijkstra)

  1. Each router finds its neighbours (HELLO packets) and measures the cost of each link.
  2. It builds a link state packet (LSP): its ID, sequence number, age and the list of neighbours with costs.
  3. LSPs are flooded to all routers; each router stores them in a link-state database, so all routers have the same topology.
  4. Each router runs Dijkstra with itself as root:
    • Put the source in the permanent set with D=0D=0; set other DD = link cost or ∞\infty.
    • Repeatedly make permanent the tentative node with the least DD, then for each neighbour vv update D(v)=min⁡(D(v), D(u)+c(u,v))D(v) = \min(D(v),\ D(u) + c(u,v)).

Dijkstra from A:

StepPermanent setBCDE
1A2, A6, A∞∞
2A, B2, A5, B9, B∞
3A, B, C5, B7, C9, C
4A, B, C, D7, C8, D
5A, B, C, D, E8, D

Routing table of A: to B via B (2), C via B (5), D via B (7), E via B (8). Used in OSPF and IS-IS.

Distance-vector routing (Bellman-Ford)

  1. Each router keeps a vector of its best known distance and next hop to every destination; at start it knows only its direct links.
  2. Periodically (e.g. every 30 s in RIP) it sends its vector to its neighbours only.
  3. On receiving vectors, router xx updates each destination yy using
Dx(y)=min⁡v∈neighbours{ c(x,v)+Dv(y) }D_x(y) = \min_{v \in \text{neighbours}} \{\, c(x,v) + D_v(y) \,\}
  1. Repeating this, the tables converge to the shortest paths.

For A, neighbours are B (cost 2) and C (cost 6), with converged vectors DB=(A2,C3,D5,E6)D_B = (A2, C3, D5, E6) and DC=(A5,B3,D2,E3)D_C = (A5, B3, D2, E3):

DA(C)=min⁡(2+3, 6+0)=5 (via B)DA(D)=min⁡(2+5, 6+2)=7 (via B)DA(E)=min⁡(2+6, 6+3)=8 (via B)\begin{aligned} D_A(C) &= \min(2+3,\ 6+0) = 5 \ \text{(via B)} \\ D_A(D) &= \min(2+5,\ 6+2) = 7 \ \text{(via B)} \\ D_A(E) &= \min(2+6,\ 6+3) = 8 \ \text{(via B)} \end{aligned}

This is the same result as Dijkstra, reached in 3 exchange rounds (A's vector after rounds: E = 10, 9, 8).

Comparison

Link stateDistance vector
Knows full topologyKnows only neighbours' vectors
Floods small LSPs to allSends full table to neighbours
Fast convergence, loop-freeSlow, count-to-infinity problem
More memory and CPUSimple, less memory

✓ Answer checked by Claude Opus 5.5 (high effort)

All Telecommunications chapter 8 questions →