Computer Networks with
Internet Technology
William Stallings
Chapter 11
Interior Routing Protocols
Autonomous Systems (AS)
• Group of routers exchanging information via
common routing protocol
• Set of routers and networks managed by single
• Connected
—Except in time of failure
Interior Routing Protocol (IRP)
• Passes routing information between routers
within AS
• Does not need to be implemented outside AS
—Allows IRP to be tailored
• May be different algorithms and routing
information in different connected AS
• Need minimum information from other
connected AS
—At least one router in each AS must talk
—Use Exterior Routing Protocol (ERP)
Exterior Routing Protocol (ERP)
• Pass less information than IRP
• Router in first system determines route to
target AS
• Routers in target AS then co-operate to deliver
• ERP does not deal with details within target AS
Figure 11.4 Application of Exterior
and Interior Routing Protocols
Approaches to Routing –
• Each node (router or host) exchange information with
neighboring nodes
— Neighbors are both directly connected to same network
• First generation routing algorithm for ARPANET
• Node maintains vector of link costs for each directly
attached network and distance and next-hop vectors for
each destination
• Used by Routing Information Protocol (RIP)
• Requires transmission of lots of information by each
— Distance vector to all neighbors
— Contains estimated path cost to all networks in configuration
— Changes take long time to propagate
Approaches to Routing –
• Designed to overcome drawbacks of distance-vector
• When router initialized, it determines link cost on each interface
• Advertises set of link costs to all other routers in topology
— Not just neighboring routers
• From then on, monitor link costs
— If significant change, router advertises new set of link costs
• Each router can construct topology of entire configuration
— Can calculate shortest path to each destination network
• Router constructs routing table, listing first hop to each destination
• Router does not use distributed routing algorithm
— Use any routing algorithm to determine shortest paths
— In practice, Dijkstra's algorithm
• Open shortest path first (OSPF) protocol uses link-state routing.
• Also second generation routing algorithm for ARPANET
Exterior Router Protocols –
• Provide information about which networks can
be reached by a given router and ASs crossed to
get there
—Does not include distance or cost estimate
• Each block of information lists all ASs visited on
this route
—Enables router to perform policy routing
• e.g. avoid path to avoid transiting particular AS
—e.g. link speed, capacity, tendency to become
congested, and overall quality of operation, security
—e.g. minimizing number of transit ASs
11.2 Least Cost Algorithms
• Least-cost criterion
— If minimize number of hops, link value 1
— Link value may be inversely proportional to capacity,
proportional to current load, or some combination
— May differ in different two directions
— E.g. if cost equaled length of queue
• Cost of path between two nodes as sum of costs of links
• For each pair of nodes, find least cost path
• Two common algorithms
—Dijkstra's algorithm
—Bellman-Ford algorithm
Distance Vector Routing: RIP
• Each node exchange information with neighbors
—Directly connected by same network
• Each node maintains three vectors
—Link cost
—Distance vector
—Next hop vector
• Every 30 seconds, exchange distance vector
with neighbors
• Use this to update distance and next hop vector
Figure 11.1 A Configuration of
Routers and Networks
(changed to 1)
(changed to 1)
Figure 11.8 Distance Vector
Algorithm Applied to Figure 11.1
RIP Details –
Incremental Update
• Updates do not arrive from neighbors within
small time window
• RIP packets use UDP
• Tables updated after receipt of individual
distance vector
—Add any new destination network
—Replace existing routes with small delay ones
—If update from router R, update all routes using R as
next hop
RIP Details –
Topology Change
• If no updates received from a router within 180
seconds, mark route invalid
—Invalid timer: 180 sec
—Assumes router crash or network connection unstable
—Set distance value to infinity
• Actually 16
Counting to Infinity Problem (1)
Slow convergence may cause:
All links are assumed cost 1
B has distance to network 5 as 2, next hop D
A & C have distance 3
and next hop B
Counting to Infinity Problem (2)
• Suppose router D fails:
— B determines network 5 no longer reachable via D
• Sets distance to 4 based on report from A or C
— At next update, B tells A and C this
— A and C receive this and increment their network 5 distance to 5
• 4 from B plus 1 to reach B
— B receives distance count 5 and assumes
network 5 is 6 away
— Repeat until reach infinity (16)
— Takes 8 to 16 minutes to resolve
Split Horizon
• Counting to infinity problem caused by
misunderstanding between B and A, and B and C
— Each thinks it can reach network 5 via the other
• Split Horizon rule says do not send information about a
route back in the direction it came from
— Router sending information is nearer destination than you
— That is, A should not tell B “the distance to network 5”.
— Erroneous route now eliminated within time out period (180
Poisoned Reverse
• Send updates with hop count of 16 to neighbors
for route learned from those neighbors
—If two routers have routes pointing at each other
advertising reverse route with metric 16 breaks loop
—B tells A and C “distance to network 5 is 16”
Figure 11.9
RIP Packet
Format (v1)
1: request, 2: response
Address Family identifier:
IP, IPX, …
• Over UDP
• Multicast:
RIP v2
Route Tag: 0 or AS#
RIP Packet Format Notes
• Command: 1=request 2=reply
— Updates are replies whether asked for or not
— Initializing node broadcasts request
— Requests are replied to immediately
• Version: 1 or 2
• Address family: 2 for IP
• IP address: non-zero network portion, zero host portion
— Identifies particular network
• Metric
— Path distance from this router to network
— Typically 1, so metric is hop count
RIP Limitations
• Destinations with metric more than 15 are
—If larger metric allowed, convergence becomes
• Simple metric leads to sub-optimal routing
—Packets sent over slower links
• Accept RIP updates from any device
—Misconfigured device can disrupt entire configuration
Link-State Protocol: OSPF
• RIP limited in large internets
• Open Shortest Path First (OSPF)
• OSPF preferred interior routing protocol for
TCP/IP based internets
• Link state routing used
• Directly over IP
Link State Routing
• When initialized, router determines link cost on each
• Router advertises these costs to all other routers in
• Router monitors its costs
— When changes occurs, costs are re-advertised
• Each router constructs topology and calculates shortest
path to each destination network
• Not distributed version of routing algorithm
• Can use any algorithm
— Dijkstra
• Packet sent by source router to every neighbor
• Incoming packet resent to all outgoing links except
source link
• Duplicate packets already transmitted are discarded
— Prevent incessant retransmission
• All possible routes tried so packet will get through if
route exists
— Highly robust
• At least one packet follows minimum delay route
— Reach all routers quickly
• All nodes connected to source are visited
— All routers get information to build routing table
• High traffic load
Figure 11.10
Flooding Example
OSPF Overview
• Router maintains descriptions of state of local
• Transmits updated state information to all
routers it knows about
• Router receiving update must acknowledge
—Lots of traffic generated
• Each router maintains database
—Directed graph
Router Database Graph
• Vertices
• Transit
• Stub
• Edges
—Connecting two routers
—Connecting router to network
• Built using link state information from other
Figure 11.11 Sample
Autonomous System
Figure 11.12 Directed Graph of
Autonomous System of Figure 19.7
Link Costs
• Cost of each hop in each direction is called
routing metric
• OSPF provides flexible metric scheme based on
type of service (TOS)
—Normal (TOS 0)
—Minimize monetary cost (TOS 2)
—Maximize reliability (TOS 4)
—Maximize throughput (TOS 8)
—Minimize delay (TOS 16)
• Each router generates 5 spanning trees (and 5
routing tables)
Figure 11.13 The SPF Tree for
Router R6
• Make large internets more manageable
• Configure as backbone and multiple areas
• Area – Collection of contiguous networks and
hosts plus routers connected to any included
• Backbone – contiguous collection of networks
not contained in any area, their attached routers
and routers belonging to multiple areas
Operation of Areas
• Each area runs a separate copy of the link state
—Topological database and graph of just that area
—Link state information broadcast to other routers in
—Reduces traffic
—Intra-area routing relies solely on local link state
Inter-Area Routing
• Path consists of three legs
—Within source area
• Intra-area
—Through backbone
• Has properties of an area
• Uses link state routing algorithm for inter-area routing
—Within destination area
• Intra-area
Figure 11.14
OSPF Packet Header
* directly over IP
Packet Format Notes
Version number: 2 is current
Type: one of 5, see next slide
Packet length: in octets including header
Router id: this packet’s source, 32 bit
Area id: Area to which source router belongs
Authentication type: null, simple password or
• Authentication data: used by authentication
OSPF Packet Types
• Hello: used in neighbor discovery
• Database description: Defines set of link state
information present in each router’s database
• Link state request
• Link state update
• Link state acknowledgement