CN unit-3
CN unit-3
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.
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.
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.
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.
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.