comm3380-Notes05

advertisement
COMM3380 - Computer Networks
DT080
1.
2006/2007
Computer Networks – Routing Protocols
Aims and Objectives
In this chapter we will look at routing protocols used to transport higher layer protocols between
LANs. The aim of this chapter is give an overview of the underlying concepts widely used in
routing protocols.
At the end of this chapter you should be able to:
o Contrast the role of routing protocols with the role of routed or network protocols
o Explain the term Autonomous system
o Describe routing approaches.
o Explain the purpose of a routing table in a network router
o Differentiate between Static vs Dynamic routing
o Describe the operation of example routing protocols.
2.
Introduction
2.1
Routing
AS
R
R
R
R
R
R
R
AS
R
R
R
R
AS
AS – Autonomous System
R - Router
Figure 1: Routers Interconnect Networks and Subnetworks
The internet consists of many routers connected to each other in a very large and complicated
network. Every computer connected to the internet is actually connected to a local router
(possibly via other devices such as hubs or switches) that is part of the global network of
routers. Whenever a new internet cable connection is installed, each end is connected to a
router that is already connected to other routers. As a packet travels across the internet it is
passed from router to router, with each one deciding which direction the packet should go for its
next hop towards its destination. Routing is the act of choosing a path over which to send
information
Because the internet is so large and because routers and the connections between them are
constantly changing, it is a very difficult job for each router to know the best way to reach any
destination on the internet. Routers use routing tables to make their routing decisions, so each
router tries to get as much information as possible into its own table. Routers do not need
routing information for every individual IP address; they only need routing information for
networks, identified by IP network number and mask.
Routers use routing algorithms to make decisions for a particular datagram based on current
routing information.
533579378
Page 1
COMM3380 - Computer Networks
DT080
2.1.1
2006/2007
Routing Tables
Routing is the primary function of TCP/IP network layer. The IP header contains the source IP
address and the destination IP address. We have seen that these IP addresses remain the
same as an IP datagram travels from source to destination across an internet. The router uses
the IP address information to decide where to send an incoming packet.
There are two main ways a router knows where to send packets. The administrator can assign
static routes, or the router can learn routes by employing a dynamic routing protocol.
2.1.2
1
Static routing tables are established by the network administrator before the beginning
of routing and are updated manually, thus do not change unless the network
administrator changes them. Static routing algorithms are simple to design and work
well in environments where network traffic is relatively predictable and where network
design is relatively simple. However, they cannot react to network changes, so are
considered unsuitable for large, constantly changing networks.
2
Dynamic routing tables are updated automatically when the routing configuration of the
network changes. For example, when a router on the network is powered down, then the
router sends a message informing all other routers on that sub-net, so they can update
their routing tables.
Routing Table Examples
A multi-homed PC can be used as a router to connect the two subnets of a test LAN. As
Windows 98 is designed for personal computing, it is not an ideal operating system for the multihomed PC. Windows NT/2K/XP on the other hand is designed to operate as a server and
supports dynamic routing protocols as well as static routing.
ROUTE.exe is a windows command-line tool used to manipulate network routing tables.
ROUTE [-f] [command [destination] [MASK netmask] [gateway]]
-f
Clears the routing tables of all gateway entries. If this is
used in conjunction with one of the commands, the tables are
cleared prior to running the command.
command
Specifies one of four commands
PRINT
Prints a route
ADD
Adds a route
DELETE
Deletes a route
CHANGE
Modifies an existing route
destination Specifies the host to send command.
MASK
If the MASK keyword is present, the next parameter is
interpreted as the netmask parameter.
netmask
If provided, specifies a sub-net mask value to be associated
with this route entry. If not specified, if defaults to
255.255.255.255.
gateway
Specifies gateway.
Table 1: ROUTE.EXE Usage
If the command is print or delete, wildcards may be used for the destination and gateway, or the
gateway argument may be omitted.
533579378
Page 2
COMM3380 - Computer Networks
DT080
2006/2007
There are three possible routing outcomes for an IP datagram:
1. Pass the IP datagram to the protocol above IP on the local host
2. Forward the datagram using one of the locally attached NICs
3. Discard the datagram
The routing table maintains the following types of route:
 Host, i.e. a route to a specific IP address
 Subnet, i.e. a route to a subnet
 Network, i.e. a route to an entire network
 Default, used when there is no other match
