0% found this document useful (0 votes)
9 views9 pages

CN unit-3

Routing is the process of selecting the best path for data packets in a network, performed by routers using routing algorithms to determine efficient routes. These algorithms are categorized into adaptive (dynamic) and non-adaptive (static) routing, with techniques like flooding and distance vector routing. Hierarchical routing further optimizes large networks by organizing routers into regions to reduce memory usage and improve efficiency.

Uploaded by

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

CN unit-3

Routing is the process of selecting the best path for data packets in a network, performed by routers using routing algorithms to determine efficient routes. These algorithms are categorized into adaptive (dynamic) and non-adaptive (static) routing, with techniques like flooding and distance vector routing. Hierarchical routing further optimizes large networks by organizing routers into regions to reduce memory usage and improve efficiency.

Uploaded by

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

What is Routing?

Routing is the process of selecting the best path for data packets to travel from a source to a
destination in a network. It is performed by network devices called routers, which analyze
network conditions to determine the most efficient route for data transmission.

Routing Algorithms
Routing algorithms help the network layer decide the best path to send packets from source to
destination. The goal is to find the least-cost path, ensuring efficient data transfer.

Types of Routing Algorithms


Routing algorithms are divided into two main categories:
1. Adaptive (Dynamic) Routing
2. Non-Adaptive (Static) Routing

1. Adaptive (Dynamic) Routing


 Adjusts routing decisions based on network conditions (traffic, topology).
 Uses hop count, distance, and transit time to determine the best route.
 Further classified into:
a) Centralized Algorithm (Global Routing)
 Uses complete knowledge of the network.
 Computes the shortest path before making routing decisions.
 Example: Link State Algorithm.
b) Isolation Algorithm
 Uses only local information (does not rely on other nodes).
c) Distributed Algorithm (Decentralized Routing)
 No node knows the full network path, only its direct connections.
 Uses an iterative process to compute the shortest path.
 Example: Distance Vector Algorithm.

2. Non-Adaptive (Static) Routing


 Routing decisions are pre-defined when the network starts.
 Does not adjust based on network conditions.
 Two types:
a) Flooding
 Every packet is sent to all possible paths except the one it came from.
 Disadvantage: Creates multiple copies of the same packet, increasing network load.
b) Random Walks
 A packet is sent randomly to one of its neighboring nodes.
 Advantage: Utilizes different paths efficiently.

Shortest path routing :

It is one of the simple static routing algorithms that widely used for routing in
the network.
The basic idea is to build a graph with each node representing a router and each
line representing a communication link. To choose a route between any two
nodes in the graph, the algorithm finds the shortest path between the nodes.
common shortest path algorithm is Dijkstra Algorithm
Given a network topology and a set of weights describing the cost to send
data across
each link in the network
Find the shortest path from a specified source to all other destinations in
the network.

Shortest path algorithm first developed by E. W. Dijkstra’s


a. Mark the source node as permanent.
b. Designate the source node as the working node.
c. Set the tentative distance to all other nodes to infinity.
d. While some nodes are not marked permanent
Compute the tentative distance from the source to all nodes adjacent to the working
node. If this is shorter than the current tentative distance replace the tentative distance
of the destination and record the label of the working node there.
Flooding routing algorithm
Flooding is a non-adaptive routing technique following this simple method: when a
data packet arrives at a router, it is sent to all the outgoing links except the one it has
arrived on.
For example, let us consider the network in the figure, having six routers that are
connected through transmission lines.

Using flooding technique −


An incoming packet to A, will be sent to B, C and D.
B will send the packet to C and E.
C will send the packet to B, D and F.
D will send the packet to C and F.
E will send the packet to F.
F will send the packet to C and E.
Types of Flooding
Flooding may be of three types −
Uncontrolled flooding − Here, each router unconditionally transmits the incoming data
packets to all its neighbours.
Controlled flooding − They use some methods to control the transmission of packets to the
neighbouring nodes. The two popular algorithms for controlled flooding are Sequence
Number Controlled Flooding (SNCF) and Reverse Path Forwarding (RPF).
Selective flooding − Here, the routers don't transmit the incoming packets only along those
paths which are heading towards approximately in the right direction, instead of every
available paths.
Advantages of Flooding
 It is very simple to setup and implement, since a router may know only its
