Distance-vector Routing Protocol - Example

Example

In this network we have 4 routers A, B, C, and D:

We shall mark the current time (or iteration) in the algorithm with T, and shall begin (at time 0, or T=0) by creating distance matrices for each router to its immediate neighbors. As we build the routing tables below, the shortest path is highlighted with the color green, a new shortest path is highlighted with the color yellow. Note that all info is along the diagonal.

T=0
from A via A via B via C via D
to A
to B 3
to C 23
to D
from B via A via B via C via D
to A 3
to B
to C 2
to D
from C via A via B via C via D
to A 23
to B 2
to C
to D 5
from D via A via B via C via D
to A
to B
to C 5
to D
At this point, all the routers (A,B,C,D) have new "shortest-paths" for their DV (the list of distances that are from them to another router via a neighbor). They each broadcast this new DV to all their neighbors: A to B and C, B to C and A, C to A, B, and D, and D to C. As each of these neighbors receives this information, they now recalculate the shortest path using it.

For example: A receives a DV from C that tells A there is a path via C to D, with a distance (or cost) of 5. Since the current "shortest-path" to C is 23, then A knows it has a path to D that costs 23+5=28. As there are no other shorter paths that A knows about, it puts this as its current estimate for the shortest-path from itself (A) to D, via C.

T=1
from A via A via B via C via D
to A
to B 3 25
to C 5 23
to D 28
from B via A via B via C via D
to A 3 25
to B
to C 26 2
to D 7
from C via A via B via C via D
to A 23 5
to B 26 2
to C
to D 5
from D via A via B via C via D
to A 28
to B 7
to C 5
to D
Again, all the routers have gained in the last iteration (at T=1) new "shortest-paths", so they all broadcast their DVs to their neighbors; This prompts each neighbor to re-calculate their shortest distances again.

For instance: A receives a DV from B that tells A there is a path via B to D, with a distance (or cost) of 7. Since the current "shortest-path" to B is 3, then A knows it has a path to D that costs 7+3=10. This path to D of length 10 (via B) is shorter than the existing "shortest-path" to D of length 28 (via C), so it becomes the new "shortest-path" to D.

T=2
from A via A via B via C via D
to A
to B 3 25
to C 5 23
to D 10 28
from B via A via B via C via D
to A 3 7
to B
to C 26 2
to D 31 7
from C via A via B via C via D
to A 23 5 33
to B 26 2 12
to C
to D 51 9 5
from D via A via B via C via D
to A 10
to B 7
to C 5
to D
This time, only routers A and D have new shortest-paths for their DVs. So they broadcast their new DVs to their neighbors: A broadcasts to B and C, and D broadcasts to C. This causes each of the neighbors receiving the new DVs to re-calculate their shortest paths. However, since the information from the DVs doesn't yield any shorter paths than they already have in their routing tables, then there are no changes to the routing tables.
T=3
from A via A via B via C via D
to A
to B 3 25
to C 5 23
to D 10 28
from B via A via B via C via D
to A 3 7
to B
to C 8 2
to D 13 7
from C via A via B via C via D
to A 23 5 15
to B 26 2 12
to C
to D 33 9 5
from D via A via B via C via D
to A 10
to B 7
to C 5
to D
None of the routers have any new shortest-paths to broadcast. Therefore, none of the routers receive any new information that might change their routing tables. So the algorithm comes to a stop.

Read more about this topic:  Distance-vector Routing Protocol

Famous quotes containing the word example:

    Our intellect is not the most subtle, the most powerful, the most appropriate, instrument for revealing the truth. It is life that, little by little, example by example, permits us to see that what is most important to our heart, or to our mind, is learned not by reasoning but through other agencies. Then it is that the intellect, observing their superiority, abdicates its control to them upon reasoned grounds and agrees to become their collaborator and lackey.
    Marcel Proust (1871–1922)