CN - Module 4 Part 1 2024
CN - Module 4 Part 1 2024
Dr. Jagadamba G
Dept. of ISE, Siddaganga Institute of Technology, Tumakuru
UNICAST ROUTING
20.1. Introduction
20.2 Routing Algorithms
20.3 Unicast Routing Protocols
INTRODUCTION
Intradomain Interdomain
• It is a protocol in which • It is the protocol in which
Routing algorithm works only Routing algorithm works within
within the domains (only in and between domains (among
autonomous network) autonomous network) .
• In interdomain routing • While in intradomain routing
Interior-gateway protocols such Exterior-gateway protocols such
as RIP(Resource/ Routing as BGP(Border Gateway
information protocol-Distance Protocol-Path Vector) are being
Vector) and OSPF(open shortest get used in case of IntraDomain
path first-Link sate) are being Routing.
used
INTRODUCTION
Distance-Vector Routing
• In distance-vector routing, each node creates a one
dimensional array (a vector) containing the distance(cost)
to all other nodes and distributes the same infor mation to
its immediate neighbors.
• We can say that in distance-vector routing, a router
continuously tells all of its neighbors what it knows
about the whole internet for every T seconds.
• Ever y routing table entries has: Destination,
Distance/cost, Next hop
Bellman-Ford Equation
Where Dij is the shortest distance and Cij is the cost between nodes i and j
https://www.youtube.com/watch?v=q72LA1pXoiU
Updating Distance Vectors
A B C D E F G
Each router prepares its routing table. By their local knowledge. each router
knows about-
•All the routers present in the network
•Distance to its neighboring routers
Step-02:
•Each router exchanges its distance vector with its neighboring routers.
•Each router prepares a new routing table using the distance vectors it has
obtained from its neighbors.
•This step is repeated for (n-2) times if there are n routers in the network.
•After this, routing tables converge / become stable.
Tutorial 4 : Exercises - Explanation for Distance Vectors step wise
Example: Consider-
• There is a network consisting of 4 routers.
• The weights are mentioned on the edges.
• Weights could be distances or costs or delays.
Step-01:
• Each router prepares its routing table using its local knowledge.
• Routing table prepared by each router is shown below-
Router A Router B
Destination Distance Next Hop Destination Distance Next Hop
A 0 A A 2 A
B 2 B B 0 B
C ∞ – C 3 C
D 1 D D 7 D
Router C Router D
Destination Distance Next Hop Destination Distance Next Hop
A ∞ – A 1 A
B 3 B B 7 B
C 0 C C 11 C
D 11 D D 0 D
Tutorial 4 : Exercises
Step-02:
• Each router exchanges its distance vector obtained in Step-01 with its neighbours.
• After exchanging the distance vectors, each router prepares a new routing table.
Router A
Router B
Destinati
Distance Next Hop
on
• Cost of reaching destination A from router B = min { 2+0 , 3+∞ , 7+1 } = 2 via A. A 2 A
• Cost of reaching destination C from router B = min { 2+∞ , 3+0 , 7+11 } = 3 via C. B 0 B
• Cost of reaching destination D from router B = min { 2+1 , 3+11 , 7+0 } = 3 via A. C 3 C
D 3 A
Tutorial 4 : Exercises
Step-02:
• Each router exchanges its distance vector obtained in Step-01 with its neighbours.
• After exchanging the distance vectors, each router prepares a new routing table.
Router C
Destinatio
Distance Next Hop
n
A 5 B
• Cost of reaching destination A from router C = min { 3+2 , 11+1 } = 5 via B. B 3 B
• Cost of reaching destination B from router C = min { 3+0 , 11+7 } = 3 via B.
C 0 C
• Cost of reaching destination D from router C = min { 3+7 , 11+0 } = 10 via B.
D 10 B
Tutorial 4 : Exercises
Step-02:
• Each router exchanges its distance vector obtained in Step-01 with its neighbours.
• After exchanging the distance vectors, each router prepares a new routing table.
Router D
Destinatio
Distance Next Hop
n
A 1 A
• Cost of reaching destination A from router D = min { 1+0 , 7+2 , 11+∞ } = 1 via A.
B 3 A
• Cost of reaching destination B from router D = min { 1+2 , 7+0 , 11+3 } = 3 via A.
• Cost of reaching destination C from router D = min { 1+∞ , 7+3 , 11+0 } = 10 via B. C 10 B
D 0 D
Tutorial 4 : Exercises
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.
Router A
Destinatio
Distance Next Hop
n
A 0 A
• Cost of reaching destination B from router A = min { 2+0 , 1+3 } = 2 via B. B 2 B
• Cost of reaching destination C from router A = min { 2+3 , 1+10 } = 5 via B. C 5 B
• Cost of reaching destination D from router A = min { 2+3 , 1+0 } = 1 via D.
D 1 D
Tutorial 4 : Exercises
Step-03:
• Each router exchanges its distance vector obtained in Step-02 with its neighbouring routers.
• After exchanging the distance vectors, each router prepares a new routing table.
Router B
Destinati Next
Distance
on Hop
A 2 A
• Cost of reaching destination A from router B = min { 2+0 , 3+5 , 3+1 } = 2 via A. B 0 B
• Cost of reaching destination C from router B = min { 2+5 , 3+0 , 3+10 } = 3 via C. C 3 C
• Cost of reaching destination D from router B = min { 2+1 , 3+10 , 3+0 } = 3 via A. D 3 A
Tutorial 4 : Exercises
Step-03:
• Each router exchanges its distance vector obtained in Step-02 with its neighbouring routers.
• After exchanging the distance vectors, each router prepares a new routing table.
Router C
A B C D E S
S
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] =∞
}
Distance-Vector Routing Algorithm
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) {
•Node A changes its table. If A can send its table to B immediately, everything is
fine.
•However, the system becomes unstable if B sends
its routing table to A before receiving A’s routing
table.
● Node B can still advertise the value for X, but if the source
of information is A, it can replace the distance with infinity
as a warning: “Do not use this value; what I know about
this route comes from you.”
23
Link-State 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.
● To create a least-cost tree with this method, each node needs
to have a complete map of the network, which is represented
using a Link-State Database (LSDB).
● The LSDB can be represented as a two-dimensional
array(matrix) in which the value of each cell defines the
cost of the corresponding link.
Link-State Database
Age/TTL
Example 3 (alternative representation of table)
1. Initially