You are on page 1of 74

Routing in

Communication
Networks
Routing
Introduction
 Network Layer services:
End to end connectivity
Addressing
Routing
Internetworking
Packet Formation
Introduction
 Routing is necessary in communication networks
to direct user traffic from source to destination
 Routing must fulfill service requirements for
traffic while at the same time maximizing
network performance and minimizing cost of
servicing traffic
 We will look at general routing principles

 We will look at the main Internet routing


protocols RIP, OSPF, BGP
Routing Characteristics
 Required routing characteristics:
 Correctness
 Simplicity
 Robustness
 Stability
 Fairness
 Optimality
 Efficiency
Performance Criteria
 There must be some performance criterion on which to
base route selection
 Simplest mechanism is minimum-hop, where the route
which passes through the minimum of nodes is chosen
 Minimum hop is simple, however, it may be inefficient at
times. Why?
 A more general mechanism seeks to select the least-cost
path from source to destination
 Each link from source to destination will have
some cost associated with it
 Actual path chosen from options available would
be the one that minimize that cost
Costing of Routes
Routing Decision Issues
 The time at which the routing decision is made
depends on internal operation of network which
can be either:
 Datagram – Each packet routed individually
 Virtual Circuit – Routing decision made at
establishment of virtual circuit
 The place where the routing decision is made
can be:
 Distributed
 Made by each node
 Centralized
 single entity performs routing function
 Source
 Source determines route
Routing Decision Issues (cont)
 Routing decisions are usually based on knowledge of
network (not always)
 In distributed routing following options are available:
 Nodes may use local knowledge
 Nodes may collect information from adjacent
nodes
 Nodes may collect information from all nodes on a
potential route
 In central routing information is collected from all
nodes
 Update timing relates to when is network information
held by nodes updated. Two cases:
 Fixed - never updated
 Adaptive - regular updates
Routing Strategies
 We will examine the following routing strategies:
 Fixed
 Flooding
 Random
 Adaptive
Fixed Routing
 Single permanent route for each
source/destination pair
 Determines route using a least cost algorithm
 Route is fixed, at least until a change in network
topology
 Advantages:
 Simple
 Effective for stable networks
 Disadvantage:
 Inflexible; does not react to network congestion or
failures
Flooding
 No network information 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
 Nodes can remember packets already forwarded
to keep network load in bounds
 Can include a hop count in packets
Flooding
Example
Properties of Flooding
 All possible routes are tried
 Very robust
 At least one packet will have taken minimum
hop count route
 Can be used to set up virtual circuit
 All nodes are visited
 Useful to distribute information (e.g. routing)
 Produces large load on network
Random Routing
 Node selects one outgoing path for
retransmission of incoming packet
 Selection can be random or round robin
 Can select outgoing path based on probability
calculation
 No network information needed
 Route is typically not least cost nor minimum
hop
Adaptive (Dynamic) Routing
 Used by almost all packet switching networks
 Routing decisions change as conditions on the
network change. Most important decisions relate
to:
 Failure
 Congestion
 Requires information about network
 Decisions more complex
 Tradeoff between quality of network information
and overhead
 Reacting too quickly can cause oscillation, while
reacting too slowly can cause decisions made to be
irrelevant
Adaptive Routing - Advantages
 In spite on drawbacks adaptive routing
strategies are by far the most prevalent due to:
 Improved performance
 Aids congestion control
 Can balance loads thus allowing for the routing of
traffic around points of congestion
Adaptive Routing - Classification
 Can be classified based on information source:
 Local (isolated)
 Route to outgoing link with shortest queue
 Can include bias for each destination
 Rarely used - does not make use of easily available
information
 Adjacent nodes
 Use information from adjacent nodes about delays,
outages, error rates etc.
 All nodes
 Collate information from all nodes to make routing
decision
Isolated Adaptive Routing
Routing Protocols
 Routers in internets must route through an
interconnected set of networks
 Due to complexity of most internets, a dynamic
routing scheme is used
 A special protocol called a routing protocol is
used to exchange routing information
 In the routing function there are two distinct
concepts:
 Routing Information
 This relates to topology and delays in the internet
 Routing Algorithm
 Used to make routing decisions based on routing