C:\Windows>route print
Active Routes:
Network Address
Netmask Gateway Address
0.0.0.0
0.0.0.0
192.168.1.1
127.0.0.0
255.0.0.0
127.0.0.1
192.168.1.0
255.255.255.0
192.168.1.3
192.168.1.3 255.255.255.255
127.0.0.1
192.168.1.255 255.255.255.255
192.168.1.3
224.0.0.0
224.0.0.0
192.168.1.3
255.255.255.255 255.255.255.255
192.168.1.3
Default gateway: 192.168.1.1
Interface Metric
192.168.1.3
1
127.0.0.1
1
192.168.1.3
1
127.0.0.1
1
192.168.1.3
1
192.168.1.3
1
192.168.1.3
1
The route table above is for a host with an IP address of 192.168.1.3, subnet mask of
255.255.255.0 and a default gateway of 192.168.1.1. It contains the following entries:
1
2
3
4
5
6
7
Address 0.0.0.0 Netmask 0.0.0.0 -> the default gateway
Address 127.0.0.0 is the loopback address
Address 192.168.1.0 Netmask 255.255.255.0 -> is a route to the subnet on which the
host resides.
Address 192.168.1.3 Netmask 255.255.255.255 -> is a host route for the local host
Address 192.168.1.255 Netmask 255.255.255.255 -> is for network broadcast address
Address 224.0.0.0 Netmask 240.0.0.0 -> is for IP Multicasting
Address 255.255.255.255 Netmask 255.255.255.255 -> is for limited broadcast
In this example, if a packet is sent to 192.168.1.4, the closest matching route is the local subnet
route (192.168.1.0 mask 255.255.255.0), thus the packet is sent out via the interface
192.168.1.3. If a packet is sent to 192.168.2.10, then the closest matching route is the default
gateway, thus the packet is forwarded to the default gateway.
Netstat.exe
The Windows command-line tool used called netstat.exe can also be used to display the routes
currently active on a PC running windows. Netstat shows the routing table and active
connections for a computer. To deliver a message to a remote network, it must be transmitted
from the source node to a local router ( called a default gateway). In the above example, the
default gateway has an IP address of 192.168.1.1.
533579378
Page 3
COMM3380 - Computer Networks
DT080
2.2
2006/2007
Routing Protocols
Routers constantly add to and change the contents of their dynamic routing tables by
automatically exchanging routing table contents with routers around them. The protocols used to
exchange routing information are referred to as routing protocols. Routing protocols operate
at the TCP/IP network layer as shown below:
PING
Telnet
Application
SMTP
tracert
Layer
FTP
Transport
TCP Layer
BOOT
P
DN
S
TFTP
UDP
Network Layer
Routing Protocols
e.g.
RIP, OSPF, BGP
IGMP
IP
routing
table
ARP
Hardware Interface
Link Layer
ICMP
RAR
P
Physical Media
Figure 2: TCP/IP Network Layer
Commonly used routing protocols include Routing Information Protocol (RIP), Open Shortest
Path First (OSPF), Interior Gateway Routing Protocol (IGRP) and Border Gateway Protocol
(BGP).
2.2.1
Routing vs Routed Protocols
A routing protocol exchanges routing information about the network to and from other routers.
A routed protocol can be routed by a router, which means that it can be forwarded from one
router to another. A routed protocol contains the data elements required for a packet to be sent
outside of its host network or network segment. In other words, a routed protocol can be routed.
IP is an examples of a routed protocol. Examples of routing protocols include RIP and IGRP.
533579378
Page 4
COMM3380 - Computer Networks
DT080
2.3
2006/2007
What is an Autonomous System?
An autonomous system (AS) is an area of the internet in which routing is managed by a single
organisation. For example, the whole of the network in a university could be one autonomous system. The
whole of the HEAnet could be another. HEAnet is spread all over Ireland, and has arms reaching out to
New York. A worldwide system of connections and routers administered by a single communications
company is another autonomous system. The internet can be divided into many autonomous systems,
some very small and some very large.
Each autonomous system has a single and clearly defined external routing policy. Different routing
protocols are used when routing within an autonomous system as when routing between autonomous
systems.
1
Interior Gateway Protocols (IGP) used within an autonomous system
2
Exterior Gateway Protocols(EGP) used between autonomous systems
Interior Gateway
Protocols
AS
R
R
R
R
Interior Gateway
Protocols
Exterior Gateway
Protocols
R
R
R
AS
R
R
R
R
AS
AS – Autonomous System
R - Router
Figure 3:
An autonomous system contains many routers,
and routing is managed by a single organisation
An autonomous system may contain one or more networks, where each network is represented by a
network IP address and a network mask. The DIT autonomous system contains just one network
(147.252.0.0, 255.255.0.0), but many autonomous systems contain more than one.
When a packet travels from one computer across the internet to another computer it may cross many ASs.
In a typical case it might leave the AS containing the originating computer (e.g. the DIT or HEAnet),
travel across the AS of some international communications company (e.g. MCI or Global Crossing), to
reach the AS of an ISP somewhere in the world, and then arrive at the AS of the destination computer.
533579378
Page 5
COMM3380 - Computer Networks
DT080
2.3.1
2006/2007
Autonomous System Numbers (ASN)
Every public autonomous system has a unique autonomous system number (ASN), allocated to it by the
authority responsible for that area of the world (RIPE, APNIC, ARIN, LACNIC or AfriNIC, the five
Regional Internet Registries (RIRs)). An ASN is a 16 -bit number, and is only used in the exchange of
routing information between autonomous systems (i.e. between exterior routers). ASNs are not used in the
passing of normal data packets between routers.
Not every organisation needs an ASN for its network. An ASN is only needed if the organisation's
network is multi-homed. That is, an ASN is only needed if the network is connected to the internet via
more than one internet service provider (ISP). In most cases, an organisation does not need its own ASN
because it is part of the autonomous system of its ISP. The routing policies and routing administration of
the ISP are sufficient for its external routing needs. Most networks are simply internet 'cul de sacs'
attached to an ISP, and therefore do not need to consider routing at the level of autonomous system.
533579378
Page 6
COMM3380 - Computer Networks
DT080
2006/2007
Routing Approaches
When the internet was very small it contained a small number of routers and it was possible to
configure all of them to contain information about routes to all networks. This is no longer
practical, because of the amount of routing information that would have to be held by every
router, and because of the frequent changes in routing information that would have to be applied
to every router.
An alternative approach is that most routers contain only partial information. That is, they
contain routing information for some networks, and a default route to be used for packets
destined for other networks. One structure that uses this is the core gateway approach. In this, a
small number of carefully managed core gateways (routers) contain routing information for all
networks. These core routers are distributed (geographically) around the internet. All other
routers contain routing information for networks near them, and a default route that leads to one
of the core gateways. When a non-core router receives a packet for which it does not have a
specific route, it sends it along its default route to a core router. The core router will know which
route to send the packet on to reach a non-core router that will have a specific route to reach the
destination. Principal disadvantages of the core gateway approach are:
1
Core routers must be constantly reconfigured for every routing change anywhere on the
internet.
2
An error in the configuration of the core routers could disrupt all communications (single
point of failure).
A variation on this is the backbone approach. A set of routers form a backbone in which each
backbone router has routing information for a part of the internet, and a default route that leads
to another backbone router. The default routes from each backbone router form a circle, and
between them the backbone routers contain routing information for all networks. Non-backbone
routers have routing information for networks near them, and a default route that leads to one of
the backbone routers. When a non-backbone router receives a packet for which it does not have
a specific route, it sends it along its default route to a backbone router. The packet is then
passed around the default routes of the backbone until it arrives at a backbone router that has
routing information for the destination. Disadvantages of this approach include:
1
Inefficient routing. Packets travel around the backbone even if there is a shorter path.
Each core router knows all routes; others default to a core router.
Knowledge of all routes is split between backbone routers, and defaults form a circle.
533579378
Page 7
COMM3380 - Computer Networks
DT080
3.
2006/2007
Routing Algorithms
Internet routing protocols employ a number of approaches to gathering routing information, for
example: distance-vector routing and link-state.
3.1
Distance-Vector Algorithm
The distance-vector algorithm (also known as Bellman-Ford algorithm) is a way of representing
and processing routing information when it is exchanged between routers. Various routing
protocols use this algorithm.
For this algorithm routing information is represented as a destination (the vector part) and a
distance to the destination (in hops). A router can represent all the information in its routing table
as a list of pairs of destination and distance values. At regular intervals each router sends its
routing table as distance vector values to each of its neighbouring routers. The list of distancevector values are, in effect, a statement by the router of what networks it knows it can reach and
how far away they are. Networks that are directly connected to the router are at distance zero.
When a router first starts up, it knows only about networks that are directly connected to it, but
as distance-vector information arrives from neighbouring routers it learns more and more about
routes to more distant networks.
When a router receives a list of distance-vector values from a neighbouring router it considers
each distance-vector pair in turn and decides whether it should make a change in its existing
routing table. If a change or addition is made to the routing table then the route for the new entry
will be towards the router that sent the distance-vector list. The distance value received in a
distance-vector list must be incremented before being used in the routing table, to allow for the
hop from the receiving router back to the router that sent the list.
For each destination/distance pair of values the main possibilities and the actions to be taken by
the receiving router are:
1. If the destination is not in the routing table at all, then create a new table entry for it. This
occurs when information about a particular destination is received for the first time. 
2. If the destination is already in the routing table but the newly received distance-vector list
has a shorter distance to it, then change the routing table entry. This occurs when
information about a better route to an already known destination is received. 
3. If the destination is already in the routing table via the same route, but the newly
received distance-vector list has a distance value that is different (bigger or smaller) then
change the routing table entry. This occurs when part of an already known route
changes at a point one or more hops away from this router. 
4. Otherwise do nothing with this destination/distance pair of values.
Use of the distance-vector algorithm means that routing information gradually and automatically
spreads through the network of routers. Each router accumulates routing information received
from each of its neighbours, and periodically transmits everything it knows back to all its
neighbours. Some further points: 
1.
The distance-vector algorithm is only a way of exchanging information held in routing
tables; inside each router the routing information is held in a routing table, not as a
distance-vector list.
2.
For any destination, a router only knows which direction to go to reach it from here. The
router does not have any other information about the route to that destination.
533579378
Page 8
COMM3380 - Computer Networks
DT080
3.2
2006/2007
Operation of Distance Vector Algorithim
The Distance Vector (or Bellman-Ford) algorithm can be stated as follows:
Find the shortest path from a given source node subject to the constraint that the paths contain
at most one line, then find the shortest path with a constraint of paths of at most two links and so
on.
The algorithm can be formally described as follows:
Define:
dx(y) = cost of least cost path from node x to node y
c(x,v) = link cost from v to x, where c(v,v)=0, c(v,x) = ∞ if x and v not directly
connected, c(v,x)≥0 if x and v directly connected
Then the Bellman-Ford Equation =>
dx(y) = minv { c(x,v) + dv(y) }
where minimum is taken over all neighbours of node x
Consider the following example graph model of a computer network.
5
3
B
2
C
2
3
5
1
F
A
1
1
Figure 4:
2
E
D
Graph Model of a Computer Network
The source node A has three neighbours: B, D and C. By considering various paths in the
graph it is easy to see that dB(F) = 5, dC(F) = 3 and dD(F) = 3. Taking then the costs of the links
c(A,B) = 2, c(A,D) =1 and c(A,C)=5 and feed this information into the Bellman-Ford equations
gives dA(F) = min { 2+5, 1+3, 5+3 } = 4 which is obviously true.
Hops dA(B) Vector
(Next Hop)
0
∞
--
dA(C)
dA(E)
∞
Vector
(Next Hop)
--
1
2
B
5
C
1
D
∞
--
∞
2
2
B
4
D
1
D
2
D
10
C
3
2
4
2
B
3
D
1
D
2
D
4
D
B
3
D
1
D
2
D
4
D
Figure 5:
533579378
∞
Vector
(Next Hop)
--
dA(D)
∞
Vector
(Next Hop)
--
Example of DV Algorithm (source = A)
Page 9
dA(F)
∞
Vector
(Next Hop)
---
COMM3380 - Computer Networks
DT080
2006/2007
This result in the following routing table:
Table 1: Routing Table for Example 1
Dest
Cost
Next Hop
B
2
B
C
3
D
D
1
D
E
2
D
F
4
D
Thus the Distance-Vector algorithm works as follows:
Define N = all nodes in a network
At each node x:
1
Initialisation:
For all destination nodes y in N:
dx(y )= c(x,y)
if y is not a neighbour then c(x,y) = ∞
For each neighbour node w:
dw(y )= = ∞ for all destinations y in N
For each neighbour node w:
Send distance vector dx = [dx(y) : y in N] to w
2
Loop
Wait until a link cost change is seen in some neighbour w or until a distance-vector is
received from some neighbour w
For each node y in network N
dx(y) = minv { c(x,v) + dv(y) }
If dx(y) has changed for any destination y
Send distance vector dx = [dx(y) : y in N] to all neighbouring nodes
533579378
Page 10
COMM3380 - Computer Networks
DT080
Exercise 1:
2006/2007
Cost = Hop Count
B
1
1
C
1
A
1
1
D
1
E
1
F
1
Figure 6:
G
DV Example– Node A Routing Table
Fill in following table for each iteration of DV algorithm
Hops dA(B) Vector
(Next Hop)
0
∞
--
dA(C)
∞
Vector
(Next Hop)
--
dA(D)
∞
Vector
(Next Hop)
--
dA(E)
∞
Vector
(Next Hop)
--
dA(F)
1
2
3
Figure 7:
Exericse DV Algorithm (source = A)
Fill in following final routing table:
Dest
Distance
No Hops
Vector
Next Hop
B
C
D
E
F
G
Figure 8:
533579378
Exericse Routing Table (source = A)
Page 11
∞
Vector
(Next Hop)
--
dA(G)
∞
Vector
(Next Hop)
--
COMM3380 - Computer Networks
DT080
2006/2007
Exercise 2:
If the link between F and G goes down what will happen?
B
1
1
C
1
A
1
1
D
1
E
1
F
G
Figure 9:
DV Example– Node A Routing Table
Fill in following table for each iteration of DV algorithm
Hops dA(B) Vector
(Next Hop)
0
∞
--
dA(C)
∞
Vector
(Next Hop)
--
dA(D)
∞
Vector
(Next Hop)
--
dA(E)
∞
Vector
(Next Hop)
--
dA(F)
1
2
3
Figure 10:
Exericse DV Algorithm (source = A)
Fill in following final routing table:
Dest
Distance
No Hops
Vector
Next Hop
B
C
D
E
F
G
Figure 11:
533579378
Exericse Routing Table (source = A)
Page 12
∞
Vector
(Next Hop)
--
dA(G)
∞
Vector
(Next Hop)
--
COMM3380 - Computer Networks
DT080
2006/2007
Link-State Algorithm
The link-state algorithms use the principle of a link state to determine network topology. A link
state is the description of an interface on a router (for example, IP address, subnet mask, type
of network) and its relationship to neighbouring routers. The collection of these link states forms
a link state database.
The process used by link state algorithms to determine network topology is as follows:

Each router identifies all other routing devices on the directly connected networks.

Each router advertises a list of all directly connected network links and the associated
cost of each link. This is performed through the exchange of Link State
Advertisements (LSAs) with other routers in the network.

Using these advertisements, each router creates a database detailing the current
network topology. The topology database in each router is identical.

Each router uses the information in the topology database to independently run the
shortest-path-first algorithm based on Dijkstra’s Algorithm to determine the shortest
path from itself to each destination network. This information is used to update the IP
routing table.
The SPF algorithm is used to process the information in the topology database. It provides a
tree-representation of the network. The device running the SPF algorithm is the root of the tree.
The output of the algorithm is the list of shortest-paths to each destination network.
Because each router is processing the same set of LSAs, each router creates an identical link
state database. However, because each device occupies a different place in the network
topology, application of the SPF algorithm produces a different tree for each router. The OSPF
protocol is a popular example of a link state routing protocol.
533579378
Page 13
COMM3380 - Computer Networks
DT080
3.2.1
2006/2007
Dijkstra’s Algorithm
Define:
– D(v) = current cost from of path from source to destination v
– p(v) = predecessor node along path from source to v
– N = set of nodes in network
– N’ = set of nodes whose least cost path is known
– c(x,v) = link cost from v to x
• c(v,v)=0, c(v,x) = ∞ if x and v not directly connected, c(v,x)≥0
Initialisation
– N’ = {source}
– For all nodes v
• If v is a neighbouring node then
– D(v) = c(source, v)
• Else D(v) = ∞
Loop
Get Next Node
– find w not in N’ such that D(w) is a minimum
– Add w to N’
Update Least Cost Paths
– Update D(v) for all nodes v adjacent to w and not in N’
D(v) = min{ D(v), D(w) + c(w,v) }
Until all nodes in N’
5
Dijsktra’s
Algorithm
2
2
A
D(v) = min{ D(v), D(w) + c(w,v) }
1
D
3
C
5
1
1
F
2
E
Step
N’
D(B), path
D(C), path
D(D), path
D(E), path
D(F), path
0
A
2, A-B
5, A-C
1, A-D
∞ --
∞ --
1
A,D
2, A-B
4, A-D-C
1, A-D
2, A-D-E
∞ --
2
A,B,D
2, A-B
4, A-D-C
1, A-D
2, A-D-E
∞ --
3
A,B,D,E
2, A-B
3, A-D-E-C
1, A-D
2, A-D-E
4, A-D-E-F
4
A,B,C,D,E
2, A-B
3, A-D-E-C
1, A-D
2, A-D-E
4, A-D-E-F
5
A,B,C,D,E,F 2, A-B
3, A-D-E-C
1, A-D
2, A-D-E
4, A-D-E-F
Figure 12:
533579378
3
B
Dijsktra’s Algorithm Example– (source = Node A)
Page 14
COMM3380 - Computer Networks
DT080
2006/2007
Thus Node A’s view of the network is as follows:
A
1
2
D
1
B
E
2
1
F
C
Note Dijsktra’s algorithm gives the same resulting routing table as we got earlier using the
Bellman-Ford algorithm:
Table 2: Routing Table for Node A
Dest
Cost
Next Hop
B
2
B
C
3
D
D
1
D
E
2
D
F
4
D
Example 2:
Consider the following example:
7
A
5
B
C
4
2
3
E
6
F
D
LS Database
Side 1 Side 2
A
C
A
E
B
C
C
A
C
B
C
D
D
C
D
E
E
A
E
D
E
F
F
E
Cost
7
4
5
7
5
2
2
3
4
3
6
6
Through the exchange of Link State Advertisements, each router creates a database detailing
the current network topology. The topology database in each router is identical.
533579378
Page 15
COMM3380 - Computer Networks
DT080
Dijsktra’s
Algorithm
2006/2007
B
5
A
C
7
2
4
E
D
3
D(v) = min{ D(v), D(w) + c(w,v) }
6
F
Step
N’
D(B), path
D(C), path
D(D), path
D(E), path
D(F), path
0
A
∞ --
7, A-C
∞ --
4, A-E
∞ --
1
A,E
∞ --
7, A-C
7, A-E-D
4, A-E
10, A-E-F
2
A,C,E
12, A-C-B
7, A-C
7, A-E-D
4, A-E
10, A-E-F
3
A,C,D,E
12, A-C-B
7, A-C
7, A-E-D
4, A-E
10, A-E-F
4
A,C,D,E,F
12, A-C-B
7, A-C
7, A-E-D
4, A-E
10, A-E-F
5
A,B,C,D,E,F 12, A-C-B
7, A-C
7, A-E-D
4, A-E
10, A-E-F
Dijsktra’s Algorithm Example– (source = Node A)
Figure 13:
Each node creates a map of the network from its point of view
A
4
7
C
E
5
B
D
Route Map from Router A Point of View
Destination
Next Hop
B
C
C
C
D
E
E
E
F
E
Figure 14:
533579378
6
3
Page 16
F
Cost
12
7
7
4
10
Node A’s view of Network
COMM3380 - Computer Networks
DT080
4.
2006/2007
Exterior and Interior Gateway Protocols
We can classify the routers as exterior or interior. Interior routers are completely within one
autonomous system, with connections only to routers that are within the same AS. An interior
router does not deal with traffic entering or leaving the AS.
Exterior routers have at least one connection to a router that is in another autonomous system,
and therefore they have to deal with traffic entering and leaving their AS. Exterior routers are at
the edges of an AS, while interior routers are inside an AS.
Exterior routers are concerned with routing traffic between ASs. Interior routers need only be
concerned with routing traffic within and across their AS. Routing protocols, used between
routers to exchange routing information, can be broadly divided into exterior gateway protocols
(EGP) and interior gateway protocols (IGP). An EGP is used between exterior routers, to
exchange information about routing between autonomous systems. An IGP is used between
interior routers of a single autonomous system, to exchange information about routing inside
that autonomous system.
An EGP can be very complex, because it may have to deal with routing information for a very
large area of the internet. An IGP can be simpler, because it deals with routing in a limited part
of the internet (one autonomous system), and all the routers in a group communicating using an
IGP are under the control of a single administration.
Exterior routers are at the edges of the AS, and have connections to exterior routers in other ASs.
533579378
Page 17
COMM3380 - Computer Networks
DT080
4.1
2006/2007
Routing Information Protocol (RIP)
Routing Information Protocol (RIP) is an Interior Gateway Protocol (IGP) developed by Xerox
Corporation in the early 1980s. RIP is only used within an autonomous system to exchange
routing information between interior routers. There are two kinds of participants in RIP: active
and passive. Active RIP participants broadcast their routing information at regular intervals
(usually every 30 seconds), and listen for RIP broadcasts from others. Active RIP participants
are usually routers. Passive RIP participants do not broadcast any routing information; they only
listen for other RIP broadcasts. Passive RIP participants are usually desktop computers,
listening for information about where to send data packets that they want to transmit.
Regular RIP broadcasts use UDP to port 520, so any network device can pick up the RIP
information by listening on that port. Each RIP broadcast contains routing information as a
distance-vector list, specifying the destination networks and distances that the sending router
knows about. Any device receiving the list can incorporate the information into its own routing
table, adding 1 to the received distance values and recording the interface on which the list was
received as the interface on which to transmit to reach the specified destination network. Thus,
routing information spreads throughout the network over a period of a few minutes, and
eventually every router knows which direction to go to reach any part of the network.
In the distance-vector list used by RIP, a distance of zero for a network means the network is
directly connected to the router. The maximum distance value is 16, which is used to represent
infinity. A network listed as at distance 16 is not reachable. This limits the size of a system using
RIP to a maximum of 15 routers between any two networks within the system.
4.1.1
RIP packet types
The RIP protocol specifies two packet types. These packets may be sent by any device running
the RIP protocol:

