0% found this document useful (0 votes)
20 views27 pages

CCN Module II - 2

Uploaded by

soumyaks81
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views27 pages

CCN Module II - 2

Uploaded by

soumyaks81
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

Computer Networks

Module 2 - 2
ROUTING ALGORITHMS
Distance-Vector Routing
 The distance-vector (DV) routing uses the
goal to find the best route.
 In distance-vector routing, 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 distance-vector routing, a
router continuously tells all of its neighbors what
it knows about the whole internet
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:
Distance-Vector Routing Algorithm
Distance_Vector_Routing ( )
{
// Initialize (create initial vectors for the node)
D[myself ] = 0
for (y = 1 to N)
{
if (y is a neighbor)
D[y] = c[myself ][y]
else
D[y] = ∞
}
send vector {D[1], D[2], …, D[N]} to all neighbors
// Update (improve the vector with the vector received from a
neighbor)
repeat (forever)
{
wait (for a vector Dw from a neighbor w or any change in the
link)
for (y = 1 to N)
{
D[y] = min [D[y], (c[myself ][w] + Dw[y ])]
// Bellman-Ford equation
}
if (any change in the vector)
send vector {D[1], D[2], …, D[N]} to all neighbors
}
} // End of Distance Vector
Link-State Routing
 A routing algorithm that directly follows for
creating least-cost trees and forwarding
tables is link-state (LS) routing.
 This method uses the term link-state to define
the characteristic of a link (an edge) that
represents a network in the internet.
 In this algorithm the cost associated with an
edge defines the state of the link.
 Links with lower costs are preferred to links
with higher costs; if the cost of a link is
infinity, it means that the link does not exist
or has been broken.
Link-State Database (LSDB)
 To create a least-cost tree with this method,
each node needs to have a complete map of
the network, which means it needs to know
the state of each link.
 The collection of states for all links is called
the link-state database (LSDB).
 There is only one LSDB for the whole internet;
each node needs to have a duplicate of it to
be able to create the least-cost tree.
 LSDB contains information about the whole internet.
This can be done by a process called flooding
 Each node can send some greeting messages to all its
immediate neighbors to collect two pieces of
information for each neighboring node: the identity of
the node and the cost of the link.
 The combination of these two pieces of information is
called the LS packet (LSP);
 When a node receives an LSP from one of its interfaces,
it compares the LSP with the copy it may already have.
 If the newly arrived LSP is older than the one it has
(found by checking he sequence number), it discards
the LSP.
 If it is newer or the first one received, the node discards
the old LSP (if there is one) and keeps the received one.
 It then sends a copy of it out of each interface
except the one from which the packet arrived.
 This guarantees that flooding stops
somewhere in the network.
Formation of Least-Cost Trees
 To create a least-cost tree for itself, using the shared
LSDB, each node needs to run the famous Dijkstra
Algorithm.
 This iterative algorithm uses the following steps:
1. The node chooses itself as the root of the tree, creating
a tree with a single node, and sets the total cost of
each node based on the information in the LSDB.
2. The node selects one node, among all nodes not in the
tree, which is closest to the root, and adds this to the
tree. After this node is added to the tree, the cost of all
other nodes not in the tree needs to be updated
because the paths may have been changed.
3. The node repeats step 2 until all nodes are added to
the tree.
Path-Vector Routing
 The best route is determined by the source
using the policy it imposes on the route.
 In other words, the source can control the
path.
 Although path-vector routing is not actually
used in an internet, and is mostly designed to
route a packet between ISPs
Spanning Trees
 In path-vector routing, the path from a source to all
destinations is also determined by the best spanning
tree.
 The best spanning tree, however, is not the least-cost
tree; it is the tree determined by the source when it
imposes its own policy.
 If there is more than one route to a destination, the
source can choose the route that meets its policy best.
 A source may apply several policies at the same time.
 One of the common policies uses the minimum
number of nodes to be visited.
 Another common policy is to avoid some nodes as the
middle node in a route.
Creation of Spanning Trees
 Path-vector routing, like distance-vector
routing, is an asynchronous and distributed
routing algorithm.
 The spanning trees are made, gradually and
asynchronously, by each node.
 When a node is booted, it creates a path
vector based on the information it can obtain
about its immediate neighbor.
 A node sends greeting messages to its
immediate neighbors to collect these pieces of
information.
 Each node, after the creation of the initial
path vector, sends it to all its immediate
neighbors.
 Each node, when it receives a path vector
from a neighbor, updates its path vector using
an equation

 In this equation, the operator (+) means to


add x to the beginning of the path.
Path-Vector Algorithm
Path_Vector_Routing ( )
{
// Initialization
for (y = 1 to N)
{
if (y is myself)
Path[y] = myself
else if (y is a neighbor)
Path[y] = myself + neighbor node
else
Path[y] = empty
}
Send vector {Path[1], Path[2], …, Path[y]} to all neighbors
// Update
repeat (forever)
{
wait (for a vector Pathw from a neighbor w)
for (y = 1 to N)
{
if (Pathw includes myself)
discard the path // Avoid any loop
else
Path[y] = best {Path[y], (myself + Pathw[y])}
}
If (there is a change in the vector)
Send vector {Path[1], Path[2], …, Path[y]} to all
neighbors
}
} // End of Path Vector
Unicasting
 In unicasting, there is one source and one
destination network.
 The relationship between the source and the
destination network is one to one.
 Each router in the path of the datagram tries to
forward the packet to one and only one of its
interfaces.
 Figure shows a small internet in which a unicast
packet needs to be delivered from a source
computer to a destination computer attached to
N6.
 Router R1 is responsible for forwarding the packet
only through interface 3; router R4 is responsible
for forwarding the packet only through interface
2.
 When the packet arrives at N6, the delivery to the
destination host is the responsibility of the
network; it is either broadcast to all hosts or the
Ethernet switch delivers it only to the destination
host.
Multicasting
 In multicasting, there is one source and a group of
destinations.
 The relationship is one to many. In this type of
communication, the source address is a unicast
address, but the destination address is a group
address, a group of one or more destination networks
in which there is at least one member of the group
that is interested in receiving the multicast datagram.
 The group address defines the members of the group.
 In multicasting, a multicast router may have to send
out copies of the same datagram through more than
one interface.
 In Figure, router R1 needs to send out the datagram
through interfaces 2 and 3.
 Similarly, router R4 needs to send out the datagram
through both its interfaces.
 Router R3, however, knows that there is no member
belonging to this group in the area reached by interface
2; it only sends out the datagram through interface 1.
Broadcasting
 Broadcasting means one-to-all communication: a
host sends a packet to all hosts in an internet.
 Broadcasting in this sense is not provided at the
Internet level for the obvious reason that it may
create a huge volume of traffic and use a huge
amount of bandwidth.
 Partial broadcasting, however, is done in the
Internet.
 For example, some peer-to-peer applications may
use broadcasting to access all peers.
 Controlled broadcasting may also be done in a
domain (area or autonomous system) mostly as a
step to achieve multicasting.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy