Network Layer Routing Protocols
Network Layer Routing Protocols
Routing controls how data packets move from source to destination, ensuring efficient and reliable
delivery.
Desirable Properties of Routing Algorithms:-
• Correctness and Simplicity
• Robustness: Ability of the network to deliver packets via some route even in the face of
failures.
• Stability: The algorithm should converge to equilibrium fast in the face of changing
conditions in the network.
• Fairness and Optimality
• Efficiency: Minimum overhead.
Design Parameters of Routing Algorithms :
• Performance Criteria: Number of hops, Cost (Send packet with high bandwidth path as the
cost is less), Delay (Size of Queue), Throughput time (Number of packets delivered/time).
• Decision Time: When to decide to route a packet? Per-Packet (Datagram) or Per-session
(Virtual-Circuit).
• Decision Place: Who will decide about routing? Each Node(distributed), Central Node
(centralized), Originated Node (source).
• Network Information Source: None, Local, Adjacent node, Nodes along the route, All nodes.
• Network Information Update Time: Continuous, Periodic, Major Load Change, Topology
Change.
It can be done in the following two ways, static and dynamic routing.
1. Static Routing
Static Routing is also known as non-adaptive routing, which doesn't change the routing table unless
the network administrator changes or modifies it manually.
• It does not use complex routing algorithms.
• Provides higher or more security than dynamic routing.
Advantages
• Automatic Route Updates: Routes are updated automatically when network topology
changes
• Efficient Path Selection: Chooses the best available path using metrics like hop count, cost,
or delay
• Scalability: Suitable for large and complex networks with multiple routers
• Reduced Manual Configuration: Eliminates the need to manually configure and update
routes
• Fault Tolerance: Automatically reroutes traffic if a link or router fails
Prepared by Mrs. Vaishali Savale
Artificial Intelligence and Data Science Department
Disadvantages
• Higher Bandwidth Usage: Consumes bandwidth for exchanging routing information
between routers
• Less Secure: Vulnerable to attacks if routing updates are not properly secured
• Complex Configuration: Requires understanding of routing protocols and proper setup
• Slower Convergence: Takes time to update routes after a network change
• Resource Intensive: Uses more CPU and memory compared to static routing
Static vs Dynamic Routing
Routes are manually configured by the Routes are automatically updated based on network
administrator changes
Does not use routing algorithms Uses routing protocols and algorithms
More secure (no automatic updates) Less secure if not properly configured
Suitable for small networks Suitable for large and complex networks
Requires less bandwidth and resources Requires more bandwidth and processing power
No automatic rerouting on failure Automatically adapts to network failures
It need to know only about other routers within It need to know only about other routers within
their domain. and between their domain.
Protocols used in intradomain routing are Protocols used in interdomain routing are known
known as Interior-gateway protocols. as Exterior-gateway protocols.
In this Routing, routing takes place within an In this Routing, routing takes place between the
autonomous network. autonomous networks.
Intradomain routing protocols ignores the Interdomain routing protocol assumes that the
internet outside the AS(autonomous system). internet contains the collection of interconnected
AS(autonomous systems).
Some Popular Protocols of this routing are Popular Protocols of this routing is BGP(Border
RIP(routing information protocol) and Gateway Protocol) used to connect two or more
OSPF(open shortest path first). AS(autonomous system).
In between sending and receiving data packets from the sender to the receiver, it will go through many
routers and subnets. So as a part of increasing the efficiency in routing the data packets and decreasing
the traffic, we must find the shortest path. In this article, we are discussing the shortest path
algorithms.
What is Shortest Path Routing?
It refers to the algorithms that help to find the shortest path between a sender and receiver for routing
the data packets through the network in terms of shortest distance, minimum cost, and minimum time.
• It is mainly for building a graph or subnet containing routers as nodes and edges as
communication lines connecting the nodes.
• Hop count is one of the parameters that is used to measure the distance.
Prepared by Mrs. Vaishali Savale
Artificial Intelligence and Data Science Department
• Hop count: It is the number that indicates how many routers are covered. If the hop count is
6, there are 6 routers/nodes and the edges connecting them.
• Another metric is a geographic distance like kilometers.
• We can find the label on the arc as the function of bandwidth, average traffic, distance,
communication cost, measured delay, mean queue length, etc.
Common Shortest Path Algorithms
• Dijkstra’s Algorithm
• Bellman Ford’s Algorithm
• Floyd Warshall’s Algorithm
Dijkstra’s Algorithm
The Dijkstra’s Algorithm is a greedy algorithm that is used to find the minimum distance
between a node and all other nodes in a given graph. Here we can consider node as a router
and graph as a network. It uses weight of edge .ie, distance between the nodes to find a
minimum distance route.
Algorithm:
• Initialize:
Set distance of source = 0, all others = ∞.
Mark all nodes unvisited.
Set predecessor of each node = null.
• Select Current Node:
Among all unvisited nodes, choose the node with the smallest current distance.
• Update Neighbors:
For each unvisited neighbor N of the current node:
• Compute:
newDist = distance[current] + weight(current, N)
• If newDist < distance[N] then:
o Update distance[N] = newDist
o Update predecessor[N] = current
• Mark Visited:
Mark the current node as visited (it will never be checked again).
• Repeat:
If unvisited nodes still exist, go back to Step 2.
• End:
Distances now contain shortest path costs; predecessors can be used to reconstruct paths.
Graph G
Now, we will start normalising graph one by one starting from node 0.
step 1
Nearest neighbour of 0 are 2 and 1 so we will normalize them first .
Similarly we will normalize other node considering it should not form a cycle and will keep track in
visited nodes.
Step-01:
Each router prepares its routing table using its local knowledge.
Routing table prepared by each router is shown below-
At Router A-
Destination Distance Next Hop
A 0 A
B 2 B
C ∞ –
D 1 D
At Router B-
A 2 A
B 0 B
C 3 C
D 7 D
At Router C-
B 3 B
C 0 C
D 11 D
A 1 A
B 7 B
C 11 C
D 0 D
Step-02:
• Each router exchanges its distance vector obtained in Step-01 with its neighbors.
• After exchanging the distance vectors, each router prepares a new routing table.
This is shown below-
At Router A-
• Router A receives distance vectors from its neighbors B and D.
• Router A prepares a new routing table as-
• Router A can reach the destination router B via its neighbor B or neighbor D.
• It chooses the path which gives the minimum cost.
• Cost of reaching router B from router A via neighbor B = Cost (A→B) + Cost (B→B)= 2 + 0 = 2
• Cost of reaching router B from router A via neighbor D = Cost (A→D) + Cost (D→B) = 1 + 7 = 8
• Since the cost is minimum via neighbor B, so router A chooses the path via B.
• It creates an entry (2, B) for destination B in its new routing table.
• Similarly, we calculate the shortest path distance to each destination router at every router.
A 0 A
B 2 B
C 5 B
D 1 D
At Router B-
• Router B receives distance vectors from its neighbors A, C and D.
• Router B prepares a new routing table as-
• Cost of reaching destination A from router B = min { 2+0 , 3+∞ , 7+1 } = 2 via A.
• Cost of reaching destination C from router B = min { 2+∞ , 3+0 , 7+11 } = 3 via C.
• Cost of reaching destination D from router B = min { 2+1 , 3+11 , 7+0 } = 3 via A.
Thus, the new routing table at router B is-
A 2 A
B 0 B
C 3 C
D 3 A
At Router C-
• Router C receives distance vectors from its neighbors B and D.
• Router C prepares a new routing table as-
A 5 B
B 3 B
C 0 C
D 10 B
At Router D-
• Router D receives distance vectors from its neighbors A, B and C.
• Router D prepares a new routing table as-
A 1 A
B 3 A
C 10 B
D 0 D
Step-03:
• Each router exchanges its distance vector obtained in Step-02 with its neighboring routers.
• After exchanging the distance vectors, each router prepares a new routing table.
This is shown below-
At Router A-
• Router A receives distance vectors from its neighbors B and D.
• Router A prepares a new routing table as-
At Router B-
• Cost of reaching destination A from router B = min { 2+0 , 3+5 , 3+1 } = 2 via A.
• Cost of reaching destination C from router B = min { 2+5 , 3+0 , 3+10 } = 3 via C.
• Cost of reaching destination D from router B = min { 2+1 , 3+10 , 3+0 } = 3 via A.
At Router C-
Prepared by Mrs. Vaishali Savale
Artificial Intelligence and Data Science Department
• Router C receives distance vectors from its neighbors B and D.
• Router C prepares a new routing table as-
At Router D-
• Cost of reaching destination A from router D = min { 1+0 , 3+2 , 10+5 } = 1 via A.
• Cost of reaching destination B from router D = min { 1+2 , 3+0 , 10+3 } = 3 via A.
• Cost of reaching destination C from router D = min { 1+5 , 3+3 , 10+0 } = 6 via A.
Routing is a process of establishing the routes that data packets must follow to reach the destination. In
this process, a routing table is created, which contains the information regarding routes that data packets
follow. Now, various routing algorithms are there which are used to decide the best optimal route that
the incoming data packet must be transmitted.
The best or optimal path is the path from the source to the destination router, having the least connection
cost. For example, refer to the routers shown in the image below.
2. It can also go from Router-1 to Router-2, via path: Router-1 --> Router-3 --> Router-2. The cost
of this traveling is (2 + 3) = 5.
So, the data packet will be sent from the second path i.e. Router-1 --> Router-3 --> Router-2.
The Link State Routing Algorithm is an interior protocol used by every router to share information or
knowledge about the rest of the routers on the network. The link state routing algorithm is distributed
by which every router computes its routing table.
With the knowledge of the network topology, a router can make its routing table. Now, for developing
the routing table, a router uses a shortest path computation algorithm like Dijkstra's algorithm along
with the knowledge of the topology. The routing table created by each router is exchanged with the rest
of the routers present in the network, which helps in faster and more reliable delivery of data.
A router does not send its entire routing table with the rest of the routers in the inter-network. It only
sends the information of its neighbors. A router broadcasts this information and contains information
about all of its directly connected routers and the connection cost.
Now, the process of transferring the information about a router's neighbors is termed flooding. A router
transfers the information to all the inter-network routers except its neighbors. Every router that receives
the information sends the information copies to all its neighbors. In this way, all the routers of the inter-
connected network have the same copy of the information.
This information exchange only occurs when there is a change in the information. Hence, the link state
routing algorithm is effective. Refer to the image below for the basic overview of the router and updation
done by the link state routing algorithm.
• OSPF or Open Shortest Path First is a routing protocol that uses the link state routing algorithm
to exchange information (about neighbouring routers, cost of the route, etc.) among the inter-
network routers.
• The OLSR or Optimized Link State Routing Protocol is an optimized link state routing
protocol that is used in mobile ad hoc networks and wireless ad hoc networks. The OLSR sends
a hello message to identify the connected neighboring routers and the connection cost. Along
with the hello message, it also uses the Topology Control messages.
Prepared by Mrs. Vaishali Savale
Artificial Intelligence and Data Science Department
RIP (Routing Information Protocol): RIP is a Distance Vector routing protocol that employs hop
count as its metric. It is suitable for small networks or networks with simple topologies. However, its
slow convergence and lack of support for advanced features limit its usage in larger networks. An
example of a use case for RIP is a small office network with a single router connecting multiple subnets.
OSPF (Open Shortest Path First): OSPF is a Link-State routing protocol that calculates the shortest
path based on cost, typically determined by bandwidth. It offers fast convergence, scalability, and
supports advanced features such as VLSM and authentication. OSPF is commonly used in enterprise
networks with multiple routers and diverse topologies. For instance, a university campus network with
multiple interconnected buildings and subnets can benefit from OSPF.
EIGRP (Enhanced Interior Gateway Routing Protocol): EIGRP is an Advanced Distance Vector
protocol developed by Cisco. It combines the best aspects of Distance Vector and Link-State protocols,
providing fast convergence, scalability, and advanced features like load balancing and route
summarization. EIGRP is often deployed in medium to large networks with multiple routers. A typical
example is a corporate network with multiple branch offices interconnected via routers using EIGRP.
RIP is a distance OSPF is a link state IGRP is a distance vector EIGRP Is derived from
vector protocol protocol protocol Integrated Gateway
Routing Protocol
The metrics used The metrics used are The metrics used are The metrics used are
Is hop. bandwidth and delay. bandwidth, load, delay, MTU, bandwidth, delay, load
and reliability. and reliability
RIP uses Distance OSPF uses the SPF IGRP uses the distance vector EIGRP uses Diffusing
vector algorithm to algorithm to calculate algorithm to calculate the best update algorithm to
calculate the best the best path. path and the variance calculate the best path.
path mechanism to support
unequal-cost load balancing.
In RIP, networks are Routing with OSPF is IGRP does not support areas Routing with EIGRP is
not divided into done in Autonomous or tables but supports multi- done in Neighbour
areas or tables. System, Areas, Stub part routing. Tables, Topology
Areas and Backbone tables, and Routing
areas. tables.
Route
Route Summarization is Route Summarization is Route Summarization is
Summarization is
Automatic Automatic Automatic
Manual