0% found this document useful (0 votes)
11 views39 pages

CN 1

Uploaded by

Thrisha K B Babu
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)
11 views39 pages

CN 1

Uploaded by

Thrisha K B Babu
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/ 39

Routing

Algorithm
Distance Vector
Routing
Link State Routing
Path Vector Routing Presented By
Trishika Shrivastav
Thrisha K.B
Shraddha N
Sanchitha Sosale
Dhanyatha M
Routing Protocol
•Routing is the process of determining the best path for data
packets to travel across a network.
•Routing protocols enable routers to exchange information
and determine optimal paths.
Distance Vector Routing
Overview
● Distance Vector Routing (DVR) Protocol is a method used by
routers to find the best path for data to travel across a network.
● Each router keeps a table that shows the shortest distance to
every other router, based on the number of hops (or steps)
needed to reach them.
● Routers share this information with their neighbors, allowing them
to update their tables and find the most efficient routes.

• How it Works:
• Routers initialize their distance vectors based on direct connections.
• Periodically, routers send their distance vectors to neighbors.
• Routers update their tables based on new information, selecting the shortest
paths.
● This routing algorithm is known as Bellman-Ford Algorithm
Bellman-Ford Algorithm –
Introduction
• Purpose:
The Bellman-Ford algorithm is used to calculate the shortest paths in Distance
Vector Routing. It is an iterative algorithm used to update the routing tables.
• Key Concept:
• Routers calculate the shortest path to each destination based on the distance
vectors received from neighboring routers.
• The algorithm converges when no further updates occur.
• Bellman-Ford Equation:
Di(j)=min⁡(Di(k)+C(k,j))
Where:
• Di(j): The shortest distance from router i to destination j.

• Di(k): The shortest distance from router i to router k.


• C(k,j): The cost (or distance) from router k to destination j.
Example of Bellman-Ford
Algorithm
• Initial Setup: Consider 3 routers: A, B, and C.
• Their initial distance tables are as follows:
• Router A: [A: 0, B: 2, C: ∞]
• Router B: [A: 2, B: 0, C: 1]
• Router C: [A: ∞, B: 1, C: 0]

• Step-by-Step Process:
• Router A sends its vector to Router B and Router C.
• Router B receives this information and updates its table (it learns that router
A has a direct path to C with cost ∞).
• Router C sends its distance vector back to Router A and Router B.
• Continue this process until all tables stabilize.

• Final Tables (after convergence):


• Router A: [A: 0, B: 2, C: 3]
• Router B: [A: 2, B: 0, C: 1]
• Router C: [A: 3, B: 1, C: 0]
Graphical idea behind Bellman-Form
equation
Distance Vectors
What Are Distance Vectors?
● A distance vector is a data structure (a one-dimensional array) used in
distance-vector routing to represent the costs of reaching various nodes in a
network.
● Purpose: Helps in routing decisions by indicating the least-cost path from the
source (root) node to all other destinations in the network.
Distance Vectors
● A least-cost tree shows all least-cost paths graphically from a root to every
destination in the network.
● Distance-vector routing simplifies this structure:
● It "unglues" the graphical tree and creates a one-dimensional array (the
distance vector) representing the least costs.
Distance Vectors
● Key elements of the distance vector:
○ Name: Indicates the root node (e.g., node A).
○ Indexes: Represent destination nodes (e.g., B, C, D, etc.).
○ Values: Show the least cost from the root to each destination.
● A distance vector only provides the least cost to each destination.
Example: From node A, the cost to node B is 2, but it does not show the
actual path (A → B) to reach B.
Distance
Vectors
Initial Creation of Distance Vectors
● When a node boots up in the network:
1. It creates a initial distance vector with minimal information.
2. Sends greeting messages through its interfaces to:
■ Discover its immediate neighbors.
■ Measure the distance (cost) to each neighbor.
3. Builds its initial vector:
■ Cost to neighbors: Insert actual distances.
■ Cost to other nodes: Mark as infinity (unknown).
● Example: If node A doesn’t directly connect to node G, its cost to G is
initially set to infinity.
Initial vectors are incomplete because they only show direct neighbors.
Example:
● Node A assumes it is not connected to G because the cost to G is infinity.

Solution: Nodes exchange their vectors to learn about routes beyond immediate
neighbors.
Distance
Vectors
How Nodes Improve Distance Vectors
● Step 1: Each node sends its distance vector to all immediate neighbors.
● Step 2: Upon receiving a neighbor’s vector, the node updates its own vector
using the Bellman-Ford equation:

● Process: Each node calculates if the path through a neighbor is cheaper than its
current known path.
Updating Distance Vectors

In the first event, node A has sent its vector to node B. Node B updates its vector
using the cost cBA = 2.
In the second event, node E has sent its vector to node B. Node B updates its
vector using the cost cEA = 4.
How Node B Updates Its Vector:
● Node B calculates if it can reach any destination more cheaply via A.
● Using the Bellman-Ford equation:
Distance
Vectors
● Exchanging vectors eventually stabilizes the system and
allows all nodes to find the ultimate least cost between
themselves and any other node.
● We need to remember that after updating a node, it
immediately sends its updated vector to all neighbors.
● Even if its neighbors have received the previous vector, the
updated one may help more.
Distance Vector Routing
Algorithm
Distance Vector Routing
Algorithm

● The Distance Vector Routing (DVR) algorithm is a routing


protocol used in computer networks that enables nodes (or routers)
to determine the shortest path to all other nodes in the network. It
is based on the principle of distributed computation, where each
node independently computes its routing table by sharing and
receiving routing information (distance vectors) with/from its
immediate neighbors. Over time, the algorithm converges to
produce the shortest paths for all nodes.
Key terms:
1. Nodes and Links
● The algorithm operates on a network of nodes (e.g., routers or devices) connected
by links. Each link has an associated cost (e.g., distance, latency, or bandwidth
usage), which influences routing decisions.

2. Shortest Path
● The primary goal of the DVR algorithm is to calculate the shortest path (in terms of
link cost) from the current node to every other node in the network.

3. Distance Vector
● Each node maintains a distance vector, which is essentially a table with:
● The cost (distance) to every other node in the network.
● The next hop (neighbor) to reach each destination.
4. Information Sharing
● Nodes exchange their distance vectors with their immediate neighbors. This
exchange helps them learn about the network's topology and update their routing
tables.

5. Convergence
● As nodes exchange information and update their routing tables, the network
gradually reaches a state of convergence, where all nodes have consistent and
correct information about the shortest paths.
1.Initialization process

2. Update process
Receive a vector (Dw[]) from a neighbor (w):

This vector contains the neighbor’s current


shortest distances to all nodes.
Calculate new distances: For each node y in
the network:
D[y]=min⁡(D[y], c[myself][w]+Dw[y])D[y] = \
min \big(D[y], \ c[myself][w] + Dw[y] \
big)D[y]=min(D[y], c[myself][w]+Dw[y])

D[y]D[y]D[y]:Current shortest distance to


node y.

c[myself][w]c[myself][w]c[myself][w]: Cost of
the link between the current node and
neighbor w.

Dw[y]Dw[y]Dw[y]: Distance from neighbor w


to node y.
1.The count-to-infinity problem in distance-vector routing happens when there's a
link failure (like a broken connection) in a network.
Why does this happen?
● When a link breaks, a router doesn’t immediately know that the destination is
unreachable. Instead, it might mistakenly believe that a neighbor still has a valid path
to the destination. The routers keep updating each other with incorrect information,
gradually increasing the cost for the broken link, step by step, until it reaches infinity.

SOLUTION
● The Split Horizon strategy is a method used to prevent the count-to-infinity
problem by stopping a router from advertising routes back to the neighbor from
which it learned them.
● How Split Horizon Works
● Each router sends a table of routes (distances to various destinations) to its
neighbors.
● If a router learns about a route to a destination from a specific neighbor, it will not
advertise that route back to the same neighbor.
○ The assumption is that the neighbor already knows about the route since it
provided the information in the first place.
● The Poison Reverse strategy builds on the Split Horizon technique
to address its limitation by adding clarity to routing updates. Instead of
simply omitting information (as in Split Horizon), a router explicitly
advertises the route with a distance of infinity to indicate that the route
is invalid. How Poison Reverse Works
● When a router learns about a route to a destination XXX from a
neighbor, it doesn't just stop advertising this route back to the same
neighbor (as in Split Horizon).
● Instead, it explicitly advertises the route with a distance of
infinity to that neighbor.
○ This tells the neighbor:
"I learned about XXX from you, and now I’m marking it as
unreachable because you are the source of this route."
2.The two-node loop problem is a specific case of the count-to-infinity problem
where two routers (A and B) mistakenly rely on each other for a path to a destination that
has become unreachable.
Why is This a Problem?
● During this process, A thinks the route to XXX is through B, and B thinks the route to
XXX is through A.
● If a packet destined for XXX arrives at A, it forwards it to B. B then sends it back to A,
creating a routing loop.
● The packet bounces betweenA and B, consuming network resources unnecessarily.