Request packets: A request packet queries neighbouring RIP nodes to obtain their
distance vector table. The request indicates if the neighbour should return either a
specific subset or the entire contents of the table.

Response packets: A response packet is sent by a device to advertise the information
maintained in its local distance vector table. The table is sent during the following
situations:
o The table is automatically sent every 30 seconds.
o The table is sent as a response to a request packet generated by another RIP
node.
o If triggered updates are supported, the table is sent when there is a change to the
local distance vector table.
When a response packet is received by a device, the information contained in the update is
compared against the local distance vector table. If the update contains a lower cost route to a
destination, the table is updated to reflect the new path.
533579378
Page 18
COMM3380 - Computer Networks
DT080
4.1.2
2006/2007
RIP Message Format
The RIP message is encapsulated in UDP datagrams. RIP version 1 is specified in RFC1058,
RIP version 2 is specified in RFC1723.
IP header
20 bytes
UDP header
RIP message
8 bytes
Figure 4-1: RIP Frame Enscapsulated in UDP datagram
RIP
0
4
8
12
message
16
20
command (1-6)
version (1)
address family
24
28 ......31
all zeros
all zeros
32-bit IP address
all zero
all zero
metric (1-16)
upto 24 more route with same 20 byte format
:
RIP-2
0
4
8
12
message
16
command (1-6)
version (2)
address family = 0xFFFF
Authentication Data (16 Bytes)
20
24
28 ......31
reserved
Authentication Type
address family
routing tag
32-bit IP address
32-bit subnet mask
32-bit next hop address
metric (1-16)
upto 24 more route with same 20 byte format
:
Figure 4-2: RIP-2 Message Format showing an Authentication Entry
The first four bytes are the same for RIP-1 and RIP-2
 The command field specifies the purpose of this datagram/ Command =1 indicates a
