0% found this document useful (0 votes)
24 views25 pages

Chapter III

networking

Uploaded by

mulusew atenafu
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)
24 views25 pages

Chapter III

networking

Uploaded by

mulusew atenafu
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/ 25

Advanced Computer

Networks
(CSE 5319)
Chapter-3
Routing Algorithm and Protocols
Routing Algorithm

• In order to transfer the packets from source to the destination, the network
layer must determine the best route through which packets can be transmitted.
• Whether the network layer provides datagram service or virtual circuit service,
the main job of the network layer is to provide the best route. The routing
protocol provides this job.
• The routing protocol is a routing algorithm that provides the best path from the
source to the destination. The best path is the path that has the "least-cost
path" from source to the destination.
• Routing is the process of forwarding the packets from source to the destination
but the best route to send the packets is determined by the routing algorithm.
Classification of a Routing algorithm
The Routing algorithm is divided into two categories:
•Adaptive Routing algorithm
•Non-adaptive Routing algorithm
Adaptive Routing algorithm
• An adaptive routing algorithm is also known as dynamic routing
algorithm.
• This algorithm makes the routing decisions based on the topology and
network traffic.
• The main parameters related to this algorithm are hop count, distance
and estimated transit time.
classified into three parts
• Centralized algorithm
• It is also known as global routing algorithm
• As it computers the least-cost path between source and destination by using complete and
global knowledge about the network.
• takes the connectivity between the nodes and link cost as input, and this information is
obtained before actually performing any calculation.

• Isolation algorithm
• It is an algorithm that obtains the routing information by using local information rather than
gathering information from other nodes.

• Distributed algorithm
• It is also known as decentralized algorithm
• as it computes the least-cost path between source and destination in an iterative and
distributed manner.
• node has the knowledge about the cost of all the network links
• A Distance vector algorithm is a decentralized algorithm as it never knows the complete path
from source to the destination
Non-Adaptive Routing algorithm
• Non Adaptive routing algorithm is also known as a static routing
algorithm.
• When booting up the network, the routing information stores to the
routers.
• Non Adaptive routing algorithms do not take the routing decision
based on the network topology or network traffic.
Classified into two types
• Flooding algorithm
• In case of flooding, every incoming packet is sent to all the outgoing links except the one
from it has been reached. The disadvantage of flooding is that node may contain several
copies of a particular packet.

• Random walks algorithm


• In case of random walks, a packet sent by the node to one of its neighbours randomly.
An advantage of using random walks is that it uses the alternative routes very efficiently.
Differences b/w Adaptive and
Non-Adaptive Routing Algorithm
Basis Of Comparison Adaptive Routing algorithm Non-Adaptive Routing algorithm

Define Adaptive Routing algorithm is an The Non-Adaptive Routing algorithm


algorithm that constructs the routing is an algorithm that constructs the
table based on the network static table to determine which node
conditions. to send the packet.

Usage Adaptive routing algorithm is used by The Non-Adaptive Routing algorithm


dynamic routing. is used by static routing.

Routing decision Routing decisions are made based on Routing decisions are the static
topology and network traffic. tables.

Categorization The types of adaptive routing The types of Non Adaptive routing
algorithm, are Centralized, isolation algorithm are flooding and random
and distributed algorithm. walks.

Complexity Adaptive Routing algorithms are Non-Adaptive Routing algorithms are


more complex. simple.
Distance Vector Routing
Algorithm
• Distributed
• It is distributed in that each node receives information from one or more of its directly
attached neighbours, performs calculation and then distributes the result back to its
neighbours.
• Iterative
• It is iterative in that its process continues until no more information is available to be
exchanged between neighbours.
• Asynchronous
• It does not require that all of its nodes operate in the lock step with each other.
• The Distance vector algorithm is a dynamic algorithm.
• It is mainly used in ARPANET, and RIP.(Advanced Research Projects Agency
Network- means including related links, information, and terms)
• Each router maintains a distance table known as Vector.
Three Keys for working DSR
• Knowledge about the whole network:
• Each router shares its knowledge through the entire network. The Router
sends its collected knowledge about the network to its neighbours.
• Routing only to neighbours:
• The router sends its knowledge about the network to only those routers
which have direct links. The router sends whatever it has about the network
through the ports. The information is received by the router and uses the
information to update its own routing table.
• Information sharing at regular intervals:
• Within 30 seconds, the router sends the information to the neighboring
routers.
• Let dx(y) be the cost of the least-cost path from node x to node y. The
least costs are related by Bellman-Ford equation,
• dx(y) = minv{c(x,v) + dv(y)}
• Where the minv is the equation taken for all x neighbors. After
traveling from x to v, if we consider the least-cost path from v to y, the
path cost will be c(x,v)+dv(y). The least cost from x to y is the
minimum of c(x,v)+dv(y) taken over all neighbors.
the node x contains the
following routing information:
• For each neighbor v, the cost c(x,v) is the path cost from x to directly
attached neighbor, v.
• The distance vector x, i.e., Dx = [ Dx(y) : y in N ], containing its cost to
all destinations, y, in N.
• The distance vector of each of its neighbors, i.e., Dv = [ Dv(y) : y in N ]
for each neighbor v of x.
Sharing the information
All the LANs are connected by routers, and they are represented in boxes
labeled as A, B, C, D, E, F.

