You are on page 1of 92

13-1

Chapter 13

Routing
Protocols
(RIP, OSPF, BGP)
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-2

Basic Routing Algorithms


There are two concepts relevant to routing of IP packets:
Packet Forwarding:
Usage of ready routing tables (RT) to forward packets (chapter 6)
Routing Algorithms:
Gathering information about the network topology and building RT
(this chapter)
The basic classes of dynamic routing algorithms:

Flooding
Distance vector routing
Link state routing
Path Vector Routing
McGraw-Hill
SDSU

The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

13-3

Flooding
Simple algorithm that doesn't require any information about the network:
Source transmits a copy of the packet to all of its neighbors.
Each neighbor retransmits the received packet to all of its neighboring nodes,
except to the node from which it received the packet. So does every node in the
network. After a while, the nodes will start receiving duplicates. The intermediate
nodes do not retransmit the duplicates. The destination node drops all duplicates
and keeps only the first packet received.

Refinement: The TTL field is set by the source node to some desired value
(maximum allowable number of hops), and decremented by the intermediate nodes.
When TTL reaches zero, the packet is dropped. This keeps the traffic lower.
Very robust routing strategy: it will guarantee that a packet will arrive if there is
enough connectivity. Also, there will be a packet that has arrived through a minimal
number of hops - which establishes the minimal-hop route.
Dissadvantage: the algorithm creates to much traffic.

McGraw-Hill
SDSU

The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

Distance Vector Routing

13-4

Each node collects the knowledge of the entire network, and shares it periodically (e.g.
every 30 seconds) only with its neighbors. The knowledge is a sequence of messages:

{<source node> <dest. node> <next node> <total cost>}


Each message shows "so far optimal" route from the <source node> to the
<destination node>, where the first leg of the optimal route is <next node>, and
the total minimal cost is <total cost>. The cost is expressed in terms of number of hops.
By getting such messages, the nodes can combine them in order to build their routing
table. In doing this, they will have to eliminate duplicates by cost minimization, i.e. they
drop all duplicates of the same path which show bigger total cost, and keep the one
with the minimal cost. This way, after some time, the routing table of each node will
converge to the optimal routing table. This is a distributed implimentation of the
Bellman-Ford algorithm for finding the shortest path through a network. This table is
being updated continuously and shared with the node's neighbors.

McGraw-Hill
SDSU

The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

Distance Vector Routing (Cont.)

13-5

Distance vector routing algorithm was first used in ARPANET. Since the transfer
of knowledge between nodes (one hop) takes 30 seconds, this can cause large
delays in large networks, and consequently inconsistent network status in
different parts of the network. Also, the algorithm doesn't take into account the
link length and its bandwidth.
The drawbacks of DV routing can be summarised as:

Scalability problem (inherent to Bellman-Ford algorithm)


Slow iterations
Only number of hops used as cost

McGraw-Hill
SDSU

The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

13-6

Distance Vector Routing

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Distance Vector Routing (cont.)

13-7

Routing Table Distribution

Distance vector

Routing Table

Each node sends initially the distances to their


neighbors the information that everybody knows
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-8

Distance Vector Routing (cont.)


Updating RT for A
See next slide

Case a
Case b

McGraw-Hill

Receive an update message;


Each node runs
foreach (advertised destination) do
this algorithm
Add one hop to cost;
if (destination not in RT)
Add entry to RT;
elseif (destination is in RT and the next-hop field is the same
as the advertising router)
Replace the entry in the table with the advertised one;
elseif (destinat. is in RT and the next-hop field is not the same)
Chose the one with smaller hop count and retain/replace;
end

The McGraw-Hill Companies, Inc., 2000

DV Routing (cont.)

13-9

Updating RT (Cont.)
4
Router X

Case a

Network N

1
Router A

If optimal route A!N goes via X it


means that X is closer to N than A and
therefore has to be trusted more, so the
entry A!N via X = 2 is replaced by
A!N via X = 5
RT of A

Updated RT of A
A!N via X cost = 5
.................

A!N via X cost = 2


.................

replace

Advertising message from X


X ! N cost = 4
McGraw-Hill
SDSU

increment

X ! N cost = 5
The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