request message, command = 2 indicates a response message.
 Version = 1 for RIP-1 and 2 for RIP-2
The AFI, address family indicator for IP is 2.
RIP-1 includes the IP address of the destination node and a metric with a value between 1 and
15 specifying the current metric for this destination or a value of 16 indicating the destination is
unreachable.
A RIP-2 packet can include an Authentication Entry. The first entry in the message can be
either a routing entry or an authentication entry. If an authentication entry is included, then 24
additional routing entries can be provided, if no authentication entry then 25 routing entries can
be provided.
The routing tag field is intended to differentiate between internal and external routes which may
be imported from an EGP or another IGP.
RIP-2 includes a subnet mask field and next hop field for the referenced network.
533579378
Page 19
COMM3380 - Computer Networks
DT080
4.1.3
2006/2007
RIP Difficulties
When a router receives a RIP broadcast from a neighbouring router it incorporates the received
information into its own routing table according to the rules for using distance-vector lists. In
brief, these are:

If the destination is not in the table, then create a new table entry for it.

If the destination is already in the table via a different route but the received list gives a
shorter distance to it, then change the table entry.

If the destination is already in the table via the same route, but the received list gives a
distance that is different then change the table entry.

Otherwise do nothing with this destination/distance pair of values.
Figure 3:
Failure of a link could result in the creation of a routing loop.
While these seem like reasonable rules, they lead to a problem called the count to infinity
problem. Assume that network X is connected to router B, which in turn is connected to router A.
B can reach X at distance 0, and A can reach X at distance 1 (via B). Assume now that the
connection from router B to network X fails, and as a result router B marks network X as
unreachable in its own routing table. Then router A broadcasts its distance-vector list as usual.
When router B receives it and sees that router A can reach network X at distance 1, it
mistakenly thinks that router A has an alternative path to network X and creates a new entry in
its own routing table to say that network X is reachable at distance 2 via router A. There is now
a routing loop between A and B for any packet destined for network X.
The problem is complicated by a further issue. When router B next broadcasts its distancevector list, it includes the information that network X is reachable at distance 2. When router A
receives this, it notices that the distance to network X reported by router B has changed from 0
to 2, and therefore updates its own table to change the distance to network X from 1 to 3. On
the next RIP broadcast by A, a similar thing happens in router B, and it changes the distance to
network X from 2 to 4. This game of ping-pong between routers A and B carries on, with the
apparent distance to network X increasing on each RIP broadcast. The distance count stops
increasing when it reaches the maximum value of 16.
533579378
Page 20
COMM3380 - Computer Networks
DT080
4.1.4
2006/2007
Split Horizon/ Split Horizon with Poison Reverse
The excessive convergence time caused by counting to infinity may be reduced with the use of
the split horizon rule. This rule dictates that when a router broadcasts its distance-vector list
from one of its network interfaces, it must omit any information that was received on that
interface. This means that a route will never be advertised back to the router that provided it. In
the Figure 3 described above, it means that when router A sends a distance-vector list towards
router B it will not include the information about a route to network X, and therefore the routing
loop will not be created.
The limitation to the slit horizon rule is that each node must wait for the route to the unreachable
destination to time out before the route is removed from the distance vector table. In RIP
environments, this timeout is at least three minutes after the initial outage. During that time, the
device continues to provide erroneous information to other nodes about the unreachable
destination. This propagates routing loops and other routing anomalies.
RFC 1058 RIP standard specifies an enhanced split horizon with poison reverse algorithm.
With poison reverse, all known networks are advertised in each routing update. However, those
networks learned through a specific interface are advertised as unreachable in the routing
announcements sent out to that interface. This drastically improves convergence time in
complex, highly-redundant environments. With poison reverse, when a routing update indicates
that a network is unreachable, routes are immediately removed from the routing table. This
breaks erroneous, looping routes before they can propagate through the network. This approach
differs from the basic split horizon rule where routes are eliminated through timeouts. Poison
reverse has no benefit in networks with no redundancy (single path networks)
Despite this precaution, routing loops can occur in any network (whatever routing protocol it
uses) due to router configuration errors. To prevent this from causing a huge traffic jam as more
and more packets join such a loop, every IP packet has a time to live (TTL) value in its header.
The TTL is set to a positive value when each packet is first transmitted, and is decremented by
each router as it receives the packet. If the TTL of a packet becomes zero, the router discards it.
Normally, the packet reaches its destination before its TTL becomes zero.
533579378
Page 21
COMM3380 - Computer Networks
DT080
4.1.5
2006/2007
RIP limitations
There are a number of limitations observed in RIP environments:

