# Distance Vector Routing Example

Consider a network with five nodes, N1 to N5, as shown as below.

The network uses a Distance Vector Routing protocol. Once the routes have been stabilized, the distance vectors at different nodes are as follows.

N1: (0,1,7,8,4)

N2: (1,0,6,7,3)

N3: (7,6,0,2,6)

N4: (8,7,2,0,4)

N5: (4,3,6,4,0)

Each distance vector is the distance of the best known path at that instance to nodes, N1toN5, where the distance to itself is 0. Also, all links are symmetric and the cost is identical in both directions. In each round, all nodes exchange their distance vectors with their respective neighbors. Then all nodes update their distance vectors. In between two rounds, any change in cost of a link will cause the two incident nodes to change only that entry in their distance vectors.

It's a GATE-2011 question.

I have a doubt here.

Suppose when the cost of the link N2-N3 changes to 2, this will be immediately known to N2 and N3 and they will update their routing table entry to reflect this change. Now, this would cause triggered update.

Suppose After receiving the vector from N2, N3 finally changes it's vector to (3,2,0,2,5).

Now my query is whether this vector (3,2,0,2,5) would be communicated to N4 or the old vector of N3(7,6,0,2,6) would be communicated to N4?

## 1 Answer

Let us review the specification of the algorithm.

In each round, all nodes exchange their distance vectors with their respective neighbors. Then all nodes update their distance vectors. In between two rounds, any change in cost of a link will cause the two incident nodes to change only that entry in their distance vectors.

Right after the cost of link N2-N3 changes to 2, the distance vectors at different nodes are as follows. The only difference from before is the distance from N2 to N3 and the distance from N3 to N2 has been updated from 6 to 2.

N1: (0,1,7,8,4)
N2: (1,0,2,7,3)
N3: (7,2,0,2,6)
N4: (8,7,2,0,4)
N5: (4,3,6,4,0)

In the next round of exchange, all nodes exchange their distance vectors with their respective neighbors. In particular, N3 sends (7,2,0,2,6) to its neighbor N2 and N4. Right after this round of exchange, the knowledge of each node are as follows besides their knowledge of respective distances to their neighbors.

N1 knows (1,0,2,7,3) from N2.
N2 knows (0,1,7,8,4) from N1 and (7,2,0,2,6) from N3 and (4,3,6,4,0) from N5.
N3 knows (1,0,2,7,3) from N2 and (8,7,2,0,4) from N4.
N4 knows (7,2,0,2,6) from N3 and (4,3,6,4,0) from N5.
N5 knows (1,0,2,7,3) from N2 and (8,7,2,0,4) from N4.

Discarding current distance vectors, all nodes regenerate their distance vectors at the same time. So after, for example, a fraction of a second, the distance vectors at different nodes becomes the following.

N1: (0,1,3,8,4)
N2: (1,0,2,4,3)
N3: (3,2,0,2,5)
N4: (8,4,2,0,4)
N5: (4,3,5,4,0)

If no change of the network happens before the next round of exchange, then in the next round of exchange, each node will send above distance vectors to its neighbors. In particular, N3 will send (3,2,0,2,5) to its neighbor N2 and N4 in the next round.

However, if before the next round of exchange, it happens that the link between N1 and N2 goes down. Then N1 and N2 will update their distance vector immediately, but only with the distance between N1 and N2. Now the distance vectors at each node are as follows.

N1: (0,infinity,3,8,4)
N2: (infinity,0,2,4,3)
N3: (3,2,0,2,5)
N4: (8,4,2,0,4)
N5: (4,3,5,4,0)

After the next round of exchange, N3 knows the distance vector (infinity,0,2,4,3) from N2 and (8,4,2,0,4) from N4. So N3 will update its distance vector to (10,2,0,2,5).

• Thanks.I was doing Exactly this.But I had a doubt so preferred asking.And One more thing, When N3 has changed it's vector to (10,2,0,2,5) instead of (Infinity,2,0,2,5), this is count to infinity problem happening right? Jan 10, 2019 at 6:08
• Yes, the infamous count-to-infinity is unfolding. Jan 10, 2019 at 6:25