Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
13 views

Routing Algo

The document discusses different routing algorithms used in computer networks. It describes how packets are routed hop-by-hop from source to destination using forwarding tables. It then explains different categories and types of routing algorithms, including static and adaptive algorithms.

Uploaded by

avantika bisht
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Routing Algo

The document discusses different routing algorithms used in computer networks. It describes how packets are routed hop-by-hop from source to destination using forwarding tables. It then explains different categories and types of routing algorithms, including static and adaptive algorithms.

Uploaded by

avantika bisht
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

Routing

Routing

In routing, a packet is routed, hop by hop, from its


source to its destination by the help of forwarding
tables. The source host needs no forwarding table
because it delivers its packet to the default router in
its local network. The destination host needs no
forwarding table either because it receives the packet
from its default router in its local network. This
means that only the routers that glue together the
networks in the internet need forwarding tables.
Routing Algorithm Categories
■ Unicast
■ Multicast
■ Broadcast
Types of Routing Algorithms
■ Nonadaptive (static)
■ Do not use measurements of current conditions
■ Static routes are downloaded at boot time
■ Adaptive Algorithms (Runtime)
■ Change routes dynamically
■ Gather information at runtime
■ locally
■ from adjacent routers
■ from all other routers
■ Change routes
■ Every delta T seconds
■ When load changes
■ When topology changes
Adaptive Routing - Challenges
■ Complex routing decisions
■ Router processing increases
■ Depends on information collected in one place but
used in another
■ More information exchange improves routing decisions,
but increases overhead
■ May react too fast
■ causing congestion through oscillation (fluttering)
■ May react too slow
■ By the time routing decision changes, the network
conditions may be much more different
Adaptive Routing - Challenges

■ Looping
■ Packet forwarded by a router eventually returns to the same
router
■ May occur when changes in connectivity are not
propagated fast enough to all other routers
■ An important pathology that must be prevented in routing
algorithms

■ Despite all challenges, adaptive routing prevails due


to its flexibility
ROUTING ALGORITHMS

Several routing algorithms have been designed in


the past. The differences between these methods
are in the way they interpret the least cost and the
way they create the least-cost tree for each node.
Optimality Principle

■ If router J is on the optimal path from


router I to router K, then the optimal path
form J to K also falls along the same
(optimal path) route.
Routing algorithms

■ Optimality principle Optimal path from I to K over J

I● distance
● K
d1
d2
d1 + d2 is
J ●
d3 minimal
Other path from J to
K d3 > d2
Set of all optimal routes as
• from all sources d1 + d3 > d1 + d2
• to a given destination
is a tree: sink tree
Sink Trees
■ The set of optimal routes to a particular node
forms a sink tree.
■ Sink trees are not necessarily unique
■ Goal of all routing algorithms
■ Discover sink trees for all destinations
Least-Cost Routing

When an internet is modeled as a weighted graph,


one of the ways to interpret the best route from the
source router to the destination router is to find the
least cost between the two. In other words, the
source router chooses a route to the destination
router in such a way that the total cost for the route
is the least cost among all possible routes.
An internet and its graphical representation
Least-cost trees for nodes in the internet
Dijkstra Shortest Path Routing
(a nonadaptive routing 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
Dijkstra’s Algorithm
Finding Shortest path using Dijkstra Algo
Flooding

■ No network info required


■ Packet sent by node to every neighbor
■ Incoming packets retransmitted on every link except incoming
link
■ Eventually a number of copies will arrive at destination
■ Each packet is uniquely numbered so duplicates can be
discarded at destination
Flooding
Example
Flooding- Improvements
■ Precautions against unlimited grow in circulation
■ Selective flooding

■ Include a hop count in packets.

■ Set to a maximum value

■ Decrease one at each hop

■ Discard when 0

■ Sequence number in packet

Nodes can remember packets already forwarded to keep


network load within allowed limits
■ Avoid sending the same packet a second time

■ Keep in each router per source a list of packets already

seen
Properties of Flooding

■ All possible routes are tried


■ very robust
■ can be used for emergency messaging
■ At least one packet will use minimum hop
count route
■ Can be used once to set up a route
■ All nodes are visited
■ Useful to distribute information (e.g. routing
info)
Distance-Vector Routing
The distance-vector (DV) routing uses the goal we discussed in
the introduction, to find the best route. In distance-vector routing,
the first thing each node creates is its own least-cost tree with the
rudimentary information it has about its immediate neighbors.
The incomplete trees are exchanged between immediate
neighbors to make the trees more and more complete and to
represent the whole internet. We can say that in distance-vector
routing, a router continuously tells all of its neighbors what it
knows about the whole internet (although the knowledge can be
incomplete).

The Distance Vector Routing Algorithm is also known as


the Distributed Bellman-Ford algorithm
Ex. Routing Information Protocol or RIP
The distance vector corresponding to a tree
The first distance vector for an internet
Updating distance vectors
Updating distance Vectors
Distance-Vector Routing Algorithm for A Node
Two-node instability
Count to Infinity Problem
Link-State Routing

A routing algorithm that directly follows our


discussion for creating least-cost trees and
forwarding tables is link-state (LS) 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.
Each router must do the following things to
make it work:
■ 1. Discover its neighbors and learn their network
addresses.
■ 2. Set the distance or cost metric to each of its
neighbors.
■ 3. Construct a packet telling all it has just learned.
■ 4. Send this packet to and receive packets from all other
routers.
■ 5. Compute the shortest path to every other router.
Example of a link-state database
Learning about the Neighbors
Setting Link Costs
The link state routing algorithm requires each link to have a
distance or cost metric for finding shortest paths. The cost
to reach neighbors can be set automatically, or configured
by the network operator. A common choice is to make the
cost inversely proportional to the bandwidth of the link. For
example, 1-Gbps Ethernet may have a cost of 1 and
100-Mbps Ethernet a cost of 10. This makes
higher-capacity paths better choices.
Building Link State Packets
Distributing the Link State Packets
The fundamental idea is to use flooding to distribute the link
state packets to all routers. To keep the flood in check, each
packet contains a sequence number that is incremented for each
new packet sent. Routers keep track of all the (source router,
sequence) pairs they see. When a new link state packet comes
in, it is checked against the list of packets already seen. If it is
new, it is forwarded on all lines except the one it arrived on. If it
is a duplicate, it is discarded. If a packet with a sequence
number lower than the highest one seen so far ever arrives, it is
rejected as being obsolete as the router has more recent data.
Computing the New Routes
Once a router has accumulated a full set of link state
packets, it can construct the entire network graph because
every link is represented. Every link is, in fact, represented
twice, once for each direction. The different directions may
even have different costs. The shortest-path computations
may then find different paths from router A to B than from
router B to A.

Now Dijkstra’s algorithm can be run locally to construct the


shortest paths to all possible destinations
LSPs created and sent out by each node to build LSDB
Hierarchical Routing

You might also like