CS 5283: Lecture 3 - Internet Routing Protocols

hardsweetlipsNetworking and Communications

Oct 28, 2013 (3 years and 7 months ago)

56 views

CS 5283: Lecture 3
-

Internet
Routing Protocols

Venkatesh Sarangan

01/27/2004

01/27/2004

Venkatesh Sarangan, CS 5283

2

Overview


IP Routing


basics


Intra
-
domain routing


RIP


OSPF


Inter
-
domain routing


BGP

01/27/2004

Venkatesh Sarangan, CS 5283

3

Routing: Basics


Routing:

Process of finding a path from
source to a destination


Routing Mechanism:

looking up the next
hop in the routing table for a packet


Routing Policy:

the task of creating and
maintaining the routing table.



Routing protocols help to maintain the routing table


Routing table can be seen using the command

netstat

rn

01/27/2004

Venkatesh Sarangan, CS 5283

4

Routing Table


Required for each router


Entry for each network, need not be for each
destination


Once datagram reaches router attached to
destination network, that router can deliver
to host


Each entry shows only the next hop


Not the whole route

01/27/2004

Venkatesh Sarangan, CS 5283

5

Example Routing Table

Destination

Gateway

Flags

Interface

Ref

Use

139.78.112.
0

139.78.11
3.1

U

eri0

1

1726

127.0.0.1

127.0.0.1

UH

Lo0

6

90026

Default

139.78.11
5.254

UG

Eri0

1

25000

01/27/2004

Venkatesh Sarangan, CS 5283

6

Routing table description


Destination:

the final destination of the
packet


Gateway:

The next hop for this packet


Flags:



U:

the route is up and operational


G:

The destination is not directly connected to
this router/host


H:

The destination entry in the table belongs to a
host. If H is not present, then the entry denotes
a network

01/27/2004

Venkatesh Sarangan, CS 5283

7

Routing table description


Ref:

# of active connections using the
entry


Use:

# of packets forwarded using the
entry

01/27/2004

Venkatesh Sarangan, CS 5283

8

Routing table in Hosts


If attached to single network with single
router then not needed


All traffic must go through that router (called
the gateway)


If multiple routers attached to network,
host needs table saying which to use


01/27/2004

Venkatesh Sarangan, CS 5283

9

Routing Principles


Routing can be Fixed or Adaptive


Fixed Routing


Single permanent route configured for each
source
-
destination pair


May change when topology changes


Link cost not based on dynamic data


Based on estimated traffic volumes or
capacity of link

01/27/2004

Venkatesh Sarangan, CS 5283

10

Fixed Routing


Simple to implement


Doesn’t adapt to change in network
conditions


01/27/2004

Venkatesh Sarangan, CS 5283

11

Adaptive Routing


As conditions on internet changes, routes
may change


Failure


Congestion


Can route around failures & congestion


Avoid, or at least not add to further
congestion

01/27/2004

Venkatesh Sarangan, CS 5283

12

Adaptive Routing


More complex, router processing increases


Depends on information collected in one
place but used in another


More information exchanged improves routing
decisions but increases overhead


Shouldn’t react too fast (oscillations), or
too slow (irrelevant)


Can cause looping, when changes are not
propagated quickly

01/27/2004

Venkatesh Sarangan, CS 5283

13

Adaptive Routing Strategies


Classification based on information sources


Local


E.g. route each datagram to network with
shortest queue


Balance loads on networks


May not be heading in correct direction


Include preferred direction


Rarely used

01/27/2004

Venkatesh Sarangan, CS 5283

14

Adaptive Routing Strategies


Adjacent nodes


Distance vector algorithms


All nodes


Link
-
state algorithms


Both need routing protocols to exchange
information

01/27/2004

Venkatesh Sarangan, CS 5283

15

Adaptive Routing


Goal:

To choose the best path, among a set
of alternatives based on some criteria (e.g.
min delay, high throughput etc.)


Two kinds of protocols


Intra
-
domain:

find best routes within a domain
(a.k.a.
Interior Routing Protocols
-

IRP
)


Inter
-
domain:

find best routes between domains
(a.k.a.
Exterior Routing Protocols
-

ERP
)

01/27/2004

Venkatesh Sarangan, CS 5283

16

Adaptive Routing


Domain or Autonomous Systems (AS):


A set of routers & hosts under a single
administration


Implement the same set of protocols (talking
the same language)


Remains ‘
connected
’’ (what is this?)

01/27/2004

Venkatesh Sarangan, CS 5283

17

Schematic diagram of the
Internet

01/27/2004

Venkatesh Sarangan, CS 5283

18

Internet Routing


Intra
-
domain routing


Information about the network outside the
domain is ignored


RIP (Routing Information Protocol)


