0% found this document useful (0 votes)
6 views

Distance Vector Routing

Uploaded by

rohansengupta22
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Distance Vector Routing

Uploaded by

rohansengupta22
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

COMPUTER NETWORKS

DISTANCE VECTOR
ROUTING
(DVR)
~ HARSHINI R
INTRODUCTION
In an internet, the goal of the network layer is to
deliver a datagram from its source to its
destination or destinations.
A datagram is a self-contained unit of data
that is sent over a network to transmit data
between nodes such as computers or servers. It
is also known as a packet.
If a datagram is destined for only one
destination (one-to-one delivery), we have
unicast routing.
If the datagram is destined for several
destinations (one-to-many delivery), we have
multicast routing.
UNICAST VS MULTICAST VS BROADCAST
UNICAST ROUTING- GENERAL IDEA
In unicast routing, a packet is routed, hop by hop, from its
source to its destination by the help of forwarding tables.
The source host needs no forwarding table because it
delivers its packet to the default router in its local
network.
The destination host needs no forwarding table either
because it receives the packet from its default router in
its local network.
Routing
This means that only the routers that glue together the
networks in the internet need forwarding tables.
Routing determines the best path for these packets to travel
across networks.
Forwarding ensures that packets move from one network to
another until they reach their destination. Forwarding
DISTANCE VECTOR ROUTING
In DVR, the first thing each node
creates is its own least-cost tree
with the rudimentary information it
has about its immediate neighbors.
The incomplete trees are
exchanged between immediate
neighbors to make the trees more
and more complete and to
represent the whole internet.
We can say that in DVR, a router
continuously tells all of its neighbors
what it knows about the whole
internet (although the knowledge Distance Vector Routing
can be incomplete).
BELLMAN-FORD EQUATION
The heart of distance-vector routing is the famous Bellman-Ford equation.
This equation is used to find the least cost (shortest distance) between a source node, x,
and a destination node, y, through some intermediary nodes (a, b, c, . . .) when the costs
between the source and the intermediary nodes and the least costs between the
intermediary nodes and the destination are given.
The following shows the general case in which Dij is the shortest distance and cij is the
cost between nodes i and j.

In distance-vector routing, normally we want to update an existing least cost with a least
cost through an intermediary node, such as z, if the latter is shorter. In this case, the
equation becomes simpler, as shown below:
BELLMAN-FORD EQUATION
We can say that the Bellman-Ford equation enables us to build a new least-cost path
from previously established least-cost paths.
In the figure, we can think of (a→y), (b→y), and (c→y) as previously established least-cost
paths and (x→y) as the new least-cost path.
We can even think of this equation as the builder of a new least-cost tree from previously
established least-cost trees if we use the equation repeatedly.
In other words, the use of this equation in distance-vector routing is a witness that this
method also uses least-cost trees, but this use may be in the background.

Graphical idea behind Bellman-Ford equation


DISTANCE VECTORS
The concept of a distance vector is the rationale for the name distance-vector routing.
A least-cost tree is a combination of least-cost paths from the root of the tree to all
destinations. These paths are graphically glued together to form the tree.
Distance-vector routing unglues these paths and creates a distance vector, a one-
dimensional array to represent the tree.

An internet and its graphical representation Least-cost trees for nodes in the internet
DISTANCE VECTORS
The name of the distance vector defines the
root, the indexes define the destinations,
and the value of each cell defines the least
cost from the root to the destination.
A distance vector does not give the path to
the destinations as the least-cost tree does;
it gives only the least costs to the
destinations.
We know that a distance vector can
represent least-cost paths in a least-cost
tree, but the question is how each node in
an internet originally creates the
corresponding vector.
The first distance vector tree for an internet
DISTANCE VECTORS
Each node in an internet, when it is booted, creates a very rudimentary distance vector
with the minimum information the node can obtain from its neighborhood.
The node sends some greeting messages out of its interfaces and discovers the identity
of the immediate neighbors and the distance between itself and each neighbor.
It then makes a simple distance vector by inserting the discovered distances in the
corresponding cells and leaves the value of other cells as infinity.
Do these distance vectors represent least-cost paths? They do, considering the limited
information a node has. When we know only one distance between two nodes, it is the
least cost.
These rudimentary vectors cannot help the internet to effectively forward a packet.
For example, node A thinks that it is not connected to node G because the corresponding
cell shows the least cost of infinity.
To improve these vectors, the nodes in the internet need to help each other by
exchanging information.
DISTANCE VECTORS
After a node receives a distance vector from a neighbor, it updates its distance vector
using the Bellman-Ford equation.
However, we need to understand that we need to update, not only one least cost, but N
of them in which N is the number of the nodes in the internet.
If we are using a program, we can do this using a loop; if we are showing the concept on
paper, we can show the whole vector instead of the N separate equations.
In the first event, node A has sent its vector to node B. Node B updates its vector using
the cost cBA = 2. In the second event, node E has sent its vector to node B. Node B
updates its vector using the cost cEA = 4.
After the first event, node B has one improvement in its vector: its least cost to node D
has changed from infinity to 5 (via node A). After the second event, node B has one
more improvement in its vector; its least cost to node F has changed from infinity to 6
(via node E).
DISTANCE VECTORS

Updating distance vectors


DISTANCE VECTOR ROUTING ALGORITHM
PSEUDOCODE
COUNT TO INFINITY PROBLEM
A problem with distance-vector routing is that any decrease in cost (good news)
propagates quickly, but any increase in cost (bad news) will propagate slowly.
For a routing protocol to work properly, if a link is broken (cost becomes infinity), every
other router should be aware of it immediately, but in distance-vector routing, this takes
some time.
The problem is referred to as count to infinity. It sometimes takes several updates
before the cost for a broken link is recorded as infinity by all routers.
EXAMPLE - TWO NODE LOOP
The figure shows a system with three nodes. We
have shown only the portions of the forwarding
table needed for our discussion.
At the beginning, both nodes A and B know how to
reach node X. But suddenly, the link between A and
X fails. Node A changes its table.
If A can send its table to B immediately, everything
is fine. However, the system becomes unstable if
B sends its forwarding table to A before
receiving A’s forwarding table.
Node A receives the update and, assuming that B
has found a way to reach X, immediately updates
its forwarding table. Now A sends its new update to
B.
EXAMPLE - TWO NODE LOOP
Now B thinks that something has been changed around A
and updates its forwarding table. The cost of reaching X
increases gradually until it reaches infinity.
At this moment, both A and B know that X cannot be
reached. However, during this time the system is not stable.
Node A thinks that the route to X is via B; node B thinks that
the route to X is via A. If A receives a packet destined for X,
the packet goes to B and then comes back to A.
Similarly, if B receives a packet destined for X, it goes to A
and comes back to B. Packets bounce between A and B,
creating a two-node loop problem.
A few solutions have been proposed for instability of this
kind.
THANK YOU

~ HARSHINI R

You might also like