Three-Node Instability
● Even though the Split Horizon and Poison Reverse strategies work well to prevent
instability between two nodes (like in the two-node loop problem), they fall short when
more nodes are involved. This scenario is called three-node instability, and it occurs
when three routers form a loop while trying to update their routes after a link failure.
Link state
Link state
Routing
Routing
Link-State Routing
● Link-state (LS) routing algorithm is used to create least-cost trees
and forwarding tables

● This method uses the term link-state to define the characteristic of


a link (an edge) that represents a network in the internet.

● 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.
Link-State Database (LSDB)
● To create a least-cost tree with this method, each node needs to have a
complete map of the network, which means it needs to know the state
of each link.
● The collection of states for all links is called the link-state database
(LSDB). There is only one LSDB for the whole internet; each node needs
to have a duplicate of it to be able to create the least-cost tree.
How each node can create this LSDB ?
● This can be done by a process called flooding. Each node can send
some greeting messages to all its immediate neighbors to collect two
pieces of information for each neighboring node: the identity of the
node and the cost of the link. The combination of these two pieces of
information is called the LS .

● When a node receives an LSP from one of its interfaces, it compares


the LSP with the copy it may already have. If the newly arrived LSP is
older than the one it has it discards the LSP. If it is newer or the first
one received, the node discards the old LSP and keeps the received
one.

● It then sends a copy of it out of each interface except the one from
which the packet arrived. This guarantees that flooding stops
How each node can create this LSDB ?
Formation of Least-Cost Trees
● To create a least-cost tree for itself, using the shared LSDB, each node
needs to run Dijkstra Algorithm.
This iterative algorithm uses the following steps:
1. The node chooses itself as the root of the tree, creating a tree with a
single node, and sets the total cost of each node based on the
information in the LSDB.

2. The node selects one node, among all nodes not in the tree, which is
closest to the root, and adds this to the tree. After this node is added to
the tree, the cost of all other nodes not in the tree needs to be updated
because the paths may have been changed.

3. The node repeats step 2 until all nodes are added to the tree.
Path vector
Path vector
routing
routing
Why do we need path vector routing?
● Least-cost routing does not prevent a packet from passing
through an area when that area is in the least-cost path.
● In other words, the least-cost goal, applied by LS or DV
routing, does not allow a sender to apply specific policies to
the route a packet may take.
● Aside from safety and security, there are occasions, as
discussed in the next section, in which the goal of routing is
merely reachability: to allow the packet to reach its destination
more efficiently without assigning costs to the route.
● To respond to these demands, a third routing algorithm, called
path-vector (PV) routing has been devised.
Path vector routing
● Path Vector Routing is a routing algorithm in unicast routing
protocol of network layer, and it is useful for interdomain
routing.
● The principle of path vector routing is similar to that of distance
vector routing. It assumes that there is one node in each
autonomous system that acts on behalf of the entire
autonomous system is called Speaker node .
● The speaker node in an AS creates a routing cable and
advertises to the speaker node
in the neighbouring ASs
● A speaker node advertises the path, not the metrics of the
nodes, in its autonomous system or other autonomous systems
Spanning Tree
● In path-vector routing, the path from a source to all destinations is also determined by
the best spanning tree. The best spanning tree, however, is not the least-cost tree; it is
the tree determined by the source when it imposes its own policy.
● The policy imposed by all sources is to use the minimum number of nodes to reach a
destination. The spanning tree selected by A and E is such that the communication
does not pass through D as a middle node. Similarly, the spanning tree selected by B
is such that the communication does not pass through C as a middle node .
Creation of spanning tree
Path(x, y) = best {Path(x, y), [(x + Path(v, y)]} for all v’s in the
internet.
● In this equation, the operator (+) means to add x to the beginning of
the path. We also need to be cautious to avoid adding a node to an
empty path because an empty path means one that does not exist.
● The policy is defined by selecting the best of multiple paths. Path-
vector routing also imposes one more condition on this equation: If
Path (v, y) includes x, that path is discarded to avoid a loop in the
path. In other words, x does not want to visit itself when it selects a
path to y.
Creation of spanning tree
Creation of spanning tree
Algorithm
Thank you!
Thank you!

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy