Sie sind auf Seite 1von 82

Chapter 14

Unicast Routing Protocols:


RIP, OSPF, and BGP
Objectives
Upon completion you will be able to:
Distinguish between intradomain and interdomain routing
Understand distance vector routing and RIP
Understand link state routing and OSPF
Understand path vector routing and BGP

TCP/IP Protocol Suite

Figure 14.1

Autonomous systems

An autonomous system is a set of networks and routers unde


the control of a single administrative authority.
Routing within an autonomous system is intradomain routing
Routing between autonomous systems is interdomain routing

TCP/IP Protocol Suite

Figure 14.2

TCP/IP Protocol Suite

Popular routing protocols

14.2 DISTANCE VECTOR ROUTING


In distance vector routing, the least cost route between any two nodes is
the route with minimum distance. In this protocol each node maintains a
vector (table) of minimum distances to every node

The topics discussed in this section include:


Initialization
Sharing
Updating
When to Share
Two-Node Loop Instability
Three-Node Instability

TCP/IP Protocol Suite

Figure 14.3

TCP/IP Protocol Suite

Distance vector routing tables

Figure 14.4

Initialization of tables in distance vector routing

In distance vector routing, each node shares its table with


its immediate neighbor periodically (eg every 30s) and when
there is a change.
TCP/IP Protocol Suite

Figure 14.5

Updating in distance vector routing

Step 1: Add cost (2) to table received from neighbor (C).


Step 2: Compare Modified Table with Old Table (row by row)
If Next node entry is different, select the row with the smal
cost. If tie, keep the old one.
If Next node entry the same, select the new row value (reg
less of whether new value is smaller or not).

TCP/IP Protocol Suite

Figure 14.6

Two-node instability what can happen with distance vector routing


Both A and B know
where X is.
Link between A and X
fails. A updates its
table immediately.

But before A can tell B


B sends its info to A!

A, using Bs info, updates its table (error!)


Then A send its table
to B and B updates its
table (more error).

TCP/IP Protocol Suite

Both routers keep updating tables, eventually hitting infinity. In


the meantime, chaos!
8

Figure 14.6

Two-node instability what can happen with distance vector routing

Possible Solutions to two-node instability:


1. Define infinity to be a much smaller value, such as 100.
Then it doesnt take too long to become stable. But now
you cant use distance vector routing in large networks.
2. Split Horizon instead of flooding entire table to each
node, only part of its table is sent. More precisely, if node
B thinks that the optimum router to reach X is via A, then
B does not need to advertise this piece of info to A the
info has already come from A.

3. Split Horizon and Poison Reverse Normally, the distanc


vector protocol uses a timer. If there is no news about a
route, the node deletes the route from its table. So when A
never hears from B about the route to X, it deletes it.
Instead, Node B still advertises the value for X, but if the
source of info is A, it replaces the distance with infinity,
saying Do not use this value; what I know about this route
comes from you.
TCP/IP Protocol Suite

Figure 14.7

TCP/IP Protocol Suite

Three-node instability no solutions here!

10

14.3 RIP
The Routing Information Protocol (RIP) is an intradomain routing
protocol used inside an autonomous system . It is a very simple protocol
based on distance vector routing.

The topics discussed in this section include:


RIP Message Format
Requests and Responses
Timers in RIP
RIP Version 2
Encapsulation
TCP/IP Protocol Suite

11

Figure 14.8

Example of a domain using RIP

Note the
metric used
here for Cost
is simply the
hop count.

TCP/IP Protocol Suite

12

Figure 14.9

RIP message format

Command: request (1) or response (2)


Version: 1 or 2 (version 2 shown in a couple slides)
Family: TCP/IP has value 2
Network address: address of the destination network
Distance: hop count from the advertising router to the destinat
network

TCP/IP Protocol Suite

13

Figure 14.10

Request messages

A request message is sent by a router that has just come up or


a router that has some time-out entries.

A response message is sent in answer to a request (solicited resp


or simply every 30 seconds (unsolicited). Response message form
shown in previous slide.
TCP/IP Protocol Suite

14

Example 1
Figure 14.11 shows the update message sent from router R1 to
router R2 in Figure 14.8. The message is sent out of interface
130.10.0.2.
The message is prepared with the combination of split horizon
and poison reverse strategy in mind. Router R1 has obtained
information about networks 195.2.4.0, 195.2.5.0, and 195.2.6.0
from router R2. When R1 sends an update message to R2, it
replaces the actual value of the hop counts for these three
networks with 16 (infinity) to prevent any confusion for R2.
The figure also shows the table extracted from the message.
Router R2 uses the source address of the IP datagram carrying
the RIP message from R1 (130.10.0.2) as the next hop address.
TCP/IP Protocol Suite

See Next Slide

15

Figure 14.11 Solution to Example 1


Hop=16 means dest.
is unreachable (only
works on smaller
networks)

TCP/IP Protocol Suite

16

Figure 14.12

RIP timers

Periodic timer: controls the advertising of regular updates


Expiration timer: governs the validity of a route. When a
router receives info, sets timer to 180s. No update within
180s? Route set to 16, which means unreachable.
Garbage collection timer: Set to 120s after route set to 16.
When timer expires, then toss route info.

TCP/IP Protocol Suite

17

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

Solution
The 21 timers are listed below:
Periodic timer: 1
Expiration timer: 20 5 = 15
Garbage collection timer: 5

TCP/IP Protocol Suite

18

Figure 14.13

RIP version 2 format

Note: Version 2 supports subnet masks


Route tag: carries information such as the AS number.
So it allows RIP to receive info from an interdomain routing proto
TCP/IP Protocol Suite

19

Figure 14.14

Authentication

FFFF in family field indicates that the message carries


authentication info and not routing info.

Authentication type: defines the protocol used for authentication


Authentication data: contains the actual authentication data
(e.g. password).
TCP/IP Protocol Suite

20

Note:
RIP uses the services of UDP on
well-known port 520.

TCP/IP Protocol Suite

21

14.4 LINK STATE ROUTING


In link state routing, if each node in the domain has the entire topology
of the domain, the node can use Dijkstras algorithm to build a routing
table.

The topics discussed in this section include:


Building Routing Tables

TCP/IP Protocol Suite

22

Figure 14.15

Concept of link state routing

Concept of link state routing


Every router has knowledge about the network, but from
its own perspective.

TCP/IP Protocol Suite

23

Figure 14.16

Link state knowledge

Each router knows (maintains) its states of its links.

Each router floods this info (via a Link State Packet) to other
routers periodically (when there is a change in the topology,
or every 60 to 120 minutes).
Each router takes in this data and, using Dijkstras
algorithm, creates the shortest path tree and corresponding
routing table.

TCP/IP Protocol Suite

24

Figure 14.17

TCP/IP Protocol Suite

Dijkstra algorithm

25

Figure 14.18

TCP/IP Protocol Suite

Example of formation of shortest path tree

26

Table 14.1 Routing table for node A

Now lets try using the Dijkstras algorithm introduced in


TDC 361.

TCP/IP Protocol Suite

27

14.5 OSPF
The Open Shortest Path First
routing protocol based on link
autonomous system.

(OSPF) protocol
state routing . Its

is an intradomain
domain is also an

The topics discussed in this section include:


Areas
Metric
Types of Links
Graphical Representation
OSPF Packets
Link State Update Packet
Other Packets
Encapsulation
TCP/IP Protocol Suite

28

Figure 14.19

Areas in an autonomous system

OSPF divides an autonomous system into areas. All network


inside an area must be connected.
Area border router: The router at the border of an area.
Backbone: The area that is connected to all other areas.
backbone routers: Routers inside the backbone.
AS boundary router: Router that is connecting two AS.
The cost associated with a route is called the metric. Metric
could be min delay, max thruput, etc.

TCP/IP Protocol Suite

29

Figure 14.21

Point-to-point link

No hosts in between; T-1 connection common


TCP/IP Protocol Suite

30

Figure 14.22

Transient link

A network with several routers attached to it; all LANs and some W
have transient links; b. is unrealistic because too many advertisem
In c., one of the routers also becomes labeled the designated route
TCP/IP Protocol Suite

31

Figure 14.23

Stub link

A network that is connected to only one router


and is a special case of the transient

Virtual link: A link that is created between two routers


by an administration using a longer path that probably
goes through several router in case the link between
these two routers is broken.
TCP/IP Protocol Suite

32

Figure 14.24

Example of an Autonomous System and its graphical


representation in OSPF

What kind of networks are the dotted lines?


Are there any stub networks here? What are the transient networ
TCP/IP Protocol Suite

33

Figure 14.25

Types of OSPF packets

OSPF works by transferring packets. What are the differen


types of packets?

The link state update packets are the most important, but see
the next slide.
TCP/IP Protocol Suite

34

Responds to a link-state request


packet. These messages also are used
for the regular dispersal of LSAs.
Several LSAs can be included within a
single link-state update packet.

Type 1

Used to create
neighbor
relationships
and to test the
reachability of
neighbors.
The first step
in link state
routing.

TCP/IP Protocol Suite

2
When a router is
connect to the system or
after a failure, it cannot
wait for all link state
packets before making
its own database and
calculating its routing
table. Neighbors will
send it a database
description when they
receive a hello message
from it for the first time
(not the full database
but like an outline about
links). From this, the
router can then ask for
information it does not
have.

Requests pieces of the


topological database from
neighbor routers. These
messages are exchanged
after a router discovers
(by examining databasedescription packets) that
parts of its topological
database are out of date.

Acknowledges
link-state
update
packets.

35

Figure 14.26

OSPF common header

Version: Version of OSPF (Current version is 2).


Type: Type of the packet (1 to 5).
Area identification: The area within which the routing
takes place.

Checksum: entire packet excluding the Auth type and Auth.


Authentication: Defines the authentication protocol used in
this area. 0 -> None, 1 -> Passwod.
Authentication: Actual value of the authentication data.
Authentication type = 0 -> 0s, Authentication type = 1 ->
eight character password
TCP/IP Protocol Suite

36

Figure 14.27

Link state update packet

This is the general form of the link state update packet.


It is used by a router to advertise the state of its links.

Note that this packet contains one or more LSAs (the yellow
part).

TCP/IP Protocol Suite

37

Figure 14.28

LSA general header

This is the general header for each LSA.

Link state age-seconds elapsed since this message was first


generated.
E: if 1, then this area is a stub area
T: if 1, router can handle multiple types of service
Link state type: 1(router link), 2(network link), etc. (next slide)
Advertising router: IP address of router advertising this msg.
Link state sequence number: simply a sequence number
Checksum is actually based on Fletchers checksum
TCP/IP Protocol Suite

38

Link-state advertisement (Link-state update) types

Router Links (RL) (Type 1) are generated by all routers. These links describe the
state of the router interfaces inside a particular area. These links are only flooded
inside the router's area.
Network Links (NL) (type 2) are generated by a DR (Designated Router) of a
particular segment; these are an indication of the routers connected to that segment.
Summary Links (SL) are the inter-area links (type 3); these links will list the
networks inside other areas but still belonging to the autonomous system.
Summary links are injected by the ABR (Area Border Router) from the backbone
into other areas and from other areas into the backbone. These links are used for
aggregation between areas.
AS boundary router summary links are type 4 links that point to the ASBR
(Autonomous System Boundary Router). This is to make sure that all routers know
the way to exit the autonomous system.
External Links (EL) (type 5), these are injected by the ASBR into the domain.

TCP/IP Protocol Suite

39

Figure 14.29

Router link

This is a router link LSA (one of the 5 kinds of LSAs).


It is used to define the links of a true router to announce info
all of its links and what is at the other side of the link (neighb

TCP/IP Protocol Suite

40

Figure 14.30

Router link LSA

Default type
For what to enter in Link ID, Link data,
of service.
and Link type, see the next slide.
TCP/IP Protocol Suite

41

Table 14.2 Link types, link identification, and link data

TCP/IP Protocol Suite

42

Example 3

Give the router link LSA sent by router 10.24.7.9 in


Figure 14.31.
See Next Slide

Solution
This router has three links: two of type 1 (point-topoint) and one of type 3 (stub network). Figure 14.32
shows the router link LSA.
See Figure 14.32
TCP/IP Protocol Suite

43

Figure 14.31

TCP/IP Protocol Suite

Example 3

44

Figure 14.32

TCP/IP Protocol Suite

Solution to Example 3

45

Figure 14.33

Network link (second kind of LSA)

A network link LSA defines the links of a network and


is generated by the designated router (DR).

TCP/IP Protocol Suite

46

Figure 14.34

TCP/IP Protocol Suite

Network link advertisement format

47

Example 4
Give the network link LSA in Figure 14.35.

See Next Slide


Solution.
See Figure 14.36

TCP/IP Protocol Suite

48

Figure 14.35

TCP/IP Protocol Suite

Example 4

49

Figure 14.36

TCP/IP Protocol Suite

Solution to Example 4

50

Example 5
In Figure 14.37, which router(s) sends out router link LSAs?

See Next Slide

Solution
All routers advertise router link LSAs.
a. R1 has two links, N1 and N2.
b. R2 has one link, N2.
c. R3 has two links, N2 and N3.
TCP/IP Protocol Suite

51

Figure 14.37

TCP/IP Protocol Suite

Example 5 and Example 6

52

Example 6
In Figure 14.37, which router(s) sends out the network link
LSAs?
Solution
All three network must advertise network links:
a. Advertisement for N1 is done by R1 because it is the only
attached router and therefore the designated router.
b. Advertisement for N2 can be done by either R1, R2, or R3,
depending on which one is chosen as the designated router.
c. Advertisement for N3 is done by R3 because it is the only
attached router and therefore the designated router.
TCP/IP Protocol Suite

53

Figure 14.38

Summary link to network LSA (third kind of LSA)

The summary link to network LSA is used by the area border


router to announce the existence of other networks outside
its area.

TCP/IP Protocol Suite

54

Figure 14.39

TCP/IP Protocol Suite

Summary link to network LSA

55

Figure 14.40

Summary link to AS boundary router LSA (fourth kind of LSA)

The summary link to AS boundary LSA is used to announce the rout


AS boundary router. So a router inside an area can send a packet ou
the AS.

TCP/IP Protocol Suite

56

Figure 14.41

Summary link to AS boundary router LSA

This packet defines the network to which the AS boundary rout


is attached. If a message can reach the network, it can be picke
by the AS boundary router.

TCP/IP Protocol Suite

57

Figure 14.42

External link LSA (fifth kind of LSA)

This packet provides info about the networks that are available
outside AS to the routers inside the AS. The AS boundary router
floods the AS with the cost of each network outside the AS using
a routing table created by an interdomain routing protocol.

TCP/IP Protocol Suite

58

Figure 14.43

External link LSA

Each advertisement announces one single network.


If there is more than one network, separate announcements
are made.

The AS boundary router may define a forwarding router that can


provide a better route to the destination. The packet also can inc
an external route tag used by other protocols but not OSPF.
TCP/IP Protocol Suite

59

Figure 14.44

Hello packet (Type 1 OSPF packet)

Used to create neighborhood relationships and to test


the reachability of neighbors.
Network mask: Defines the mask of the network over
which the hello message is sent.

Hello interval: number of seconds between hello


message.
E = 1: the area is a stub network.
T = 1: the router supports multiple metrics.
TCP/IP Protocol Suite

60

Priority: Defines the priority of the router to be a


designated router. The router with the highest priority is
chosen as the designated router. The router with the
second highest priority is chosen as the backup designated
router. If the value of this field is 0, it means the router
never wants to be a designated or a backup designated
router.
Dead interval: Defines the number of seconds that must
pass before a router assumes that a neighbor is dead.
Designated router IP address: The IP address of the
designated router for the network over which the message
is sent.
Backup designated router IP address: The IP address of the
backup designated router for the network over which the
message is sent.
Neighbor IP address: Defines the routers that agreed to be
the neighbors of the sending router (the routers that send
hello
messages
to the sending router.
TCP/IP
Protocol
Suite

61

Figure 14.45

Database description packet

When a router is connected to the system for the first


time or after a failure, it needs a complete link state
database immediately.
After a router is connected to the system, it sends hello
packets to its neighbors and since this the first time the
neighbors hear from it, they send a database description
message.

A database description message only gives an outline


about each line in the database.
The new router examines the outline and finds out which
lines of information it doesnt have. It then sends one or
more link state request packets to get full info about
that
particular link.
TCP/IP Protocol
Suite

62

E = 1: means the advertising router is an AS boundary


router (E stands for External).
B = 1: means the advertising router is an area border
router.
I (initialization) = 1 : means this is the first message.
M (more) = 1 : means this is not the last message. Because
the database description can be very long, its contents can
be divided into several messages.
M/S (master/slave) flag: it indicates to the origin of the
packet.
1 = master, 0 = slave.
Message sequence number: contains the SN of the
message. Used to match a request to a response.
LSA header: Already discussed in the link state update
message section. The header gives an outline about each
link,
without
details. It is repeated for each link in the link
TCP/IP
Protocol
Suite
state database

63

Figure 14.46

Link state request packet (Type 3 OSPF packet)

When a router needs information about a specific route


or routers, it sends a link state request packet. The reply
is a link state update packet.

The three fields here are part of the LSA header which are
already discussed.

TCP/IP Protocol Suite

64

Figure 14.47

Link state acknowledgment packet (Type 5 OSPF packet)

ACKs for every link state update packet.


The two sections are sufficient to acknowledge a packet.

TCP/IP Protocol Suite

65

Note:
OSPF packets are encapsulated in IP
datagrams.

TCP/IP Protocol Suite

66

14.6 PATH VECTOR ROUTING


Path vector routing is similar to distance vector routing. There is at least
one node, called the speaker node, in each AS that creates a routing
table and advertises it to speaker nodes in the neighboring ASs.
Only the speaker nodes communicate.
The speaker node advertises the path, not the metric of the nodes .

TCP/IP Protocol Suite

67

Figure 14.48

TCP/IP Protocol Suite

Initial routing tables in path vector routing

68

Figure 14.49

TCP/IP Protocol Suite

Stabilized tables for four autonomous systems

69

14.7 BGP
Border Gateway Protocol (BGP) is an interdomain routing protocol
using path vector routing. It first appeared in 1989 and has gone
through four versions.
BGP interconnects three different types of AS:
1. Stub AS, e.g. a corporate network
2. Multihomed AS, e.g. a large corporate network with connections to
multiple ASs, but does not allow traffic to pass thru (transient)
3. Transit AS - one that allows transient traffic, such as an Internet
backbone

TCP/IP Protocol Suite

70

Figure 14.50

Internal and external BGP sessions

The E-BGP session is used to exchange info between two


speaker nodes belonging to two different AS.

The I-BGP session is used to exchange routing info between


two routers inside an AS.

TCP/IP Protocol Suite

71

Figure 14.51

TCP/IP Protocol Suite

Types of BGP messages

72

Figure 14.52

BGP packet header

Marker: Reserved for authentication.


Length: Total length of the message.
Type: Type of the packet (1, 2, 3, or 4).
TCP/IP Protocol Suite

73

Figure 14.53

Open message

The open message is used to create a neighborhood relationship

A router running BGP opens a TCP connection with a


neighbor and sends an open message. If the neighbor
accepts the neighborhood relationship, it responds with a
TCP/IP
Protocol Suite
keepalive
message.

74

Version: The version of BGP. The current version is


My autonomous system: Defines the AS number.
Hold time: Defines the maximum number of seconds that
can elapse until one of the parties receives a keepalive or
update message from the other. If this time passes, the
router considers the other party dead.
BGP identifier: Defines the router that sends the open
message (usually its IP address).
Option length: Defines the length of the total option
parameters. No options -> 0s.
Option parameters: Each option parameter itself has two
subfields that are the length of the parameter and the
parameter value.
The only option parameter defined so far is authentication.
TCP/IP Protocol Suite

75

Figure 14.54

TCP/IP Protocol Suite

Update message

76

Unfeasible routes length: Defines the length of the next


field.
Withdrawn routes: Lists all the routes that must be deleted
from the previously advertised list.
Path attributes length: Defines the length of the next field.
Path attributes : Defines the attributes of the path (route)
to the network whose reachability is being announced in
this message.
Network layer reachability information: Defines the
network that is actually advertised by this message. It has
a length field (the number of bits in the prefix) and an IP
address prefix (common part of the network address).
Ex. Network address = 153.18.7.0/24
Length = 24, IP address prefix = 153.18.7
TCP/IP Protocol Suite

77

Note:
BGP supports classless addressing and
CIDR.

TCP/IP Protocol Suite

78

Figure 14.55

Keepalive message

The routers running BGP exchange keepalive messages


regularly and before their hold times expire to tell each
other that they are alive.

TCP/IP Protocol Suite

79

Figure 14.56

Notification message

A notification message is sent by a router whenever an


error condition is detected or a router wants to close the
connection (Notification message of type Cease).

Error code: Defines the category of the error.


Error subcode: Defines the type of error in each category.
Error data: Can be used to give more diagnostic info about
the error.

TCP/IP Protocol Suite

80

Table 14.3 Error codes

TCP/IP Protocol Suite

81

Note:
BGP uses the services of TCP
on port 179.

TCP/IP Protocol Suite

82

Das könnte Ihnen auch gefallen