DV Routing (cont.)
Updating RT
4
Router X

Case b
Router A

Network N

1
Router Y

This time the advertising router (X) is not


equal to next hop (Y), therefore the entry
will be:
min{A!N via Y = 3, A!N via X = 5}

RT of A

Updated RT of A
A!N via Y cost = 3
.................

A!N via Y cost = 3


.................

minimize

Advertising message from X


X ! N cost = 4
McGraw-Hill
SDSU

13-10

increment

X ! N cost = 5
The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

DV Routing (cont.)

13-11

Example of updating a routing table


NOTICE: This example is not related to
example networks on previous slides.
If the entry Net2 5 is to be accepted by
the router X, then the next hope for that
entry would be C.

Old RT of router X

McGraw-Hill

New RT of router X

The McGraw-Hill Companies, Inc., 2000

DV Routing (cont.)

13-12

Final Routing Tables

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-13

Link State Routing

More recently proposed, and more efficient than distance vector routing. It was
designed to solve its scalability problem.
This algorithm has two parts: collecting the knowledge about the network, and
creating the optimal routing table. Knowledge is shared periodically (but on larger
intervals, e.g. 30 minutes) with the entire network. The knowledge of a given node
is restricted to its neighbors only. The message it uses to share the knowledge is
called: link state packet, which has the form:

{<sending node> <neighboring node> <link cost>}

McGraw-Hill
SDSU

The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

13-14

Link State Routing (Cont.)

The link cost is here more general, and takes care of delays, link length,
bandwidth, congestion. The LS packets are sent to all nodes by flooding.
Sending the LS packets is called advertisement. For example, if a new
node is introduced, the costs of its links to its neighbors are advertised
to everybody in the network. Similarly, if a link fails its infinite cost is
advertised. If nothing happens in a longer time, the knowledge is flooded
on a periodic basis, with much longer period than in DV routing (30 minutes
or even hours). This helps reducing the traffic in network.

McGraw-Hill
SDSU

The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

Link State Routing (cont.)

13-15

After some time each link will have a complete table that describes the entire network
(the link state database). Example:
3

From node

3
-

1
2

4
6

4
1

1
2
3
4
5
6

1
2

2
7
5

1
7
4

5
4
1

1
-

The table shows how nodes are connected to each other: the number gives the link
cost between a node and its neighbor, while " " means no direct connection. (In the
case of large networks, this matrix is very sparse, so the LS database is implemented
as alinked list.)
The second part of the algorithm builds the routing tables. Each node uses its LS
database to generate the optimal routing table. The optimization is done by the popular
Dijkstra's shortest path algorithm. The optimal routing table is also dynamically updated,
in order to reflect the current status of the LS database.
McGraw-Hill
SDSU

The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

Link State Routing (cont.)

McGraw-Hill

13-16

The McGraw-Hill Companies, Inc., 2000

Link State Routing (cont.)

13-17

The Costs
Cost is associated with the
router interface (port)

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Link State Routing (cont.)

13-18

Flooding of As LSP

Link State Packet (LSP)


McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Link State Routing

13-19

Link State Database


Putting LSPs together gives LSDB. The table below is implementation the
matrix form of LSDB (see slide 13-15). Every node is supposed to have the
same LSDB.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-20

So far we have discussed basic routing algorithms, like flooding, DV and LS.
(Path vector routing will be discussed later.) Further implementation and usage
of these algorithms will be discussed through concrete routing protocols such
as RIP, OSPF and BGP.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-21

Autonomous Systems
Networks are today enormously big which makes the routing
algorithms very difficult to implement. Therefore the networks are
divided into autonomous systems (AS) groups of networks and
routers under the authority of a single administration.
Routing inside an AS is called interior routing, while routing between
ASs is called exterior routing.
Hierarchical division is a standard way to cope with the scalability
problem.

McGraw-Hill
SDSU

The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

Autonomous systems (cont.)

13-22

interior routing
exterior routing
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Autonomous systems (cont.)

13-23

Todays multibackbone Internet


Peering
point

Multihomed AS, connects to


more AS, refuses to carry
transit traffic

Large corporation

Consumer ISP

Consumer ISP

Backbone ISP
Consumer ISP

Small corporation

