Distance Vector Routing Algorithm

Learn via video courses
Topics Covered

Overview

Distance vector is the "Dynamic Routing" protocol. Distant vector protocol also called as Bellman-Ford algorithm used to calculate the shortest path.

What is Distance Vector Routing (DVR) Protocol?

Distant vector routing protocol also called as Bellman-Ford algorithm or Ford Fulkerson algorithm used to calculate a path. A distance-vector protocol calculates the distance and direction of the vector of the next hop from the information obtained by the neighboring router. It is necessary to keep track of the topology and inform neighboring devices if any changes occur in the topology.

Let's understand a few key points about the distance vector routing protocol:

  • Network Information:
    Every node in the network should have information about its neighboring node. Each node in the network is designed to share information with all the nodes in the network.

  • Routing Pattern:
    In DVR the data shared by the nodes are transmitted only to that node that is linked directly to one or more nodes in the network.

  • Data sharing:
    The nodes share the information with the neighboring node from time to time as there is a change in network topology.

Explanation of Distance Vector Routing Algorithm

Distance vector routing algorithm is also called as Bellman-Ford algorithm or Ford Fulkerson algorithm as this algorithm is used to find the shortest route from one node to another node in the network.

The routing protocol is used to calculate the best route from source to destination based on the distance or hops as its primary metric to define an optimal path. The distance vector refers to the distance to the neighbor nodes, where routing defines the routes to the established node.

The Distance Vector routing algorithm(DVR) shares the information of the routing table with the other routers in the network and keeps the information up-to-date to select an optimal path from source to destination.

The Bellman-Ford algorithm is defined as:

bellman-algo-definition

where, dx(y)=dx(y)= The least distance from x to y
c(x,v)=c(x,v)= Node x's cost from each of its neighbor v
dv(y)=dv(y)= Distance to each node from initial node
minv=minv = selecting shortest distance

Consider a scenario where all the routers are set and run the distant vector routing algorithm. Each router in the network will share the distance information with the neighboring router. All the information is gathered from the neighbor routers. With each router's information, an optimal distance is calculated and stored in the routing table. This way, the process of calculating the optimal path is done using the distant vector routing protocol.

How Does DVR Protocol Work?

The distance vector routing algorithm works by having each router maintain a routing table, giving the best-known distance from source to destination and which route is used to get there.

These tables are updated by exchanging the information with the neighbor having a direct link. Tables contain one entry for each route, this entry contains two parts, the preferred outgoing line used to reach the destination or an estimate of the time or distance to that destination.

The metric used can be the number of hops required to reach from source to destination. Time delay in milliseconds, the router can measure it with a special echo signal which the receiver can timestamp and send as soon as possible.

The router exchanges the network topology information periodically with its neighboring node and updates the information in the routing table. The cost of reaching the destination is estimated based on the metric, and an optimal path is obtained to send data packets from source to destination.

Example of Distance Vector Routing

example-of-dvr

Step - 1

As we can see in the above diagram of the DVR network, the routers in the network start sharing their information with the neighboring routers in the network.

Routing table of A:

DestinationdistantHop
A0A
B8B
Cinfinity-
D5D

Routing table of B:

DestinationdistantHop
A8A
B0B
C2C
DinfinityD

Routing table of C:

DestinationdistantHop
Ainfinity-
B2B
C0C
D3D

Routing table of D :

DestinationdistantHop
A5A
BinfinityB
C3C
D0D

Step - 2

After creating the separate local table this information is shared with the neighboring node having a direct link.

For Router A:

The router A has a direct connection to neighboring routers B and D.

DestinationVector BVector D
A85
B0infinity
C23
Dinfinity0

So based on the vector information of the neighboring router, the value of the router is updated.

Here the optimal distance is been calculated to reach the specific destination. First, the distance from A to B is identified, in our case which is 8, ie cost(A>B)=8cost(A->B)=8, and cost(A>D)=5cost(A->D)=5

The distance to reach a destination B from router A is:

Since the cost is min from neighbor B so the router chooses the path from B. It then updates the routing information with entries (8,B)(8, B).

To find a cost to reach destination C from router A we will use a similar approach.

Distance to reach destination D from A

Consequently, A's new routing table is:

DestinationdistantHop
A0A
B8B
C8D
D5D