Path cost limits: The resolution to the counting to infinity problem enforces a maximum
cost for a network path. This places an upper limit on the maximum network diameter.
Networks requiring paths greater than 15 hops must use an alternate routing protocol.

Network-intensive table updates: Periodic broadcasting of the distance vector table can
result in increased utilization of network resources. This can be a concern in reducedcapacity segments.

Relatively slow convergence: RIP, like other distance vector protocols, is relatively slow
to converge. The algorithms rely on timers to initiate routing table advertisements.

No support for variable length subnet masking: Route advertisements in a RIP
environment do not include subnet masking information. This makes it impossible for
RIP networks to deploy variable length subnet masks.
RIP Version 2 (RIP-2): RIP-2 is also a distance vector protocol designed for use within an AS. It
was developed to address the limitations observed in RIP-1. RIP-2 is described in RFC 1723.
The standard was published in late 1994. (Note in practice, the term RIP refers to RIP-1, i.e. RIP
version 1). RIP-2 was developed to extend RIP-1 functionality in small networks. RIP-2 provides
these additional benefits not available in RIP-1:

Support for CIDR and variable length subnet masking.

Support for multicasting: RIP-2 supports the use of multicasting rather than simple
broadcasting of routing annoucements. This reduces the processing load on hosts not
listening for RIP-2 messages. To ensure interoperability with RIP-1 environments, this
option is configured on each network interface.