information
Autonomous Systems (AS)
 An autonomous system (AS) is a set of routers
and networks managed by a single organization
 ASs have the following characteristics:
 Made up of routers exchanging information via a
common routing protocol
 They are connected (in a graph-theoretical sense)
in that there is at least one route between any pair
of nodes
Interior Router Protocol (IRP)
 Passes routing information between routers
within an autonomous system (AS)
 May be more than one AS in internet
 Routing algorithms and tables may differ
between different ASs
 Routers need some info about networks outside
their AS
 More commonly referred to as interior gateway
protocol (IGP)
Exterior Router Protocol
 Exterior router protocol (ERP) used for
communication between different ASs
 IRP needs detailed model to make up least cost
paths between routers within AS
 ERP simply supports summary information on
reachability
 Hence IRPs tend to be a lot more complicated
than ERPs
 More commonly referred to as exterior gateway
Protocol (EGP)
Application of IRP and ERP
Distributed Routing Algorithms
 Routing is a network layer function

 There are basically two types of distributed


routing algorithms:
 Distance Vector
 Link State

 All popular network layer routing protocols are


based on one of these two
Distance Vector Routing
 Distance Vector routing algorithms generate
routes that are optimal with respect to a specific
metric
 Examples of metrics are: Delay, throughput,
error rate, or a combination of several such
metrics
 Optimal routes will try to minimize the metric
cost function
 The basic distance vector routing algorithm is
also known as the Bellman-Ford algorithm
Distance Vector Routing (cont)
 In general, distance vector protocols work as
follows:
 Each router is configured with its own ID
 Each router is also configured with a number to
use as the cost of each link
 Each router starts out with a distance vector
consisting of 0 for itself and infinity for every
other destination
 Each router transmits its distance vector to each
of its neighbours whenever the information
changes (as well as when a link to a neighbour
first comes up and probably also periodically)
Distance Vector Routing (cont)

 Each router saves the most recently


received distance vector from each of its
neighbours
 Each router calculates its own distance
vector, based on minimizing the cost to
each destination
 by examining the cost to that
destination reported by each
neighbour in turn
 then adding the configured cost of the
link to that neighbour
Distance Vector Routing (cont)
 The following events cause recalculation of the
distance vector:
 Receipt from a neighbour of a distance vector
containing different information than
previously
 Discovery that a link has gone down – in
which case, the distance vector from that
neighbour is discarded before the distance
vector is recalculated
 A popular distance vector protocol is the
routing information protocol (RIP)
Distance Vector Example

B
4 2

3 5 D
A C

1
1 3
E
RIP – General Description
 RIP1 defined in RFC 1058
 RIP metric is very simple – hop count
 Treats any number higher than 15 as infinity
 Addresses are 32-bit Internet addresses
 Routing table entries can represent a host, a
network, or a subnet
 RIP protocol includes a request and a response
command
RIP1 Packet Format

Command Version 0000000000000000


Addr family identifier 0000000000000000
IP Address for table entry
Repeated
00000000000000000000000000000000 below up to
00000000000000000000000000000000 25 times

Metric to <IP Address>

Command: Request (1) or Response (2);


Version: 1; Address family identifier: 2 for IP
Metric: number of internetwork hops (routers)
to dest’n: 1 - 15 are valid routes, 16 unreachable
RIP – General Description (cont)
 RIP uses UDP for sending commands
 Normal operation is through broadcasting of
responses:
 At regular 30 second intervals
 Triggered by routing table updates
 Triggered updates spaced by random timer,
varying between 1 and 5 seconds
 If route is not refreshed in 180 seconds:
 Distance set to infinity
 Entry is removed from routing table
RIP Response Processing
 RIP updates routing table upon reception of a
response message
 Each routing table entry contains at least:
 The address of the destination
 The metric associated to that destination
 The address of the next router
 A recently updated flag
 Several timers
RIP Response Processing (cont)
 Router will examine the entries in the response
packet one by one
 It will do a number of validation checks on the
information in the packet
 For example, is metric too large, is address valid,