Large corporation

Stub AS, only a single connection


to another AS, only local traffic
Peering point (also called NSAP) are places
where networks interconnect together to
exchange traffic on peering basis.
McGraw-Hill

Transit AS, connection to more


AS, designed to carry both
local and transit traffic

From Computer Networks, by L. Peterson and B. Davie


The McGraw-Hill Companies, Inc., 2000

Popular routing protocols

Routing Information Protocol


(uses distance vector routing)
Open Shortest Path First Protocol
(uses link state routing)
McGraw-Hill

13-24

Border Gateway Protocol


(uses path vector routing)
BGP can be used as exterior
(EBGP) or interior (IBGP)
routing protocol inside AS
The McGraw-Hill Companies, Inc., 2000

Routing Information Protocol

13-25

The simplest and the most widely used routing protocol in IP networks.
Uses UDP for transport over the well-known port 520.

RIP Message Format


An element of distance vector

1 request
2 - response

Destination network
(uses network rather than
router address)

The next-hop field is missing here.


It is included in the new version of RIP, RIP-2.
McGraw-Hill

Address family identifier (TCP/IP = 2)

Hop count between the advertising


router and the destination network
(value from 1 to 15; 16 means network
unreachable
The McGraw-Hill Companies, Inc., 2000

Request messages

13-26

When a router comes up, or has some time-out entries


it sends request about a specific entry, or about all entries

Response messages
Response can be solicited or unsolicited.
Unsolicited responses are sent periodically every 30 sec
Com: 2

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-27

Example 1
What is the periodic response sent by router R1 in figure below?
Assume R1 knows about the whole autonomous system.

R1 can advertise three networks 144.2.7.0, 144.2.9.0, and 144.2.12.0.


The periodic response (update packet) is shown in next slide.
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-28

Periodic packet sent from router R1 to its neighbors:

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-29

RIP timers
Timer per router.
Controls the advertising
(time is a random number
between 25-35 sec to avoid
synchronization)

Timer per route (entry).


which is reset whenever an update
arrives. If the update doesnt arrive in
180 seconds, the corresponding entry
is marked invalid by setting the
distance to infinite (16).
McGraw-Hill

Timer per route (entry).


All invalid entries are purged 120
seconds after being determined
invalid by X-timers. This gives a
chance that other routers learn that the
specified network is unreachable
from this router.
The McGraw-Hill Companies, Inc., 2000

13-30

Example 2
A routing table has 20 entries. It does not receive information about
five routes for 200 seconds. How many timers are running at this
time?

Solution:
21 timers:
Periodic timer: 1
Expiration timer: 20 - 5 = 15
Garbage collection timer: 5

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-31

Drawbacks of RIP:
Slow convergence
Too simple metric
Instability
Scalability

McGraw-Hill
SDSU

The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

13-32

Slow convergence
Periodic advertisement every 30 seconds,
average propagation time is 30/2 = 15 seconds
n x 15 s

Suppose there is a
change in network 1

This router learns about the change in


network 1 after n x 15 seconds.
(if n = 20, the delay would be 5 minutes)

In order to limit the delay, max hop count is limited to 15.


All entries that have distance 16 are considered invalid and are purged.
Consequently the diameter of an AS that uses RIP is limited to15 hops.
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Instability

13-33

Loops of routing packets.


Limiting the hops to 15 helps
but doesnt solve the problem.

Net 1 fails. A updates its RT


with cost = 16, but advertises this
after delay (max 30 sec).
In the meantime B sends
update with cost = 2. A chooses
the cost 2+1 = 3, which is
smaller than 16.
This continues until finally B
realizes that the Net 1 is
unreachable.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-34

Remedies to Instability

Triggered updates
Split horizons
Split horizons with Poisoned reverse

McGraw-Hill
SDSU

The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

13-35

Triggered Updates
If there is a change in the router sends the update immediately
instead of waiting the update time (30 sec). Each router that
receives information about change, forwards the update
immediately.
This helps in case from the previous slide, but doesnt help in case
of a router failure (because there is no one to report such change).

McGraw-Hill
SDSU

The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

13-36

Split horizon
Router never advertises the cost of a destination to neighbor N
if N is the current next-hop for the destination
If a router has received an update from an interface, then this same update
information must not be forwarded back to the same interface.

B has received info about Net 1 and Net 2 through its left i/f. This info is forwarded
through the right i/f only.
Router A is closer to destination (Net 1) than the router B, therefore there is not
meaningful that B supplies A with information about something that is closer to A.
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Split Horizon with Poisoned Reverse

13-37

Same idea, but instead of no advertisement use infinity cost

The erroneous route will be eliminated within the interval of 180 seconds.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-38

Example where split horizons doesn't work


B

A
Link
failure

McGraw-Hill
SDSU

C
A tells C: cost of route A to X is 16 (Unreachable)
A tells B: cost of route A to X is 16 (Unreachable)
B tells C: cost of route B to X is 3
(Split horizon
C tells A: cost of route B to X is 3
doesnt apply)
A updates its table: cost of A to X = min(16, 3+1) = 4
A tells C: cost of route A to X is 4

The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

13-39

RIP-v2 Format

Up to 25 routes

Allows routes learned externally

RIP-2 supports:
" slit horizon with poisoned reverse,
" authentication,
" triggered updates,
" multicast routing,
" classless routing (CIDR).
McGraw-Hill

Or prefix (supports classless


addressing and CIDR)

The McGraw-Hill Companies, Inc., 2000

13-40

Authentication
Needed to protect against unauthorized advertisement.

(password)

First entry is used for authentication


McGraw-Hill

Normal RIP-2 entries


The McGraw-Hill Companies, Inc., 2000

13-41

OSPF: Open Shortest Path First

RFC 1583
Interior routing protocol
Based on link state routing
Newer and more efficient than RIP
More scalable than RIP
Uses arbitrary metric (instead of only hop count)
Uses autonomous systems
Adds one more level of hierarchy: divides AS into areas
The OSPF messages are encapsulated into IP datagrams (OSPF
has its own error control implemented at the application layer)

McGraw-Hill
SDSU

The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

13-42

Areas in an autonomous system

An AS is divided into one primary area (backbone) and several secondary areas.
Routers in primary area are called backbone routers.
The routing information is flooded inside each area. The area border routers
summarize the area info and send it to the border routers of other areas via
backbone.
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-43

Types of links
In view of OSPF an internet consists of networks and routers. Routers can be
connected directly or via networks. Networks are connected via routers. Therefore
there are different types of connections between routers.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-44

Point-to-point link
Routers are directly connected

T-1, T-3, OC-3, OC-9,

Virtual link
If an area looses connectivity with the backbone area, the administrators
must create a virtual link between routers in order to enable the functionality
of the backbone.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Transient link

13-45

Routers are connected


to the same (physical)
network

Each router is virtually connected


with any other router, but not
through direct links. This representation
would result in too many (20)
advertisements
McGraw-Hill

This makes more sense, routers are


connected with direct links and there
are fewer advertisements (10). Designated
router can be software that runs on any
of the real routers.
The McGraw-Hill Companies, Inc., 2000

13-46

Stub link

Stub network means one router, but any number of


workstations, servers, LAN switches
(Only a single router wouldnt make sense)

Server

McGraw-Hill

Server

The McGraw-Hill Companies, Inc., 2000

13-47

Example of an internet
point-to-point link

Transient link

Stub link

Stub links

Internet is represented as a graph.


This is needed in order to apply
optimization algorithms such as OSPF
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-48

Types of LS advertisements
LSA
1

Advertisers

Area
real
router

Where to
flood

Area

Info about
how to
reach

Other
routers/
networks
in the area

McGraw-Hill

Area
designated
router

Area
border
routers

Area
border
routers

Area

Area

Area

Other
routers
connected
to network

Networks
in AS

Describes networks in
AS (outside area)

Boundary
routers

AS boundary
router

AS
Networks
in other AS

Describes location of AS
boundary
router
The
McGraw-Hill
Companies, Inc., 2000

Router link advertisement

13-49

Advertising router
is a true router. It floods
LSAs through its area about how to reach
other routers and networks connected to it.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-50

Network link advertisements


R2

R1
DR

R3

R4

R5

Designated router floods LSAs in its area on behalf of the transient


network. The LSAs advertise how to reach other routers connected to the
network.
DR advertises info how to reach R1-R5
Ri advertise info how to reach DR
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Summary link to network advertisement

13-51

Area border routers are active in two areas and create routing tables
for each of the area (e.g. R1 has RT0 and RT1, while R2 has RT0 and RT2).
R1 and R2 flood areas 1 and 2 respectively about how to reach N1.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Summary link to AS boundary


router advertisement

13-52

If a router inside an area wants to send a packet outside the AS it should know a
route to AS boundary router. This summary link provides link between the area
border routers and the AS border router.
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-53

External link advertisements

External link advertisement provides information inside the AS which networks


are available outside of the AS (that belong to other ASs). The advertisement
messages contain rows from RT created by an external routing protocol.
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-54

Area

Autonomous
System

a12

AS1

Internet

a11
Area Border
Router

a21

AS2

SLN

a10

a22
SLB
EL

Backbone
Area

a20
AS Boundary
Router

SLN Summary link to network


SLB Summary link to boundary router
EL External link to networks outside of AS
McGraw-Hill
SDSU

The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

13-55

Example 3
In the figure below which router(s) sends out router link LSAs?

All routers advertise router link LSAs.


R1 has two links, Net1 and Net2.
R2 has one link, Net2 in this AS.
R3 has two links, Net2 and Net3.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-56

Example 4
In the figure below which router(s) sends out network link LSAs?

All three network must advertise network links:


Advertisement for Net1 is done by R1 because it is the only router
and therefore the designated router.
Advertisement for Net2 can be done by either R1, R2, or R3,
depending on which one is chosen as the designated router.
Advertisement for Net3 is done by R3 because it is the only router
and therefore the designated router.
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Dijkstra Algorithm

13-57

Routers collect LS advertisements and create Link State Database.


LSDB is a tabular representation of the network topology inside an area.
Every router in the same area has the same LSDB. Once the LSDB are
complete the optimal routing table must be generated for each node. The most
popular optimization algorithm is Dijkstras shortest path algorithm. This
algorithm determines the shortest path between two points in graph:
1.
2.
3.
4.
5.

6.

Start with the local node (router): the root of the tree;
Assign a cost of 0 to this node and make it the first permanent node;
Examine each neighbor node of the node that that was the last
permanent node;
Assign a cumulative cost to each node and make it tentative;
Among the list of tentative nodes:
1. Find the node with the smallest cumulative cost and make it
permanent;
2. If the node can be reached from more than one direction
1. select the direction with the shortest cumulative cost;
Repeat steps 3 to 5 until every node becomes permanent

McGraw-Hill
SDSU

The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

13-58

Network

Routing Table for Router A


Network

Cost

N1

N2

N3

10

N4

11

N5

15

McGraw-Hill

Next Router

Cost from A to N5 is: 8+2+5 = 15


(8,2 and 5 are costs assigned to
outgoing interfaces of routers A,
D and F; 9 is not counted, its the
outgoing i/f of F, so its the cost
between F and N3. Networks are
not routers, they have no costs
assigned.
For example, cost to reach C
from A would be 5, not 3. Cost to
reach The
A from
C wouldCompanies,
be 3.
McGraw-Hill
Inc., 2000

Shortest path calculation

McGraw-Hill

13-59

The McGraw-Hill Companies, Inc., 2000

Shortest path calculation (cont.)

McGraw-Hill

13-60

The McGraw-Hill Companies, Inc., 2000

Shortest path calculation (cont.)

13-61

Node N3 can be reached


from two routers with
cumulative costs 10 and
14. Link from E is
therefore deleted.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Shortest path calculation (cont.)

McGraw-Hill

13-62

The McGraw-Hill Companies, Inc., 2000

Shortest path calculation (cont.)

McGraw-Hill

13-63

The McGraw-Hill Companies, Inc., 2000

13-64

Shortest path calculation (cont.)

m. Fill-in the routing table


McGraw-Hill

Network

Cost

Next Router

N1

N2

N3

10

N4

11

N5

15

The McGraw-Hill Companies, Inc., 2000

13-65

Types of OSPF packets

Type 1

Type 2

Type 5

Type 3

Type 4

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-66

OSPF packet header


All packets have the same header
OSPF packets are encapsulated directly into IP datagrams

Current OSPF
version is 2

OSPF packet type (1-5)

Area identification

Header+data

McGraw-Hill

64 bits. 0s or
8 character password

0- none
1 - password
The McGraw-Hill Companies, Inc., 2000

Hello packet

13-67

Used to test reachability of neighbors. Sent periodically to each routers port.


Number of seconds
between this routers
hello messages (10 s
default)

Number of seconds before


the router assumes that the
neighbor is dead
McGraw-Hill

Network mask associated


with this interface

The Router IDs of each


router from whom valid
Hello packets have been
seen recently on the
network.

E area is stub area


T - the router supports
multiple metrics

This routers priority.


Router with the highest
priority is choused to be a
designated router
The McGraw-Hill Companies, Inc., 2000

Database description packet

13-68

When a router is booted (first time or after failure) it needs the complete LSDB
immediately (it cant wait for LS update packets). If a neighbor hears the first
time from the router (hello message) it sends LSDB description - not LSDB itself!
The receiving router can then decide what it needs and sends the LS requeast(s) to
get the full info about the link(s).

E external flag (the advertising router is an AS boundary router)


B advertising router is an area border router
I - initialization flag (the message is the first message)
M more flag (this is not the last message)
M/S master (1), slave (0) flag
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-69

Link state request packet


A router is using this message to solicit the info about a specific route(s).
It is answered by LS update packet.

Request for one single LSA

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Link state update packet

13-70

Used by a router to advertise the state of its links the packet contains LSAs.

LSA

Contains:
LSA header
LSA data (router, network, summary, external)

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-71

LSA header
Number of seconds since this message
was first generated (originating router
sets it to 0, other routers (in flooding)
adds the estimated transit time.

Depends on the link type (see table)


Fletchers checksum, covers
the whole packet except the
link state age
McGraw-Hill

E stub area (are connected to the


backbone area with only one path)
T multiple types of services

LSA type: router, network,


summary to net, summary to
boundary, external)

The McGraw-Hill Companies, Inc., 2000

13-72

Link ID and link data


Link Type

McGraw-Hill

Link State ID

Link Data

Point-to-point link

Address of neighbor
router

Interface
numbers

Transient link

Address to designated
router

Router
address

Link to stub network

Network address

Network
address

Virtual link

Address of neighbor
router

Router
address

The McGraw-Hill Companies, Inc., 2000

13-73

LSA Data
Router link LSA

Type of service:
normal (default),
minimize cost,
maximize reliability,
Maximize throughput,
Minimize delay
McGraw-Hill

Depends on the link


type (see table)

Metric for default type of service

The McGraw-Hill Companies, Inc., 2000

13-74

Example 5

Give the router link LSA sent


by router 10.24.7.9

This router has three links: two of type 1 (point-to-point) and


one of type 3 (stub network).

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-75

Solution to Example 5

LSA type = router link

OSPF packet type = update


Advertiser: 10.24.7.9

Link type: p-p

metric
Link type: stub
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-76

Network link advertisement format


(Advertiser is designated router)

IP addresses of all attached routers

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-77

Example 6

Give the network link LSA in the following figure

The network, for which the network link advertises, has three routers
attached. The LSA shows the mask and the router addresses.
Note that only one of the routers, the designated router, advertises the
network link.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-78

Summary link to network LSA


Used by area border routers to announce the existence of other networks
outside of area. For each network there is a separate announcement.
From the network mask and the IP address of the advertising router
(in LSA header) can be figured the network address.

Each TOS has its own metric


McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-79

Summary link to AS boundary LSA


Used to announce the route to an AS boundary router

Format is exactly the same as for summary link to network LSA

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-80

External link LSA


Used to announce all networks outside of AS

Router that can provide a better


route to the destination

McGraw-Hill

Not used by OSPF

The McGraw-Hill Companies, Inc., 2000

13-81

Link state acknowledgment packet


OSPF packets are encapsulated into IP datagrams. Since the routing
information matters the routers (not some processes/applications) there is no
need for transport layer. Besides the OSPF has its own flow and error control
by forcing routers to acknowledge the receipt of every LS update packet.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-82

Border Gateway Protocol


(BGP)
Todays Internet is huge and without much of structure. Different service
providers (AS) are owned by different private companies, have different intra
domain routing protocols (RIP, OSPF) and different policies. Generally, one AS
can not trust another. Or, what is optimal for one AS may not be optimal for
another AS. There are three issues that make impossible to use RIP or OSPF in
interdomain routing:
Scale
Autonomous nature of the domains
Issue of trust
Consequently the optimal path between nodes in different AS either makes no
sense or is impossible to calculate. Therefore, the best an interdomain routing
protocol can do is to advertise reachability - a good loopless path, not a true
optimal path. This is the essence of BGP.
McGraw-Hill
SDSU

The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

Border Gateway Protocol


Summary

13-83

RFC 1771
Inter-AS routing protocol
First appeared in 1989
Routing method: path vector routing
BGP uses TCP with well known port 179
BGP supports classless addressing and CIDR
Path Vector Routing Table

McGraw-Hill
SDSU

Network

Next Router

Path

N1

R01

AS14, AS23, AS67

N2

R05

AS22, AS67, AS05, AS89

N3

R06

AS67, AS89, AS09, AS34

N4

R12

AS62, AS02, AS09

The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

Path vector packets

13-84

AS boundary routers advertise the reachability of a network in its AS to all its neighbors.
(Two AS boundary routers are neighbors if they are connected to the same network or if
they are connected by point-to-point connections.) Each AS b. router that receives the path
vector checks if the advertised path is in agreement with its policy (policy routing), if not it
will drop the message. Loops can easily be discovered by checking if an AS is already in
the path list and eliminated (loop prevention).
NOTE: There is still room for optimization. For example if R4 receives N1 R1 AS1 it
will choose that one and drop the path vector received from R3.
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-85

Types of BGP messages

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

BGP packet header

13-86

All BGP packets share the same common header

Reserved for authentication

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-87

Open message
Used to create neighborhood relationship.
BGP opens a TCP connection with a neighbor and sends the open message.
Neighbor answers with a keep-alive message

Current BGP
version is 4

If the router doesnt receive


update or keepalive message
within this time, the neighbor
is considered dead

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-88

Update message
The length of the next fiel

List of routes that should be


deleted from the previous
advertisement
AS path,
next hop,
local preference,
multiexit discriminator,
List of networks that can
be reached through the
advertised path. Includes
IP prefix and prefix length
(e.g. 153.18.7.0/24)
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

13-89

Local Preference
Network 160.10.0.0/16 can be reached from AS 400 via two
routers A and B. There are two possibilities which can be
resolved with local reference attribute.

AS 100
160.10.0.0/16

AS 200

AS 300

160.10.0.0/16
LOAL_PREF = 500

Area where the advertisements


with local preference attribute go

McGraw-Hill
SDSU

AS 400

160.10.0.0/16
LOAL_PREF = 800

This BGP router is advertised


that it can reach 16.10.0.0/16
via AS 200 (router A, LP=500),
or via AS 300 (router B, LP=800).
It will normally choose
lighter preference
The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

Multi Exit Discriminator

13-90

Network 191.68.1.0/24 can be reacted from AS 200 via two


routers A and B (two entry points). The ambiguity can be
resolved with MED attribute contained in advertisements
that are sent to aal routers in AS 200.

Area where the advertisements


with multi exit attribute go

AS 200
C

192.68.1.0/24
MED = 2000

Preference to
entry point
192.68.1.0/24
MED = 1000
Entry point

Entry point

B
A
191.68.1.0/24

AS 201
McGraw-Hill
SDSU

The McGraw-Hill
Companies,
Marko Vuskovic,
Inc., 2000
2004

13-91

Keepalive message
BGP routers periodically inform each other about their presence. The
keepalive time is 1/3 of hold time (see open message). Max 1 sec. Only
header sent (with type = 3).

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Notification message

13-92

Send if a router wants to close, or if it detects an error.

Examples of errors:
Synch problem, bad message length/type, unsupported
optional parameter, authentication failure, bad hold time,
unrecognized attribute, AS routing loop, invalid path attribute,
invalid network field,

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000