OSPF (Open Shortest Path First) protocol


Inter
-
domain routing


EGP (Exterior Gateway Protocol)


BGP (Border Gateway Protocol)

01/27/2004

Venkatesh Sarangan, CS 5283

19

Distance Vector Protocols


At each router, maintain a list/vector of
distances to all possible destinations


Periodically exchange this information
with the neighbors


Update the routing table based on
information received from the neighbors


01/27/2004

Venkatesh Sarangan, CS 5283

20

Distance Vector Protocols


On receiving an update from a neighbor


Add the link cost to reach the neighbor to the
neighbor’s distance vector


Out of all possible neighbors, find which
neighbor has the lowest distance


Include this member has the next hop


Include this distance as the cost of reaching the
neighbor


Can be implemented using ‘Distributed
Bellman
-
Ford’ algorithm

01/27/2004

Venkatesh Sarangan, CS 5283

21

X to B: 1

X to C: 1

X to A: 1

01/27/2004

Venkatesh Sarangan, CS 5283

22

Routing Information Protocol
(RIP)


DV; Link metric always set to 1 (hop count)


Maximum hops allowed: 15


16 is considered to be un
-
reachable or infinity


Each router periodically sends its entire
routing table to its neighbor every 30 sec


UDP port # 520 is used


Maximum RIP message size is 512 bytes

(why?)

01/27/2004

Venkatesh Sarangan, CS 5283

23

RIP message format

from http://www.cis.umassd.edu/~amathuria/577/f02
-
577.html

01/27/2004

Venkatesh Sarangan, CS 5283

24

RIP message processing


RIP ‘requests’ are made by routers that
just booted up


Also used for de
-
bugging purposes


Routers on receiving the ‘request’ send
their entire routing table


Received entries are checked one by one


IP address, metric are checked


Entries suitably updated; timers are re
-
started

01/27/2004

Venkatesh Sarangan, CS 5283

25

RIP message processing


Updating tables


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


Life time of a table entry is 180 sec


If no update is received for 180 sec, crash is
assumed


Distance is set to 16 (infinity)

01/27/2004

Venkatesh Sarangan, CS 5283

26

RIP: Drawbacks


Count to infinity


Consider 1
-
2
-
3; If 3 fails, 2 updates & thinks
there is a route through 1; 1 updates & thinks
there is a route through 2


No clear solution!


Split
-
horizon
: Since 1 reaches 3 through 2, when
it advertises to 2, it advertises infinity for 3.


No authentication


No support for
variable length subnet
masking
(what is this?)

01/27/2004

Venkatesh Sarangan, CS 5283

27

RIP: Drawbacks (contd.)


Black
-
hole:


If a router advertises by mistake a distance
of zero to several destinations, then all
routes point to it!


Slow convergence to topology changes

01/27/2004

Venkatesh Sarangan, CS 5283

28

Distance vector to Link state


RIP, based on DV is simple, yet


has slow convergence


prone to count to infinity!


not suitable for large networks, since
maximum hop count is 16


doesn’t allow multi
-
path routing


Link state is relatively complex, yet


doesn't have the above drawbacks of DV

01/27/2004

Venkatesh Sarangan, CS 5283

29

OSPF Principles


Each node constructs a ‘link state
packet (LSP)’ by collecting the states of
the incident links


This LSP is then advertised to all other
nodes in the network through flooding


Each router acknowledges the receipt of
LSP


Generates a lot of traffic!

01/27/2004

Venkatesh Sarangan, CS 5283

30

OSPF Principles


Using the LSPs for all the routers, a DB of
the entire network is maintained


Using the DB a directed graph is
constructed


Routes to all destinations are computed
using the local instance of the graph


Uses Dijkstra’s SPF algorithm


Specifications were developed in an ‘open’
fashion


hence OSPF!

01/27/2004

Venkatesh Sarangan, CS 5283

31

OSPF Principles (contd.)


Size of DB, flooding overhead, complexity of
route computation increase with network size


Network is ‘split’ in to various, independent areas,
connected by a ‘backbone’ area


Backbone area glues the network together


Each area behaves like a independent
network


DB includes only intra
-
area links


LSP Flooding stops at area boundary


Only intra
-
area route computation

01/27/2004

Venkatesh Sarangan, CS 5283

32

OSPF Principles (contd.)


Intra
-
area routing relies solely on local link
state information


Inter
-
area routing consists of three legs

1.
Within source area: Intra
-
area

2.
Through backbone


Has properties of an area


Uses link state routing algorithm for inter
-
area routing

3.
Within destination area: Intra
-
area

01/27/2004

Venkatesh Sarangan, CS 5283

33

Routers in an OSPF AS

AS 1

AS 2

Internal router

AS 3

AS 4