is address a broadcast address
 Incorrect entries are ignored
 If metric is not infinity, the incoming metric is
increased by one
 Routing table is next searched for destination,
and the generic “distance vector” processing is
performed
RIP Response Processing (cont)
 If the entry is not present and metric is not infinite, add it
to routing table:
 Initialize the metric to received value
 Initialize next router to sender of that message
 Start timer
 If entry is present with larger metric:
 Update the metric
 Update next hop router
 Restart timer
 If entry was present and the next router was the sender of
the response message
 Update metric if different from stored value
 Restart timer
 In all other cases, the received entry is ignored
RIP Response Processing (cont)
 If metric or next router changed, entry is
marked as updated
 Response sent out every 30 seconds, or it can be
triggered by an update to routing tables
 Triggered updates can also excessive network
nodes hence their rates are limited
RIP Request Command
 Request usually sent when router is starting
operation in order to get the initial state of
neighbour’s routing tables
 There are two forms of requests:
 Request for full routing table listing
 Request for specific route to a destination
RIP Version 2
 RIP2 defined in RFC 1388
 RIP2 defines a number of new fields:
 Routing domain is used (together with next hop)
to allow multiple autonomous systems to share a
single wire
 The subnet mask enables better subnet routing
 The route tag is used to flag external routes
 In addition, RIP2 improves security from version
1 by including an authentication procedure
RIP2 Packet Format

Command Version Routing Domain


Addr family identifier Route Tag
IP Address for table entry
Repeated
Subnet Mask below up to
Next Hop 25 times

Metric

Route Tag: Distinguishes between internal routes (learned by


RIP) and external routes (learned from other protocols).
Version: 2; Subnet Mask: subnet mask for entry
Next Hop: IP addr of next hop to which packets for entry
should be forwarded.
Distance Vector Routing Problems
 There are a number of problems with distance
vector routing:
 Routing loops
 Slow convergence
 Counting to infinity
Link State Routing:General
Description

 Link state routing has become very popular


due to the fact that it is a more robust and
flexible alternative to distance vector routing
 The basic idea behind link state routing is as
follows:
 Each router is responsible for meeting its
neighbours and learning their names
 Each router constructs a packet known as a link
state packet (LSP) which contains a list of the
names of, and cost to each of its neighbours
1. The LSP is transmitted to all the other routers using
flooding, and each router stores the most recently
generated LSP from all other routers
Link State Routing:General
Description (cont)
 Each router, armed now with a complete map of
the topology, computes routes to each destination
 Each router maintains a complete map of the
routing domain, called the link state database
Link State Routing: Link State
Packets

 The routing domain is described by the LSPs


circulated by each router. Each LSP includes:

 The identity of the router


 A list of the router’s operational links
 The cost of each operational link, when used to
forward application traffic
 The identity of the network segment or router to
which the link connects
Link State Routing: Link State
Packets (cont)
 Additionally, link state packets may include:

 A sequence number – this is used to determine


the most up to date instance of the LSP
 Age – this is used to indicate when outdated LSPs
should be discarded
 Checksum – used to ensure that no data
corruption has taken place within the LSP
Link State Routing: Link State
Packets
 A router updates its LSP when its local
environment changes
 The time taken to detect changes is critical to
the performance of link state protocols
 Hence, many implementation require the
sending of periodic “Hello” packets to detect
unresponsive routers
 For robustness, most link state protocols also
periodically update their LSP’s even in the
absence of network changes
Link State Routing: Flooding
Algorithm
 A good flooding algorithm is essential to the
efficient functioning of any link state protocol
 The flooding algorithm ensures that LSPs are
efficiently disseminated so that all routers
maintain identical link state databases
 In general, the flooding algorithm of any link
state protocol should work as follows:
 The router receives the flooded LSP on one of its links
 The router examines the LSP’s sequence number and
compares it to the sequence number of the current
copy in its database
Link State Routing: Flooding
Algorithm (cont)
 If the LSP is new, it is installed in the link
state database, replacing the current copy
(if any)
 LSP is then sent out all the switch’s links
save the link the LSP was received on
 Regardless of whether the LSP is new or not,
