SlideShare a Scribd company logo
Routing algorithm
Presented to:
Sir Zeeshan
Presented by:
Bushra
Roll No:
2
Presented topic
Routing Algorithms
Router
– A router is located at the gateway
– it routes packets as they travel from one network
to another network(s).
– A router can be hardware device with a software
application
– The router is connected to at least two networks
•find path
•forward packet, forward packet, forward
packet, forward packet...
•find alternate path
•forward packet, forward packet, forward
packet, forward packet…
•repeat until powered off
What does a router do?
Routing versus Forwarding
• Routing = building
maps and giving
directions
• Forwarding = moving
packets between
interfaces according
to the “directions”
6
Routing
• How do packets get from A to B in the
Internet?
A
B
Internet
Network Performance Measures
• Two Performance Measures
– Quantity of Service (Throughput)
• How much data travels across the net?
• How long does it take to transfer long files?
– Quality of Service (Average packet delay)
• How long does it take for a packet to arrive at its
destination?
• How responsive is the system to user commands?
• Can the network support real-time delivery such as
audio and video?
Fairness versus Optimality
• Quantity of service
versus quality of
service.
• To optimize
throughput, saturate
paths between A and
A’, B and B’, and C and
C’, but what happens
to the response time
from X to X’?
Types of Routing Algorithms
• Nonadaptive (static)
– Do not use measurements of current conditions
– Static routes are downloaded at boot time
• Adaptive Algorithms(dynamic)
– Change routes dynamically
• Gather information at runtime
– locally
– from adjacent routers
– from all other routers
• Change routes
– When load changes
– When topology changes
Optimality principle
(a adaptive routing algorithm)
• If router j is on the optimal path from i to k,
then the optimal path from j to k also falls
along the same route.
i
k
(j)
(j)
(j)
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
• 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
Shortest Path Routing
(a nonadaptive routing algorithm)
Weighted Graph
Example of Shortest Path Routing
Flooding
(a nonadaptive routing algorithm)
• No network information is required
•Packet send by node to every neighbor
•Incoming packets retransmitted on every link
without incoming link
•Eventually a numbers of copies will arrives at
destination
•Each packet is uniquely numbered so duplicate can
be discarded
•Nodes can remember packets already forwarded
to keep network load in bounds
Flooding of A’s LSP
– All nodes are visited
– All possible routes are tried
• Selective Flooding
– Flood only in the direction of the destination
• Practical example
– Mobile when user 1 dial number to call user 2,the
mobile station/company searches for user 2 in whole
country if user 2 is out of reach. Then this process take
few seconds
– Distributed Databases
Flooding
(a nonadaptive routing algorithm)
• Neighboring routers periodically exchange
information from their routing tables.
• Routers replace routes in their own routing
tables anytime that neighbors have found
better routes.
• Information provided from neighbors
– Outgoing line used for destination
– Estimate of time or distance
• can be number of hops, time delay, packet queue length,
etc.
Distance Vector Routing
(an adaptive routing algorithm)
Example of an Internet
The Concept of Distance
Vector Routing
Distance Vector Routing Table
Routing Table Distribution
• Five Steps
1.) Discover your neighbors and learn their addresses.
2.) Measure the cost (delay) to each neighbor.
3.) Construct a packet containing all this information
4.) Send this packet to all other routers.
5.) Compute the shortest path to every other router.
Link State Routing
(an adaptive routing algorithm)
1.) Discovering Your Neighbors
• Send “Hello” packet on each point-to-point
line. Destination node replies with its
address.
Concept of Link State Routing
2.) Measuring Line Cost
• Send an “ECHO” packet over the line.
• Destination is required to respond to
“ECHO” packet immediately.
• Measure the time required for this
operation.
• Question: Should we measure just the time
it takes to transmit the packet, or should
we include the time that the packet waits
in the queue?
Argument 2:
• We should include the time that the packet
spends in the queue, as this provides a more
accurate picture of the real delays.
• We should only include the transmission
times, otherwise the network is likely to
oscillate between preferred paths.
Distributing the Link State Packets
• Use selective flooding
• Sequence numbers prevent duplicate packets
from being propagated
• Lower sequence numbers are rejected as
obsolete
Computing the New Routes
• Dijkstra’s Shortest Path algorithm is used to
determine the shortest path to each
destination.
Hierarchical Routing
• Addresses the growth of routing tables
• Routers are divided into regions
• Routers know the routes for their own
regions only
• Works like telephone routing
• Possible hierarchy
– city, state, country, continent
Routing algorithm
Routing Mobile Hosts
• Networking portable computers
• Tanenbaum’s proposed solution
– All mobile agents are assumed to have a
permanent home location
– When a portable computer is attached to a
remote network it contacts a process that acts
as the local foreign agent.
– Each home location has a process that acts as
the home agent
The Agents on the Network
Registering a Mobile Agent
• Periodically the foreign agent broadcasts its
address
• The mobile agent registers with the foreign
agent and supplies its home address
• The foreign agent contacts the mobile
agent’s home agent reporting the mobile
agent’s location.
– Security must be used to verify the identity of
the mobile agent.
• The foreign agent registers the mobile
agent
Routing Packets to a Mobile Agent
• Packets sent to the mobile agent are routed
to the users home network
• The home agent routes the packets to the
foreign agent
• The home agent provides the source of
incoming packets with the remote address
of the mobile agent
Broadcast Routing
• Send a separate packet to each destination
• Use flooding
• Use multidestination routing
– Each packet contains a list of destinations
– Routers duplicate packet for all matching
outgoing lines
• Use spanning tree routing
– a subset of the subnet that includes all routers
but contains no loops.
Spanning Tree Broadcasting
• Uses the minimum
number of packets
necessary
• Routers must be able to
compute spanning tree
– Available with link state
routing
– Not available with
distance vector routing
Broadcast Routing (continued)
• Reverse Path Forwarding
– Use When knowledge of a spanning tree is not
available
– Provides an approximation of spanning tree
routing
– Routers check to see if incoming packet arrives
from the same line that the router uses to route
outgoing packets to the broadcast source
• If so, the router duplicates the packet on all other
outgoing lines
• Otherwise, the router discards the packet
tree built by reverse path forwarding
Multicast Routing
• A method to broadcast packets to well-
defined groups
• Hosts can join multicast groups.
– They inform their routers
– Routers send group information throughout
the subnet
• Each router computes a spanning tree for
each group. The spanning tree includes all
the routers needed to broadcast data to the
group
Spanning Trees for Multicast Routing
References:
• http://www.indiastudychannel.com/ Basic-
Types-Routing-Algorithms.aspx
• en.wikipedia.org/wiki/Routing#Routing_algori
thms_and_techniques
• Tanenbaum’s book
Thank you
for your attention!
Any Question?