neighbours.
 It is extremely robust. Even in case of malfunctioning of a large number routers, the
packets find a way to reach the destination.
 All nodes which are directly or indirectly connected or visited. So, there are no
chances for any node to be left out. This is a main criteria in case of broadcast
messages.
 The shortest path is always chosen by flooding.
Disadvantages
 Flooding generates a vast number of duplicate packets
 Suitable damping mechanism must be used

Hop-Count
A hop counter is a value in the packet header that decreases by 1 each time the packet passes
through a router (a "hop"). If the counter reaches zero, the packet is discarded.
 Initialization: The sender sets the hop counter to a value that represents the maximum
possible number of hops (if no specific estimate is available).
 Purpose: The hop counter prevents packets from circulating forever in the network in case
of routing errors.
sequence number
Keep track of the packets which are responsible for flooding using a sequence number.
Avoid sending them out a second time.

What is Hierarchical Routing?


Hierarchical routing is a technique used in large networks to manage routing efficiently by dividing
routers into regions. Instead of storing detailed routing information about every router, each router
only keeps data about its own region and a summary of other regions.
 Routers are grouped into regions, reducing the size of routing tables.
 A router knows how to send packets within its own region but does not store details of
other regions.
 This method helps reduce memory usage and processing load on routers.

How It Works?
 Each router stores one entry per region instead of keeping details of all routers.
 For very large networks, multiple hierarchy levels can be used:
 Regions → Clusters → Zones → Groups, and so on.
 A gateway router connects different regions and helps forward packets.

Advantages of Hierarchical Routing


 Scalability – Works well as the network grows.
 Reduced memory usage – Routers store less information.
 Improved efficiency – Less processing power is needed to handle routing.
Example
Consider an example of two-level hierarchy with five regions as shown in figure −

Explanation
Step 1 − For example, the best path from 1A to 5C is via region 2, but hierarchical routing
of all traffic to region 5 goes via region 3 as it is better for most of the other destinations of
region 5.
Step 2 − Consider a subnet of 720 routers. If no hierarchy is used, each router will have 720
entries in its routing table.
Step 3 − Now if the subnet is partitioned into 24 regions of 30 routers each, then each router
will require 30 local entries and 23 remote entries for a total of 53 entries.
Distance Vector Routing (DV)
Distance Vector Routing is a dynamic routing algorithm used to find the shortest path between
routers in a network. It is more efficient than simple flooding because it calculates the best route
based on network topology.

How It Works
1. Each router maintains a table (vector) with the shortest known distance to each
destination.
2. Routers exchange their tables with their immediate neighbors.
3. Each router updates its table based on the new information received.
4. Eventually, all routers learn the best route to every destination.

Key Features
 Uses the Bellman-Ford algorithm to calculate the shortest path.
 Dynamic & distributed – each router updates its own table independently.
 Iterative & asynchronous – updates happen continuously and at different times.
 Mainly used in ARPANET and the Internet.

Bellman-Ford Equation for Distance Calculation


dx(y)=min⁡v{c(x,v)+dv(y)}d_x(y) = \min_v \{c(x,v) + d_v(y)\}
Where:
 x = Source node
 y = Destination node
 v = Neighboring (intermediate) node
 c(x,v) = Cost from x to v
 d_v(y) = Shortest known distance from v to y

How Distance Vector Routing Updates Work


1. Each router sends its distance vector to its neighbors.
2. Each router receives and stores updated vectors from neighbors.
3. A router recalculates its distance vector when:
 A neighbor’s table changes.
 A network link fails (topology change).
Example:

You might also like