an acknowledgement is sent back out the
link on which the LSP was received
Link State Routing: Routing
Calculations
 The most popular algorithm for calculating the
best routes for link state routing is Dijkstra’s
(also called shortest paths first) algorithm
 In Dijkstra’s algorithm each link is assigned a
nonnegative cost
 A set of shortest paths from the calculating
switch to the all other switches in the network is
then found
 The cost of a path is the sum of the costs of the
links making up the path
Link State Routing: Dijkstra’s
Algorithm

 Dijkstra’s algorithm can be describes as


follows:
 There are two disjoint set of switches, one set
(set A say) consists of switches to which
shortest paths have already been found. The
other set (set B) consists of switches to which
candidate paths have been found
 The algorithm begins by putting the calculating
(source) switch in set A, set B is initially empty
 The algorithm then iterates. At each iteration,
the switch (switch X say) just added to set A is
examined and the following steps executed:
Link State Routing: Dijkstra’s
Algorithm

 The neighbours of Switch X not belonging to


set A are added to set B (if they are not there
already)
 The neighbours’ candidate paths are updated
if the path through Switch X is shorter than
the previously known path (if any)
 If set B is now empty, the algorithm
terminates, else
 The switch in set B that is closest to the
calculating switch is moved to set A, and the
algorithm iterates again
Dijkstra Algorithm Example

B
4 2

3 5 D
A C

1
1 3
E

Network on which Dijkstra’s Algorithm is


run
Link State Routing: Dijkstra’s
Algorithm

 Consider running Dijkstra’s algorithm on the network


shown in the previous slide. The calculations for Switch
A would be as follows:
 Initial State - Set A would consist of switch A itself, set
B would be empty
 Iteration 1 - Switches B, C, and E are added to the set
B, and E is then moved to set A
 Iteration 2 – Switch D is moved to set B, and switch C’s
candidate path is changed to go through E. Switch C is
then moved to the set A
 Iteration 3 – Switch B is moved to the shortest path
set A
 Iteration 4 – Switch D is moved to set A. The algorithm
then terminates
Link State Routing: A’s Routing Table
After Running Dijksta’s Algorithm

Destination Next Hop Cost


A
1 4
A * *

E B
B B 4

3 1
C E 2

D C
D E 4

E E 1
Link State Routing: Open Shortest
Path First Protocol (OSPF)

 The open shortest paths first (OSPF) protocol


is a TCP/IP routing protocol
 Defined in RFC 2328
 In TCP/IP a collection of routers under a single
administrative control and running a common
routing algorithm is called an autonomous
system (AS)
 The common routing protocol is called an interior
gateway protocol (IGP)
 OSPF is recommended as the IGP for TCP/IP
based networks
OSPF:Link State Advertisements

 OSPF has five types of Link State


Advertisements (LSAs) (equivalent to LSPs):
 1. Router LSAs – these are distributed by each
router and lists the router’s operational interfaces,
cost, network connections, and range of IP
addresses accessible via interfaces
 2.Network LSAs – these list all the routers
connected to a particular network
 3. and 4. Summary Link LSAs – these advertise
IP addresses between areas (described later)
 5. External link LSA’s – these import routing
information from other autonomous systems
OSPF:General Description

 Link state advertisements are kept small in OSPF


(around 40 bytes)
 OSPF allows routers to calculate routes based on
different IP types of service (e.g low delay, high
bandwidth)
 In OSPF when a link comes up, an explicit
synchronization procedure called database exchange
takes place to ensure both ends have identical link state
databases before link is advertised in LSAs
 To minimize flooding on LANs, OSPF elects a designated
router for each LAN and synchronizes all other routers
on the LAN with the designated router
OSPF:General Description (cont)

 OSPF uses the standard Dijkstra algorithm for


its base routing calculation
 An autonomous system running OSPF can be
split into areas
 A special area, called the backbone area, must
be defined which is responsible for distributing
routing information between the other areas
 The backbone area must be contiguous, and
all other areas must attach directly to the
backbone area
OSPF:Graph Formation
 Network topology stored as directed graph
 Vertices or nodes are of two types:
 Router
 Network – there are two types of network:
 Transit
 Stub
 Directed graph edges are of two types:
 Used to represent connection between two routers
 Used to represent connection from router to