Support for authentication: RIP-2 supports authentication of any node transmitting route
advertisements. This prevents fraudulent sources from corrupting the routing table.

Support for RIP-1: RIP-2 is fully interoperable with RIP-1. This provides backwardcompatibility between the two standards.
As noted in the RIP-1 section, one notable shortcoming in the RIP-1 standard is the
implementation of the metric field. RIP-1 specifies the metric as a value between 0 and 16. To
ensure compatibility with RIP-1 networks, RIP-2 preserves this definition. In both standards,
networks paths with a hop-count greater than 15 are interpreted as unreachable.
533579378
Page 22
COMM3380 - Computer Networks
DT080
4.1.6
2006/2007
Open Shortest Path First (OSPF) The Open Shortest Path First (OSPF) protocol is another
example of an interior gateway protocol. OSPF is a link state IP protocol that is primarily used
within autonomous systems but can also be used as an EGP as well. OSPF includes
authentication and has become the IP routing protocol of choice in large environments. It was
developed as a non-proprietary routing alternative to address the limitations of RIP. Initial
development started in 1988 and was finalized in 1991. Subsequent updates to the protocol
continue to be published. The current version of the standard is documented in RFC 2328.
OSPF provides a number of features not found in distance vector protocols. The following
features contribute to the continued acceptance of the OSPF standard:

Equal cost load balancing: The simultaneous use of multiple paths may provide more
efficient utilization of network resources.

Logical partitioning of the network: This reduces the propagation of outage information
during adverse conditions. It also provides the ability to aggregate routing
announcements that limit the advertisement of unnecessary subnet information.

Support for authentication: OSPF supports the authentication of any node transmitting
route advertisements. This prevents fraudulent sources from corrupting the routing
tables.

Faster convergence time: OSPF provides instantaneous propagation of routing changes.
This expedites the convergence time required to update network topologies.

