Routing Protocols
Routing Protocols
• The main function of the network layer is routing packets from the source
machine to the destination machine
• In most networks, packets will require multiple hops to make the journey.
• The routing algorithm is that part of the network layer software
responsible for deciding which output line an incoming packet should be
transmitted on.
• If the network uses datagrams internally, this decision must be made
anew for every arriving data packet since the best route may have
changed since last time.
• If the network uses virtual circuits internally, routing decisions are made
only when a new virtual circuit is being set up. Thereafter, data packets
just follow the already established route. The latter case is sometimes
called session routing because a route remains in force for an entire
session
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Routing Algorithms
• distinction between routing, which is making the decision which routes to
use, and forwarding, which is what happens when a packet arrives.
• A router has two processes inside it.
• One of them handles each packet as it arrives, looking up the outgoing
line to use for it in the routing tables. This process is forwarding.
• The other process is responsible for filling in and updating the routing
tables. That is where the routing algorithm comes into play.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Desirable properties of routing algorithm
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
• Once a major network comes on the air, it may be expected to run
continuously for years without system-wide failures.
• During that period there will be hardware and software failures of all kinds.
Hosts, routers, and lines will fail repeatedly, and the topology will change
many times.
• The routing algorithm should be able to cope with changes in the topology
and traffic without requiring all jobs in all hosts to be aborted.
• Stability is also an important goal for the routing algorithm. There exist
routing algorithms that never converge to a fixed set of paths, no matter
how long they run. A stable algorithm reaches equilibrium and stays there.
It should converge quickly too, since communication may be disrupted
until the routing algorithm has reached equilibrium
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Fairness vs. Efficiency
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Routing Algorithms Classes
• Nonadaptive algorithms do not base their routing decisions on any measurements
or estimates of the current topology and traffic. Instead, the choice of the route to
use to get from I to J (for all I and J) is computed in advance, offline, and
downloaded to the routers when the network is booted. This procedure is sometimes
called static routing. Because it does not respond to failures, static routing is
mostly useful for situations in which the routing choice is clear.
• Adaptive algorithms, in contrast, change their routing decisions to reflect
changes in the topology, and sometimes changes in the traffic as well.
These dynamic routing algorithms differ in
• where they get their information (e.g., locally, from adjacent routers, or
from all routers),
• when they change the routes (e.g., when the topology changes, or every ΔT
seconds as the load changes), and
• what metric is used for optimization (e.g., distance, number of hops, or
estimated transit time).
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
The Optimality Principle
• if router J is on the optimal path from router I to router K, then the optimal
path from J to K also falls along the same route. Let the part of the route
from I to J is r1and the rest of the route is r2
• If a route better than r2 existed from J to K, it could be concatenated with r1
to improve the route from I to K, contradicting the statement that r1r2 is
optimal.
• As a direct consequence of the optimality principle, the set of optimal routes
from all sources to a given destination form a tree rooted at the destination.
Such a tree is called a sink tree. The goal of all routing algorithms is to
discover and use the sink trees for all routers.
• Since a sink tree is indeed a tree, it does not contain any loops, so each
packet will be delivered within a finite and bounded number of hops.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
The Optimality Principle
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
flooding
• every incoming packet is sent out on every outgoing line
except the one it arrived on.
• generates vast numbers of duplicate packets
• some measures to control duplicate packets
• hop counter contained in the header of each packet.
• routers keep track of which packets have been flooded.
• Important uses
• ensures that a packet is delivered to every node in the network.
• flooding is tremendously robust.
• can also be used as a metric against which other routing algorithms
can be compared.
• also requires little in the way of setup.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Shortest Path Algorithm
The first five steps used in computing the shortest path from A
to D. The arrows indicate the working node
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
distance vector routing
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Distance Vector Routing
(a) A network.
(b) Input from A, I, H, K, and the new routing table for J.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
a) The settling of routes to best paths across the network is
called convergence.
b) a serious drawback in practice: although it converges to the
correct answer, it may do so slowly.
c) In particular, it reacts rapidly to good news, but slowly to bad
news.
d) Consider a router whose best route to destination X is long. If,
on the next exchange, neighbor A suddenly reports a short
delay to X, the router just switches over to using the line to A
to send traffic to X. In one vector exchange, the good news is
processed.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
The Count-to-Infinity Problem
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Link State Routing
The primary problem that caused its demise was that
the algorithm often took too long to converge after the
network topology changed (due to the count-to-infinity
problem).
Each router must do the following things to make it
work:
1.Discover neighbors, learn network addresses.
2.Set distance/cost metric to each neighbor.
3.Construct packet telling all learned.
4.Send packet to, receive packets from other routers.
5.Compute shortest path to every other router.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Learning about the Neighbors (1)
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Learning about the Neighbors (2)
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Measuring Line Cost
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Building Link State Packets
(a) A network. (b) The link state packets for this network.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Distributing the Link State Packets
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Hierarchical Routing
Hierarchical routing.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
OSPF—An Interior Gateway
Routing Protocol
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
OSPF—An Interior Gateway
Routing Protocol
Early intradomain routing protocols used a distance vector design, based on
the distributed Bellman-Ford algorithm inherited from the ARPANET. RIP
(Routing Information Protocol) is the main example that is used to this day.
It works well in small systems, but less well as networks get larger. It also
suffers from the count-to-infinity problem and generally slow convergence.
The ARPANET switched over to a link state protocol in May 1979 because of
these problems, and in 1988 IETF began work on a link state protocol for
intradomain routing. That protocol, called OSPF (Open Shortest Path
First), became a standard in 1990.
It drew on a protocol called IS-IS (Intermediate-System to Intermediate-
System), which became an ISO standard.
OSPF is more widely used in company networks, and IS-IS is more widely
used in ISP networks
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
autonomous system network
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
autonomous system network
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
A graph representation of the previous slide.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
OSPF—An Interior Gateway
Routing Protocol (3)
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
OSPF—An Interior Gateway
Routing Protocol (4)
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
BGP—The Exterior Gateway
Routing Protocol
• a corporate AS might want the ability to send packets to any Internet site and
receive packets from any Internet site. However, it might be unwilling to
carry transit packets originating in a foreign AS and ending in a different
foreign AS, even if its own AS is on the shortest path between the two
foreign ASes (‘‘That’s their problem, not ours’’).
• AS might be willing to carry transit traffic for its neighbors, or even for
specific other ASes that paid it for this service.
• Exterior gateway protocols in general, and BGP in particular, have been
designed to allow many kinds of routing policies to be enforced in the
interAS traffic
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
BGP—The Exterior Gateway
Routing Protocol (2)
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
• There are four Ases that are connected. The connection is often made with a
link at IXPs (Internet eXchange Points), facilities to which many ISPs have
a link for the purpose of connecting with other ISPs.
• AS2, AS3, and AS4 are customers of AS1. They buy transit service from it.
• Thus, when source A sends to destination C, the packets travel from AS2 to
AS1 and finally to AS4.
• The routing advertisements travel in the opposite direction to the packets.
• AS4 advertises C as a destination to its transit provider, AS1, to let sources
reach C via AS1.
• Later, AS1 advertises a route to C to its other customers, including AS2, to let
the customers know that they can send traffic to C via AS1.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
• all of the other ASes buy transit service from AS1.
• This provides them with connectivity so they can interact with any host on
the Internet.
• However, they have to pay for this privilege.
• Suppose that AS2 and AS3 exchange a lot of traffic.
• Given that their networks are connected already, if they want to, they can use
a different policy—they can send traffic directly to each other for free.
• This will reduce the amount of traffic they must have AS1 deliver on their
behalf, and hopefully it will reduce their bills. This policy is called peering
• To implement peering, two ASes send routing advertisements to each other
for the addresses that reside in their networks. Doing so makes it possible for
AS2 to send AS3 packets from A destined to B and vice versa.
• However, note that peering is not transitive.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011