Distance Vector Routing

Assumptions

The distance vector routing algorithm is based on the following assumptions:

  • Each router only knows distanced to its connected neighbors
  • Each router maintains it own state

Key Idea

The objective of dv routing is for each router to eventually know the shortest path to every other router in the network. This is archived through a update and propagation loop:

updateβ†’propagateβ†’updateβ†’propagate→…→converge

mathematically, it can be described as:

𝐷π‘₯(𝑦)=argminπ‘£βˆˆπ‘πΆπ‘₯,𝑣+𝐷𝑣(𝑦)

where:

  • 𝐷π‘₯(𝑦): the estimated least cost from router π‘₯ to router 𝑦 (in router π‘₯β€˜s dv table)
  • 𝐢π‘₯,𝑣: the directed cost from router π‘₯ to its neighbor router 𝑣
  • 𝑁: the set of neighbors of router π‘₯

Each router will propagate its distance vector if its distance vector is updated. And the routers receiving the distance vector will re-calculate its own distance vector based on the received distance vectors. Once all routers’ distance vectors are not updated anymore, the algorithm converges.

Example

image|w35

At the beginning, each router only knows the distance to its directly connected neighbors, thus all other path are marked as ∞. In the propagation process, we follows:

  • each router maintains its own distance vector table
  • each router can only update its own distance vector row (as marked in gray)
  • other entries can ONLY be updated when receiving distance vectors from neighbors
𝐷π‘₯𝑣π‘₯𝑦𝑧π‘₯027π‘¦βˆžβˆžβˆžπ‘§βˆžβˆžβˆžπ·π‘¦π‘£π‘₯𝑦𝑧π‘₯βˆžβˆžβˆžπ‘¦201π‘§βˆžβˆžβˆžπ·π‘§π‘£π‘₯𝑦𝑧π‘₯βˆžβˆžβˆžπ‘¦βˆžβˆžβˆžπ‘§710

In the next time step, each router will propagate its distance vector to its neighbors, take router π‘₯ as an example, it receives distance vectors from router 𝑦 and 𝑧 and update its own distance vector row:

𝐷π‘₯𝑣π‘₯𝑦𝑧π‘₯0??𝑦201𝑧710

Also, router π‘₯ should re-calculate the distance to each destination based on the received distance vectors:

𝐷π‘₯(𝑦)=min{𝐢π‘₯,𝑦+𝐷𝑦(𝑦)𝐢π‘₯,𝑧+𝐷𝑧(𝑦)=2𝐷π‘₯(𝑧)=min{𝐢π‘₯,𝑦+𝐷𝑦(𝑧)𝐢π‘₯,𝑧+𝐷𝑧(𝑧)=3

And thus the updated distance vector table at router π‘₯ is:

𝐷π‘₯𝑣π‘₯𝑦𝑧π‘₯023𝑦201𝑧710

Since router π‘₯ updated its distance vector, it will propagate the updated distance vector to its neighbors in the next time step. Similarly, router 𝑦 and 𝑧 will do the same. After several iterations, all routers will converge to the optimal distance vector table:

𝐷π‘₯𝑣π‘₯𝑦𝑧π‘₯023𝑦201𝑧310𝐷𝑦𝑣π‘₯𝑦𝑧π‘₯023𝑦201𝑧310𝐷𝑧𝑣π‘₯𝑦𝑧π‘₯023𝑦201𝑧310

image|w35

Let’s say that the link cost between router π‘₯ and 𝑦 changes from 2 to 50. Then the affected routers π‘₯ and 𝑦 will re-calculate their distance vectors:

𝐷π‘₯𝑣π‘₯𝑦𝑧π‘₯0??𝑦201𝑧310𝐷𝑦𝑣π‘₯𝑦𝑧π‘₯023𝑦?0?𝑧310

Re-calculating the distance vectors at router π‘₯ and 𝑦:

𝐷π‘₯(𝑦)=min{𝐢π‘₯,𝑦+𝐷𝑦(𝑦)=50+0=50𝐢π‘₯,𝑧+𝐷𝑧(𝑦)=7+1=8=8𝐷π‘₯(𝑧)=min{𝐢π‘₯,𝑦+𝐷𝑦(𝑧)=50+1=51𝐢π‘₯,𝑧+𝐷𝑧(𝑧)=7+0=7=7𝐷𝑦(π‘₯)=min{𝐢𝑦,π‘₯+𝐷π‘₯(π‘₯)=50+0=50𝐢𝑦,𝑧+𝐷𝑧(π‘₯)=1+3=4=4𝐷𝑦(𝑧)=min{𝐢𝑦,π‘₯+𝐷π‘₯(𝑧)=50+3𝐢𝑦,𝑧+𝐷𝑧(𝑧)=1+0=1=1

And thus the updated distance vector tables at router π‘₯ and 𝑦 are:

𝐷π‘₯𝑣π‘₯𝑦𝑧π‘₯087𝑦201𝑧310𝐷𝑦𝑣π‘₯𝑦𝑧π‘₯023𝑦401𝑧310

Count to Infinity Problem

If we take a deeper look at the updated distance vector, there are something very wired. How could 𝐷𝑦(π‘₯) seems very wired. From the graph we can’t find a path with cost 4 from router 𝑦 to router π‘₯. If we recall the calculation, this cost is obtain by:

π‘¦β†’π‘§βŸΏπ‘₯

where 𝑦→𝑧 is 𝐢𝑦,𝑧 and π‘§βŸΏπ‘₯ is 𝐷𝑧(π‘₯). However, the path π‘§βŸΏπ‘₯ actually goes through router 𝑦 again:

𝑧→𝑦→π‘₯

Thus, the path π‘¦β†’π‘§βŸΏπ‘₯ actually contains a loop, that’s why we get a wrong distance value. Though the distance vector algorithm can eventually converge to the correct distance values, this kind of loop may cause very long convergence time, which is called the count to infinity problem or we say the bad news travels slowly.