More Related Content

Routing algorithm

  • 2. Presented to: Sir Zeeshan Presented by: Bushra Roll No: 2
  • 4. Router – A router is located at the gateway – it routes packets as they travel from one network to another network(s). – A router can be hardware device with a software application – The router is connected to at least two networks
  • 5. •find path •forward packet, forward packet, forward packet, forward packet... •find alternate path •forward packet, forward packet, forward packet, forward packet… •repeat until powered off What does a router do?
  • 6. Routing versus Forwarding • Routing = building maps and giving directions • Forwarding = moving packets between interfaces according to the “directions” 6
  • 7. Routing • How do packets get from A to B in the Internet? A B Internet
  • 8. Network Performance Measures • Two Performance Measures – Quantity of Service (Throughput) • How much data travels across the net? • How long does it take to transfer long files? – Quality of Service (Average packet delay) • How long does it take for a packet to arrive at its destination? • How responsive is the system to user commands? • Can the network support real-time delivery such as audio and video?
  • 9. Fairness versus Optimality • Quantity of service versus quality of service. • To optimize throughput, saturate paths between A and A’, B and B’, and C and C’, but what happens to the response time from X to X’?
  • 10. Types of Routing Algorithms • Nonadaptive (static) – Do not use measurements of current conditions – Static routes are downloaded at boot time • Adaptive Algorithms(dynamic) – Change routes dynamically • Gather information at runtime – locally – from adjacent routers – from all other routers • Change routes – When load changes – When topology changes
  • 11. Optimality principle (a adaptive routing algorithm) • If router j is on the optimal path from i to k, then the optimal path from j to k also falls along the same route. i k (j) (j) (j)
  • 12. 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
  • 13. • 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 Shortest Path Routing (a nonadaptive routing algorithm)
  • 15. Example of Shortest Path Routing
  • 16. Flooding (a nonadaptive routing algorithm) • No network information is required •Packet send by node to every neighbor •Incoming packets retransmitted on every link without incoming link •Eventually a numbers of copies will arrives at destination •Each packet is uniquely numbered so duplicate can be discarded •Nodes can remember packets already forwarded to keep network load in bounds
  • 18. – All nodes are visited – All possible routes are tried • Selective Flooding – Flood only in the direction of the destination • Practical example – Mobile when user 1 dial number to call user 2,the mobile station/company searches for user 2 in whole country if user 2 is out of reach. Then this process take few seconds – Distributed Databases Flooding (a nonadaptive routing algorithm)
  • 19. • Neighboring routers periodically exchange information from their routing tables. • Routers replace routes in their own routing tables anytime that neighbors have found better routes. • Information provided from neighbors – Outgoing line used for destination – Estimate of time or distance • can be number of hops, time delay, packet queue length, etc. Distance Vector Routing (an adaptive routing algorithm)
  • 20. Example of an Internet
  • 21. The Concept of Distance Vector Routing
  • 24. • Five Steps 1.) Discover your neighbors and learn their addresses. 2.) Measure the cost (delay) to each neighbor. 3.) Construct a packet containing all this information 4.) Send this packet to all other routers. 5.) Compute the shortest path to every other router. Link State Routing (an adaptive routing algorithm)
  • 25. 1.) Discovering Your Neighbors • Send “Hello” packet on each point-to-point line. Destination node replies with its address.
  • 26. Concept of Link State Routing
  • 27. 2.) Measuring Line Cost • Send an “ECHO” packet over the line. • Destination is required to respond to “ECHO” packet immediately. • Measure the time required for this operation. • Question: Should we measure just the time it takes to transmit the packet, or should we include the time that the packet waits in the queue?
  • 28. Argument 2: • We should include the time that the packet spends in the queue, as this provides a more accurate picture of the real delays. • We should only include the transmission times, otherwise the network is likely to oscillate between preferred paths.
  • 29. Distributing the Link State Packets • Use selective flooding • Sequence numbers prevent duplicate packets from being propagated • Lower sequence numbers are rejected as obsolete
  • 30. Computing the New Routes • Dijkstra’s Shortest Path algorithm is used to determine the shortest path to each destination.
  • 31. Hierarchical Routing • Addresses the growth of routing tables • Routers are divided into regions • Routers know the routes for their own regions only • Works like telephone routing • Possible hierarchy – city, state, country, continent
  • 33. Routing Mobile Hosts • Networking portable computers • Tanenbaum’s proposed solution – All mobile agents are assumed to have a permanent home location – When a portable computer is attached to a remote network it contacts a process that acts as the local foreign agent. – Each home location has a process that acts as the home agent
  • 34. The Agents on the Network
  • 35. Registering a Mobile Agent • Periodically the foreign agent broadcasts its address • The mobile agent registers with the foreign agent and supplies its home address • The foreign agent contacts the mobile agent’s home agent reporting the mobile agent’s location. – Security must be used to verify the identity of the mobile agent. • The foreign agent registers the mobile agent
  • 36. Routing Packets to a Mobile Agent • Packets sent to the mobile agent are routed to the users home network • The home agent routes the packets to the foreign agent • The home agent provides the source of incoming packets with the remote address of the mobile agent
  • 37. Broadcast Routing • Send a separate packet to each destination • Use flooding • Use multidestination routing – Each packet contains a list of destinations – Routers duplicate packet for all matching outgoing lines • Use spanning tree routing – a subset of the subnet that includes all routers but contains no loops.
  • 38. Spanning Tree Broadcasting • Uses the minimum number of packets necessary • Routers must be able to compute spanning tree – Available with link state routing – Not available with distance vector routing
  • 39. Broadcast Routing (continued) • Reverse Path Forwarding – Use When knowledge of a spanning tree is not available – Provides an approximation of spanning tree routing – Routers check to see if incoming packet arrives from the same line that the router uses to route outgoing packets to the broadcast source • If so, the router duplicates the packet on all other outgoing lines • Otherwise, the router discards the packet
  • 40. tree built by reverse path forwarding
  • 41. Multicast Routing • A method to broadcast packets to well- defined groups • Hosts can join multicast groups. – They inform their routers – Routers send group information throughout the subnet • Each router computes a spanning tree for each group. The spanning tree includes all the routers needed to broadcast data to the group
  • 42. Spanning Trees for Multicast Routing
  • 43. References: • http://www.indiastudychannel.com/ Basic- Types-Routing-Algorithms.aspx • en.wikipedia.org/wiki/Routing#Routing_algori thms_and_techniques • Tanenbaum’s book
  • 44. Thank you for your attention! Any Question?