Distance-Vector routing algorithm (DV)

The Distance-Vector (DV) algorithm allows each router to learn the best paths to destinations by exchanging information with its immediate neighbours.

It is:

It is called distance-vector because each router maintains a vector of distances (costs) to all known destinations.

Bellman-Ford algorithm

Distance Vector (DV) routing is:

Each router only knows:

Bellman–Ford equation

To estimate the cheapest path from node \( x \) to node \( y \), node \( x \) checks all its neighbors \( v \) and chooses the route with the lowest total cost:

\[ D_x(y) = min_v\{ c(x, v) + D_v(y) \} \]

For each neighbor \( v \) of \( x \):

In simple terms:

My best route to a destination is the cheapest route through any of my neighbours, based on the distances they currently advertise.

Suppose node \( u \) wants to estimate its cost to reach destination \( z \):

Neighbors of \( u \)

\( {\color{crimson}v} \) \( {\color{ForestGreen}x} \) \( {\color{navy}w} \)

Costs from \( u \) to neighbors

\( {\color{crimson}c(u, v) = 2} \) \( {\color{ForestGreen}c(u, x) = 1} \) \( {\color{navy}c(u, w) = 5} \)

Best known cost advertised from neighbors to reach \( z \)

\( {\color{crimson}D_v(z) = 5} \) \( {\color{ForestGreen}D_x(z) = 3} \) \( {\color{navy}D_w(z) = 3} \)

B-F equation

\[ \begin{aligned} D_u(z) &= min\{ {\color{crimson}c(u, v)+D_v(z)}, {\color{ForestGreen}c(u, x)+D_x(z)}, {\color{navy}c(u, w)+D_w(z)} \} \\ &= min\{ {\color{crimson}2+5}, {\color{ForestGreen}1+3}, {\color{navy}5+3} \} \\ &= min\{ {\color{crimson}7}, {\color{ForestGreen}4}, {\color{navy}8} \} \\ &= {\color{ForestGreen}4} \\ \end{aligned} \]

Result

The best next hop from \( u \) to \( z \) is \( {\color{ForestGreen}x} \)

DV algorithm

Each router uses the Bellman–Ford equation to maintain its distance vector and build its forwarding table.

A router maintains:

Algorithm initialization at node \( x \):

for each destination y:
    if y == x:
        Dx(y) = 0
    else if y directly connected to x:
        Dx(y) = c(x,y)
    else:
        Dx(y) = ∞

for each neighbor v:
    send distance vector Dx to v

Algorithm main loop at node \( x \):

repeat forever:

    wait until:
        - a link cost c(x,v) changes, OR
        - a distance vector Dv is received from neighbor v

    for each destination y in N:
        Dx(y) = min over neighbors v { c(x,v) + Dv(y) }

    if Dx changed:
        send distance vector Dx to all neighbors

Convergence

Routers gradually improve their estimates by exchanging information with their neighbours.

Under stable network conditions, the estimated costs \( D_x(y) \) converge to the actual shortest-path costs \( d_x(y) \).

Once convergence occurs, each router knows the lowest-cost route to every reachable destination and can maintain a stable forwarding table.

If a link cost changes, routers exchange updated distance vectors and repeat the process until they converge again.

DV-style algorithms are used in real-world routing protocols such as RIP for IP networks, AODV for wireless networks, and DSDV for mobile networks.

Link-cost changes

When a link cost decreases

The link cost between x and y decreases from 4 to 1:

When a link cost decreases

The network reaches a quiescent state after two iterations.

The decreased cost between x and y has propagated quickly: good news travels fast.

When a link cost increases

The link cost between x and y increases from 4 to 60:

When a link cost increases

The cost therefore increases one hop at a time:

6 → 7 → 8 → 9 → …

The process may take many iterations until the learned path cost exceeds the direct alternative (50), causing z to switch to the direct route to x.

The network reaches a quiescent state only after many iterations. The increased cost between x and y has propagated slowly.

This behavior is known as the count-to-infinity problem, which is why: bad news travels slow.

Poisoned reverse

This specific looping scenario can be avoided using the poisoned reverse technique.

Whenever a router reaches a destination through a neighbor, it advertises an infinite cost for that destination to that neighbor.

Example

Initially:

When the link cost between x and y increases from 4 to 60:

After learning about the new cost 60:

Now:

Limitation

Poisoned reverse does not solve the general count-to-infinity problem:

Previous Link-State routing algorithm (LS) All ⏎ Next Intra-AS routing (OSPF)

A Kemar Joint