network
Sample OSPF AS
Directed
Graph of AS
Border Gateway Protocol (BGP)
Introduction

 Exterior gateway protocols (EGPs) route


packets between autonomous systems
 BGP is preferred exterior gateway protocol for
the Internet
 The behavior of exterior gateway protocols is
strongly influenced by policies depending on
ownership of different autonomous systems
 Policies are manually configured into each BGP
router
Border Gateway Protocol (BGP)
Introduction (cont)
 Latest version BGP-4, defined in RFC 1771
 Uses TCP for reliable communication
 BGP is a distance vector protocol but much
improved over others such as RIP
 In addition to maintaining cost to each
destination, BGP also notes the exact path used
 It also periodically distributes its exact path
to all destinations to its neighbours
 Because BGP enumerates the routes to
destinations it does not suffer from the count to
infinity problem and loops
BGP Messages
 BGP issues the following types of messages:
 Open
 Update
 Keep alive
 Notification
BGP Procedures
 BGP allows routers in different autonomous
systems (ASs) to cooperate in router
information exchange
 Two routers are neighbours if they are
attached to the same network
 BGP has three functional procedures
 Neighbor acquisition
 This occurs when two neighbouring routers in
different autonomous systems agree to exchange
routing information regularly
 Neighbour acquisition must first take place
 One router sends an Open message, other router
responds with Keepalive (if it accepts) message
BGP Procedures (cont)
 BGP functional procedures:
 Neighbour reachability
 Used to maintain relationship with acquired
neighbour
 Periodically exchange of Keepalive messages used
to confirm reachability

 Network reachability
 Each router has database with networks it can reach
and preferred route to that network
 Change in database leads to broadcast of Update
message to all BGP routers
BGP Messages
BGP Messages
 Each message begins with a 19-octet header
containing three fields:
 Marker - Reserved for authentication
 Length - Length of message in octets
 Type - Type of message
 Open message:
 Sent after TCP connection is opened to neighbour
router of interest
 Identifies sender AS and IP address of router
 Includes proposed hold time, which indicates the
number of seconds that the sender proposes for the
value of the Hold Timer
 Receiver selects minimum of its hold time and that sent
 Used as maximum time between Keep alive and/or
update messages
BGP Messages (cont)
 Keep Alive:
 To tell other routers that this router is still here
 Update - Two types:
 Information about single routes through internet
 List of routes being withdrawn

 Information about a single route involves three fields


 Network Layer Reachability Information (NLRI)
 List of networks that can be reached by this route
 Total path attributes length field
 Path attributes field
BGP Messages (cont)
 Path attributes include the following :
 Origin (Indicates whether this information was
generated from an IGP or EGP)
 AS_Path (List of ASs traversed)
• Used to implement routing policy
• Used to ensure that Update messages don’t
circulate indefinitely
 Next_hop (IP address of border router to be used as
next hop for destination listed in NLRI field)
BGP Message (cont)

 Multi_Exit_Disc (used to communicate information


about routers internal to AS)
 Local_pref (Used to Inform other routers within AS
of degree of preference of another route)
 Atomic_Aggregate, Aggregator (Uses address tree
structure to reduce amount of information needed)
BGP Messages (cont)
 Notification message:
 Sent when an error condition is detected
 Following errors may be reported
 Message header error
 Open message error
 Update message error
 Hold time expired
 Finite state machine error
 Cease
BGP Routing Information
Exchange
 Within AS, router builds topology picture using
IGP
 Router issues Update message to other routers
outside AS using BGP
 These routers exchange information with other
routers in other AS
 Routers must then decide best routes
BGP Limitations
 Autonomous system number field is 16 bits long,
therefore number of AS domains limited to
65536, insufficient for very large internets
 A domain has no mechanisms to control how
other domains redistribute routes received from
the domain. This limits a domain’s flexibility in
controlling resource sharing
 BGP provides an most one route to a destination.
This rules out use of multiple routes with
different performance characteristics
 BGP can only support IP, it has no mechanism
for multi-protocol routing support

You might also like