Area

Backbone
router

Backbone

Area
border
router

AS boundary router

BGP
protocol
connects
the
ASes

01/27/2004

Venkatesh Sarangan, CS 5283

34

OSPF Principles (contd.)


Area Border Routers


connect given area(s) to the backbone


maintain databases for each area they are
attached to


act as gateway for their area


Backbone Routers


may be connected to other Area Border
routers

01/27/2004

Venkatesh Sarangan, CS 5283

35

OSPF Principles (contd.)


AS Boundary routers


Connect the AS to other ASes
-

gateway
for the entire AS


Inject external routes in to the OSPF
database, which is advertised throughout
the AS

01/27/2004

Venkatesh Sarangan, CS 5283

36

OSPF Protocols


OSPF runs directly on top of IP and has
three sub
-
protocols


Hello Protocol


To check if links are operational


To elect ‘designated’ router on broad cast
networks


Exchange Protocol


To synchronize databases between two
routers that have just become adjacent

01/27/2004

Venkatesh Sarangan, CS 5283

37

OSPF Protocols


Flooding Protocol


Responsible for disseminating link states


Uses sequence numbers to distinguish
older updates from newer ones


All updates are acknowledged


Unacknowledged updates are re
-
sent


Updates are sent out on all interfaces
apart from the incoming one



01/27/2004

Venkatesh Sarangan, CS 5283

38

OSPF Link Costs


Cost of each hop 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)

01/27/2004

Venkatesh Sarangan, CS 5283

39

Advantages of OSPF


Fast, loopless convergence


Any change is disseminated fast through
flooding


Consistent databases stored in local routers;
hence loopless


Support for multiple metrics

such as
throughput, delay, and reliability


Support multi
-
path routing

-

better link
utilization, lower queueing delays, etc.

01/27/2004

Venkatesh Sarangan, CS 5283

40

Drawbacks of OSPF


For the traffic to travel between two
areas, it must be first routed to the
backbone (area 0).


this may result in non
-
optimal routing


Dividing an AS into areas adds more
complexity


01/27/2004

Venkatesh Sarangan, CS 5283

41

Inter
-
AS Routing: Limitations of
DV


Assume a common distance metric across all
routers


may not be true for different domains


Routing table doesn’t list the entire path


An AS may have some restrictions in
forwarding packets through another AS

01/27/2004

Venkatesh Sarangan, CS 5283

42

Inter
-
AS Routing: Limitations of LS


Assume a common distance metric across
all routers


may not be true for different domains


Involves flooding updates to all routers


Is certainly not manageable across multiple
domains!


01/27/2004

Venkatesh Sarangan, CS 5283

43

Path Vector Routing


Do away with distance metrics


Just provide the reachability information,
and the list of domains that should be
crossed


Removes the difficulty associated with DV
and LS routing


Since entire path is enumerated, loops can
be avoided



01/27/2004

Venkatesh Sarangan, CS 5283

44

BGP (Border Gateway
Protocol)


ERP based on on path vector routing


No cost information; each BGP router keeps
track of the exact path used


BGP peers initially exchange their full
routing tables


Later on, only routing updates are exchanged


Uses TCP


A BGP router views the world as a
collection of other BGP routers, and the
lines connecting them

01/27/2004

Venkatesh Sarangan, CS 5283

45

BGP Messages

Open

Used to open a neighbor relationship
with another router

Update

Used to (a) transmit information about
a single route and/or (2) list multiple
routes to be withdrawn

Keepalive

Used to (1) ack. an Open message,
and (2) periodically confirm the
neighbor relationship

Notification

Sent when an error condition is
detected.

01/27/2004

Venkatesh Sarangan, CS 5283

46

BGP Operation


Neighbors/Peers
-

two BGP routers in
different AS that wish to exchange
routing information


Three functionalities in BGP


Neighbor acquisition


Neighbor reachability


Network reachability



01/27/2004

Venkatesh Sarangan, CS 5283

47

BGP Operation: Neighbor
Acquisition


When two routers in different ASes agree to
peer


Formal request is necessary, since one router
may be overloaded, and may not wish to be a
peer


One router sends a request to other


May be turned down


The existence of other router should be manually
fed


If accepted, Keepalive message is sent as a
response

01/27/2004

Venkatesh Sarangan, CS 5283

48

BGP Operation (contd.)


Neighbor reachability
:


Maintaining the peer relationship


Periodically send Keepalive messages


Network Reachability


Each BGP router maintains a database of
reachable networks, and the preferred paths for
reaching them


Any updates to this database is exchanged
among BGP peers

01/27/2004

Venkatesh Sarangan, CS 5283

49

BGP Messages

Marker

Length

Type

Version

Domain id

Hold time

BGP id

Optional parameter len