Sharing Information
-DSR simplifies the routing process by assuming the cost of every link is one
unit. Therefore, the efficiency of transmission can be measured by the number
of links to reach the destination.
-In Distance vector routing, the cost is based on hop count.
Routing Table
• Two process occurs: Creating the Table and Updating the Table
• Creating the Table
• Initially, the routing table is created for each router that contains at least
three types of information such as Network ID, the cost and the next hop.

• NET ID: The Network ID defines the final destination of the packet.
• Cost: The cost is the number of hops that packet must take to get there.
• Next hop: It is the router to which the packet must be delivered.
In the below figure, the original routing tables are shown of all the routers. In a
routing table, the first column represents the network ID, the second column
represents the cost of the link, and the third column is empty.
These routing tables are sent to all the neighbours.
For Example:
• A sends its routing table to B, F & E.
• B sends its routing table to A & C.
• C sends its routing table to B & D.
• D sends its routing table to E & C.
• E sends its routing table to A & D.
• F sends its routing table to A.
Updating the Table
• When A receives a routing table from B, then it uses its information to
update the table.
• The routing table of B shows how the packets can move to the
networks 1 and 4.
• The B is a neighbor to the A router, the packets from A to B can reach
in one hop. So, 1 is added to all the costs given in the B's table and the
sum will be the cost to reach a particular network.
Final routing tables of all the
routers are given below:
Link State Routing
• Link state routing is a technique in which each router shares the knowledge of its
neighborhood with every other router in the internetwork.
• Three keys to understand the Link State Routing algorithm:
• Knowledge about the neighbourhood
• Instead of sending its routing table, a router sends the information about its neighborhood only.
A router broadcast its identities and cost of the directly attached links to other routers.
• Flooding
• Each router sends the information to every other router on the internetwork except its
neighbors. This process is known as Flooding. Every router that receives the packet sends the
copies to all its neighbors. Finally, each and every router receives a copy of the same information.
• Information sharing
• A router sends the information to every other router only when the change occurs in the
information.
It has two phases:
• Reliable Flooding
• Initial state: Each node knows the cost of its neighbors.
• Final state: Each node knows the entire graph.
• Route Calculation
• Each node uses Dijkstra's algorithm on the graph to calculate the optimal routes
to all nodes.
• The Link state routing algorithm is also known as Dijkstra's algorithm which is
used to find the shortest path from one node to every other node in the network.
• The Dijkstra's algorithm is an iterative, and it has the property that after
kth iteration of the algorithm, the least cost paths are well known for k destination
nodes.
Notations
• c( i , j): Link cost from node i to node j. If i and j nodes are not directly
linked, then c(i , j) = ∞.
• D(v): It defines the cost of the path from source code to destination v
that has the least cost currently.
• P(v): It defines the previous node (neighbor of v) along with current
least cost path from source to v.
• N: It is the total number of nodes available in the network.
Example
• Calculating shortest path from A to B
• v = B, w = D
• D(B) = min( D(B) , D(D) + c(D,B) )
• = min( 2, 1+2)>
• = min( 2, 3)
• The minimum value is 2. Therefore, the currently shortest path from A
to B is 2.
• Calculating shortest path from A to C
• v = C, w = D
• D(B) = min( D(C) , D(D) + c(D,C) )
• = min( 5, 1+3)
• = min( 5, 4)
• The minimum value is 4. Therefore, the currently shortest path from A to C is 4.</p>
• c) Calculating shortest path from A to E
• v = E, w = D
• D(B) = min( D(E) , D(D) + c(D,E) )
• = min( ∞, 1+1)
• = min(∞, 2)
• The minimum value is 2. Therefore, the currently shortest path from A to E is 2.

You might also like