Support for CIDR and variable length subnet masking: This allows the network
administrator to efficiently allocate IP address resources.
OSPF supports hierarchical routing within an autonomous system. Autonomous systems can be
divided into routing areas. A routing area is typically a collection of one or more subnets that are
closely related. An OSPF area effectively divides an OSPF domain into sub-domains. A router
in an area knows only about the area it is in. All routers in the same area have identical Link
State database. The use of areas allows administrators to cluster groups of routers together to
reduce the CPU load and memory needed for running OSPF on every router. Area 0 must exist
in all OSPF implementations and should be the backbone area of the network. All areas must
connect to the backbone area.
533579378
Page 23
COMM3380 - Computer Networks
DT080
2006/2007
OSPF Operation
Received
LSAs
Link State
Database
Dijkstra’s
Algorithm
IP Routing
Table
LSAs are flooded
to other interfaces
•
•
Link State -> status of link between two routers, relationship to neighbour
router
Cost - metric assigned to link (cisco -> based on media speed (10^8/ link
bandwidth))
•
•
LSA - Link-State Advertisements - includes interfaces, associated cost and
network information.
Link-State Database (Topology Database)
– listing of link-state entries from all other routers in area,
– same database for each router in an area, generated from LSAs received
Figure 4:
OSPF Operation
OSPF enabled routers send hello packets out all OSPF enabled interfaces. Neighbour routers
on same multi-access networks form adjacencies based on matching hello packet parameters.
Routers send Link State Advertisements (LSA) over its adjacencies., The LSA include link id,
state of the link, cost and neighbours of the link.
Routers receives other LSAs and records it in its Link State Database. Then it forwards the
LSA out its enabled interfaces. LSAs flood the OSPF area and each router has same LSA
database. Router uses Dijsktra’s Algorithm to build a SPF tree describing the shortest path to
every destination. A router then uses the SPF tree to build its routing table.
OSPF Cost
OSPF uses cost as the metric for determining the best route. The best route will have the
lowest cost. Cost is based on bandwidth of an interface. For Cisco OSPF, cost is calculated
using the formula:
Cost

10 8
Bandwidth
Lowest cost = best path
Costs for Various Interface Types:
Figure 5:
533579378
Page 24
Example of OSPF Costs – ref CISCO.
COMM3380 - Computer Networks
DT080
4.1.7
2006/2007
IGRP
With the creation of the Interior Gateway Routing Protocol (IGRP) in the early 1980s, Cisco
Systems was the first company to solve the problems associated with using RIP to route
datagrams between interior routers. IGRP determines the best path through an internet by
examining the bandwidth and delay of the networks between routers. IGRP converges faster
than RIP, thereby avoiding the routing loops caused by disagreement over the next routing hop
to be taken. Further, IGRP does not share RIP's hop count limitation. As a result of these and
other improvements over RIP, IGRP enabled many large, complex, topologically diverse
internetworks to be deployed.
Cisco has recently enhanced IGRP to handle the increasingly large, mission-critical networks
being designed today. This new version of IGRP is called Enhanced IGRP. Enhanced IGRP
combines the ease of use of traditional distance vector routing protocols with the fast rerouting
capabilities of the newer link state routing protocols.
Enhanced IGRP consumes significantly less bandwidth than IGRP because it is able to limit the
exchange of routing information to include only the changed information. In addition, Enhanced
IGRP is capable of handling AppleTalk and Novell IPX routing information, as well as IP routing
information.
4.1.8
Integrated IS-IS
Intermediate System to Intermediate System (ISO 10589 IS-IS): OSI based connection-less link
state protocol. It is similar in many ways to OSPF. IS-IS can operate over a variety of
subnetworks, including broadcast LANs, WANs, and point-to-point links.
Integrated IS-IS is an implementation of IS-IS for more than just OSI protocols. Today,
Integrated IS-IS supports both OSI and IP protocols.
Like all integrated routing protocols, Integrated IS-IS calls for all routers to run a single routing
algorithm. Link state advertisements sent by routers running Integrated IS-IS include all
destinations running either IP or OSI network-layer protocols. Protocols such as ARP and ICMP
for IP and End System-to-Intermediate System (ES-IS) for OSI must still be supported by
routers running Integrated IS-IS.
533579378
Page 25
COMM3380 - Computer Networks
DT080
5.
2006/2007
Exterior Gateway Protocols
EGPs provide routing between autonomous systems (AS). The two most popular EGPs in the
TCP/IP community are discussed in this section.
5.1
EGP
The first widespread exterior routing protocol was the Exterior Gateway Protocol. EGP provides
dynamic connectivity but assumes that all autonomous systems are connected in a tree
topology. This was true in the early Internet but is no longer true.
Although EGP is a dynamic routing protocol, it uses a very simple design. It does not use
metrics and therefore cannot make true intelligent routing decisions. EGP routing updates
contain network reachability information. In other words, they specify that certain networks are
reachable through certain routers. Because of its limitations with regard to today's complex
internetworks, EGP is being phased out in favor of routing protocols such as BGP.
5.2
BGP
BGP represents an attempt to address the most serious of EGP's problems. Like EGP, BGP is
an inter-AS routing protocol created for use in the Internet core routers. Unlike EGP, BGP was
designed to prevent routing loops in arbitrary topologies and to allow policy-based route
selection.
BGP was co-authored by a Cisco founder, and Cisco continues to be very involved in BGP
development. The latest revision of BGP, BGP4, was designed to handle the scaling problems
of the growing Internet.
533579378
Page 26
Download