Optional Parameters

16

2

1

1

2

2

4

1

var

Marker

Length

Type

Unfeasible routes length

16

2

1

2

Total Path Attr. length

Withdrawn routes

Path Attributes

Net. Layer reach. info

var

2

var

var

Open Message

Update Message

01/27/2004

Venkatesh Sarangan, CS 5283

50

BGP Messages

Marker

Length

Type

16

2

1

Marker

Length

Type

16

2

1

1

Error code


Data

var

Keepalive

Notification Message

1

Error subcode

01/27/2004

Venkatesh Sarangan, CS 5283

51

BGP Messages


All messages have a header with three
fields


Marker
: Reserved for authentication


Sender may insert a value which the recipient
may use for authenticating the sender


Length
: Length of the message in octets


Type
: Type of the BGP message


Open, Keepalive, Update, Notification

01/27/2004

Venkatesh Sarangan, CS 5283

52

BGP Messages


Open:

Used for acquiring a neighbor with a
TCP connection


Version
: version of the BGP used


My domain id
: AS identifier


Hold

time
: Value proposed by the sender for
Keepalive message interval


BGP id
: Usually the sender’s IP address


Keepalive:

Used for preventing the hold
timer from expiring

01/27/2004

Venkatesh Sarangan, CS 5283

53

BGP Messages


Update


Communicates information about a single
route, which may be added to the recipient’s
database


Withdraws a list of routes previously
advertised to the recipient


01/27/2004

Venkatesh Sarangan, CS 5283

54

BGP Messages


Fields in the Update message:


Unfeasible routes length


Withdrawn routes


Total path attributes length


Path attributes


NLRI:

A list of networks that can be reached
by this route

01/27/2004

Venkatesh Sarangan, CS 5283

55

BGP: Path attributes


Origin:

Indicates whether this information was
generated by an IGRP or EGRP


AS_Path:

A list of domains traversed in this
route


Next_Hop:

IP address of the next hop border
router to be used for reaching destinations
listed in NLRI

01/27/2004

Venkatesh Sarangan, CS 5283

56

BGP: Path attributes


Multi_Exit_Disc:

Used to communicate
preferences among the intra
-
domain routes
(explained later)


Local_Pref:

Used by a router to inform other
routers within the domain about its own
preferences



no significance outside the domain


01/27/2004

Venkatesh Sarangan, CS 5283

57

BGP: Example

R3

R2

R1

R4

R8

R7

R6

R5

2.1

2.2

2.3

2.4

1.4

1.1

1.2

1.3

AS 1

AS 2

BGP peers

01/27/2004

Venkatesh Sarangan, CS 5283

58

BGP: Example

Consider R1


Using OSPF, R1 constructs an image of the
topology of the subnetworks in Domain 1


Using BGP Open message it acquires
neighborhood with R5 in domain 2


01/27/2004

Venkatesh Sarangan, CS 5283

59

BGP: Example


It then sends an Update message to R5
with


AS_Path: It has the id of domain 1


Next_Hop: The IP address of R1


NLRI: List of all subnetworks in domain 1


above message informs R5 that all subnets
listed in NLRI are reachable via R1, and the only
domain traversed is 1


01/27/2004

Venkatesh Sarangan, CS 5283

60

BGP: Example


Let R5 have a BGP relation with R9 in
domain 3


In the Update message sent by R5 to R9,


AS_Path: {IDs of AS2, AS1}


Next_Hop: IP address of R5


NLRI: List of subnets in Domain 1


above message informs R9 that all subnets
listed in NLRI are reachable via R5, and the
domains traversed are 1 & 2

01/27/2004

Venkatesh Sarangan, CS 5283

61

BGP: Example


R9 may have alternate routes to the subnets in
Domain 1


If R9 prefers the route advertised by R5, it
updates its database, and sends an Update
message to its other peers


New Update message will have AS_Path field of
{AS3, AS2, AS1}

01/27/2004

Venkatesh Sarangan, CS 5283

62

BGP: Path Attributes


Multi_Exit_Disc attribute
:


Used to choose one among many entry
points into a domain


Attribute contains a number that reflects some
internal metric for reaching destinations within
AS


Let both R1 and R2 have BGP relation with
R5


01/27/2004

Venkatesh Sarangan, CS 5283

63

BGP: Path Attributes


Each provides an Update message for
subnetwork 1.3 that includes a routing metric
used internal to AS 1


R5 could use these two values as the basis for
choosing between the two routes for reaching
the subnet 1.3

01/27/2004

Venkatesh Sarangan, CS 5283

64

Summary: Internet Routing



Basics


Routing table structure


Distance vector, Link state, Path vector


Intra
-
domain: RIP, OSPF


Inter
-
domain: BGP