Search code examples
network-programmingroutesbellman-ford

count to infinity in distance vector routing


I am having difficulty in understanding a key point in how count to infinity can occur.

Let us say we have a network

A-B-C-D-E

The cost for each link is 1.

According to Tanenbaum,

when A goes down, B will update its cost towards A as infinity. But B receives an advertisement from C which says "I can reach A with a cost of 2". Now, B can reach C with a cost of 1, so it updates the distance to A as 3.

In the next part I have a problem.

He says,

now C notices that both its neighbors can reach A with a cost of 3. "So C will update distance to A as 4"

Why does this happen? Because already C thinks it can reach A by a cost of 2.

By the Bellman Ford equation, this cost is lesser than the cost 3+1=4. Why shouldn't it simply keep 2 as the distance rather than changing it to 4?


Solution

  • Because the previous route from C to A was via B (with cost 2). Since now B is announcing to C a new route with cost 3, C has to update the cost to 4. This could happen in a scenario when the path from B to A has changed, and has a higher cost; C has to use the new cost.