For router B:

Router B receives information from A and C.

The new routing table for B is calculated as:

DestinationVector AVector C
A0infinity
B82
Cinfinity0
D53

Distance to reach destination A from router B:

Distance to reach destination C from router B:

Distance to reach destination D from router B:

Consequently, B's new routing table is:

DestinationdistantHop
A8A
B0B
C2C
D5C

For router C:

The router C receives information from B and D.

The new routing table for C is calculated as:

DestinationVector BVector D
A85
B0infinity
C23
Dinfinity0

Distance to reach destination A from router C:

Distance to reach destination B from router C:

Distance to reach destination B from router C:

Consequently, C's new routing table is:

DestinationdistantHop
A8D
B2B
C0C
D3D

For router D:

The router D receives information from A and C.

The new routing table for D is calculated as:

DestinationVector AVector C
A0infinity
B82
Cinfinity0
D53

Distance to reach destination A from router D:

Distance to reach destination B from router D:

Distance to reach destination C from router D:

Consequently, D's new routing table is:

DestinationdistantHop
A5A
B5C
C3C
D0D

Step - 3

After this, the router again exchanges the distance vector obtained in step 2 with its neighboring router.

After exchanging the distance vector, the router prepares a new routing table.

For router A:

DestinationVector BVector D
A85
B05
C23
D50

Distance to reach destination B from router A:

Distance to reach destination C from router A:

Distance to reach destination D from router A:

Consequently, A's new routing table is:

DestinationdistantHop
A0A
B8B
C8D
D5D

For router B:

The router B receives information from A and C.

The new routing table for B is calculated as:

DestinationVector AVector C
A08
B82
C80
D53

Distance to reach destination A From router B:

Distance to reach destination C From router B:

Distance to reach destination D From router B:

Consequently, B's new routing table is:

DestinationdistantHop
A8A
B0B
C2C
D5C

For router C:

The router C receives information from B and D.

The new routing table for C is calculated as:

DestinationVector BVector D
A85
B05
C23
D50

Distance to reach destination A from router C:

Distance to reach destination B from router C:

Distance to reach destination D from router C:

Consequently, C's new routing table is:

DestinationdistantHop
A8D
B2B
C0C
D3D

For router D:

The router D receives information from A and C.

The new routing table for D is calculated as:

DestinationVector AVector C
A08
B82
C80
D53

Distance to reach destination A from router D:

Distance to reach destination B from router D:

Distance to reach destination C from router D:

Consequently, D's new routing table is:

DestinationdistantHop
A1A
B3C
C6C
D0D

As you can see in the above network all the link has been used. In the routing table of A link AD and AB is used. In the routing table of B only link BA and BC. In the routing table of C, only llinksCB and CD are used and in D's routing table only llinksDA and DC are used.

In this sense, we can also check which of the links can be used and which cannot. In this way, we find the shortest path using the distance vector routing algorithm.

Note:

  • In the distance vector routing protocol, only distance vector information is exchanged next-hop values are not exchanged.
  • while creating a new routing table, only the distance vector information sis hared that to its neighbor which has a direct link. The old router tables are not taken into consideration only newly updated router information is used.
  • The process of updating the routing table keeps on repeating periodically to update the shortest path in case the link goes down or there is a topology change.
  • Distance vector routing faces an account-to-infinity problem.

Advantage of Distance Vector Routing

  • The distance vector routing protocol is easy to implement for small networks.
  • Protocol faces a lower redundancy in the small network.

Disadvantages of Distance Vector Routing

  • The distance vector routing faces a slow coverage problem, as it requires more time to get accurate information for the routing table.
  • Traffic is created due to periodic changes in the network topology.
  • The distance vector routing faces an account-to-infinity problem.

Looking to excel in the world of networks? Our Free Computer Networking course is tailored for beginners & will guide you towards becoming confident in networking.

Conclusion

  • Distance vector routing is a type of dynamic protocol.
  • Distant vector routing algorithm also called as Bellman-Ford algorithm or Ford Fulkerson algorithm used to calculate the shortest path in the network.
  • The router shares the information between the neighboring node containing a direct link.
  • The router is used to find the optimal path from source to destination.
  • Each router in the network shares a change in topology periodically with the neighboring router