You are on page 1of 34

Border Gateway Protocol

(BGP)
Ejaz Ahmed

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..

The topics discussed in this section include:


Initialization
Sharing
Updating

Initial routing tables in path vector routing

Stabilized tables for four autonomous systems

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.

The topics discussed in this section include:


Types of Autonomous Systems
Path Attributes
BGP Sessions
External and Internal BGP
Types of Packets
Packet Format
Encapsulation

Border Gateway Protocol (BGP)


When a pair of ASs agree to exchange routing
information, each must designate a router that will speak
BGP on its behalf.
These two routers are called the BGP peers of one another.
They are normally near the edge of AS (hence called
Border Routers).
Each AS can have more than one BGP speakers.
Internal Routers do not implement BGP.

Border Gateway Protocol (BGP)


Coordination Among Multiple BGP Speakers
If an AS has multiple routers each communicating with a
peer in an outside AS, BGP can be used to coordinate
among routers in the AS to guarantee that all propagate
consistent information.
A consistent view of the interior routers are provided by
the IGP.
A consistent view of the routers exterior to the AS can be
provided by having all BGP Speakers within the AS,
maintain BGP connection with each other.
Connection between BGP speakers of different AS are
referred to as external links while connections between BGP
speakers within the same AS is referred as internal links.

BGP

Characteristics

Propagation of Reachability Information:


BGP allows an AS to advertise destinations that are
reachable either in or through it and learn such
information from other AS.
Path Information
In addition to specifying destinations that can be
reached and a next hop for each, BGP advertisements
include path information that allows the receiver to
learn a series of ASs along a path to the destination.

BGP

Characteristics

Next-hop Paradigm
Like distance-vector routing protocols, BGP supplies
next hop information for each destination.
Policy Support
BGP can implement policies.
A router running BGP can be configured to distinguish
between the set of destinations reachable by computers
inside the AS and the set of destinations advertised to
other autonomous systems.

BGP Characteristics
Incremental Updates
To conserve network bandwidth, BGP does not pass full
information in each update.
Full information is only passed once, and latter only
updates are sent (deltas).
Classless Addressing
BGP supports CIDR addresses.
A mask is sent along each address.
Route Aggregation
BGP allows multiple related destinations to be grouped
into one entry.

BGP Characteristics
Authentication
Authentication is also provided in BGP.
Sender is verified using an authentication code.
Different authentication codes can be used.
Reliable Transport
BGP is unusual among routing protocols because it uses
TCP for all communication.
This eliminates the need to implement explicit
fragmentation, retransmission, Acks, and sequencing.
Uses TCP port 179.

BGP Routing Information Base (RIB)


Routes are stored in Routing Information Base (RIB)
RIB consists of three distinct parts
Adj-RIBs-In
Loc-RIB
Adj-RIBs-Out

BGP Routing Information Base (RIB)


Adj-RIB-In
Store routing information that has been learned from the inbound
UPDATE messages. These contents represent the routes that are
available as input to the decision process.

Loc-RIB
Store local routing information that has been selected by applying
local policies to the information contained in Adj-RIB-In.
Routes that would be used by the local BGP speaker are present in
the Loc-RIB.

Adj-RIB-Out
Store routing information that the BGP speaker has selected for
advertisement to its peers (external links). This information will be
carried out in the UPDATE message to the peers.

BGP Operations (Simplified)

Establish session on
TCP port 179

AS1
BGP session

Exchange all
active routes

Exchange incremental
updates

AS2
While connection
is ALIVE exchange
route UPDATE messages
14

Types of BGP messages

BGP packet header

Minimum message size is 19 octets.


Maximum allowable length is 4096 octets.
In the initial message the Marker contains all 1s.

Open message

BGP OPEN Message


A router uses OPEN message to establish a connection
with another neighboring router.
It declares its AS number and other operating parameters.
Hold Time tells the peer the duration it should hold the
connection when no communication is going on
The receiver is required to start a timer using this value
The timer is reset each time a message is received.
If the timer expires the receiver assumes the sender is
no longer available and stops forwarding datagrams
along routes learned from that sender.
Hold Time is either zero or at least three seconds.

BGP OPEN Message


BGP Identifier field contains a 32 bit integer that
uniquely identifies the sender.
The sender uses the same identifier if it has
peer relationships with multiple peers.
The router chooses one of is IP addresses to use
with all BGP peers.
The last field of an OPEN message is optional.
If present, the field Option Length specifies the
length measured in octets, of the optional field.

BGP OPEN Message


When parameters are present, each parameter in
the list is preceded by a two octet header with the
first octet specifying the type and the other specifies
the length.
If no parameters are specified, the value of Option
Length is zero and message ends here.
Only one parameter type is specified; Type 1 is
reserved for authentication.

BGP OPEN Message


When a receiver accepts an incoming OPEN message, BGP
machine replies with a KeepAlive message.
A KeepAlive message acts as an ACK for the open message.

Update message

BGP UPDATE Message


Unfeasible route length
Specifies the size of withdrawn destinations
If zero then no destination are being withdrawn.
WITHDRAW ROUTES
Contains list of addresses to be withdrawn
Each destination is encoded as 2 tuple of the form <length, prefix>
PATH ATTR. LEN
Specifies the total length of the Path Attributes field in octets.
Value of zero indicates no NLRI is present.
PATH ATTRIBUTES
Additional information apart from NextHop are contained in Path
Attributes.

BGP UPDATE Message


A sender can use Path Attributes to specify
A next hop for the destination
A list of autonomous systems along the path to the destinations.
Whether the path was learned from another AS or derived from
within the senders AS.

Attribute Type

Flags

Code

Attribute Length

Attribute Value

Flag Bits

Description

1 optional/ 0 Welknown

1 for transitive/ 0 for non transitive

1 for partial / 0 for complete

1 if length field is 2

4-7

Unused

BGP UPDATE Message


BGP attributes are classified into four categories
Well-known mandatory
Well-known discretionary
Optional transitive
Optional non-transitive
Well known attributes are those that must be implemented in all BGP
routers.
Mandatory attributes must be present in all UPDATE messages;
otherwise the connection will fail.
Discretionary attributes may or may not be present in all UPDATE
messages.
Optional attributes are those that do not have to be recognized by all
BGP implementations.
Transitive attributes are passed on to other peers.

BGP UPDATE Message

TYPE CODE

Description

Specify the origin of the path info

List of AS on path to destination

Next hop to use for destination

Multiple AS exit points

Preference used within an AS

Routes have been aggregated

ID of AS that aggregated the route

Length field follows the type field (1 or 2 octet long).


Receiver uses the type field to get length field and then from contents of length
field determine the size of value field.

Note:
BGP supports classless addressing
and CIDR.

BGP Attributes
Value
----1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
...
255

Code
--------------------------------ORIGIN
AS_PATH
NEXT_HOP
MULTI_EXIT_DISC
LOCAL_PREF
ATOMIC_AGGREGATE
AGGREGATOR
COMMUNITY
ORIGINATOR_ID
CLUSTER_LIST
DPA
ADVERTISER
RCID_PATH / CLUSTER_ID
MP_REACH_NLRI
MP_UNREACH_NLRI
EXTENDED COMMUNITIES

Reference
--------[RFC1771]
[RFC1771]
[RFC1771]
[RFC1771]
[RFC1771]
[RFC1771]
[RFC1771]
[RFC1997]
[RFC2796]
[RFC2796]
[Chen]
[RFC1863]
[RFC1863]
[RFC2283]
[RFC2283]
[Rosen]

Most
important
attributes

reserved for development

From IANA: http://www.iana.org/assignments/bgp-parameters


Not all attributes
need to be present in
every announcement

Attributes are Used to Select Best Routes


192.0.2.0/24
pick me!

192.0.2.0/24
pick me!

192.0.2.0/24
pick me!

192.0.2.0/24
pick me!

Given multiple
routes to the same
prefix, a BGP speaker
must pick at most
one best route
(Note: it could reject
them all!)

ASPATH Attribute
AS 1129

135.207.0.0/16
AS Path = 1755 1239 7018 6341

135.207.0.0/16
AS Path = 1239 7018 6341

AS 1239
Sprint

AS 1755

135.207.0.0/16
AS Path = 1129 1755 1239 7018 6341

Ebone

AS 12654

AS 6341
AT&T Research

RIPE NCC
RIS project

135.207.0.0/16
AS Path = 7018 6341

AS7018
135.207.0.0/16
AS Path = 6341

Global Access

135.207.0.0/16
AS Path = 3549 7018 6341

AT&T
135.207.0.0/16
AS Path = 7018 6341

AS 3549
Global Crossing

135.207.0.0/16
Prefix Originated

30

Keepalive message

Notification message

Error codes

Reading Guidelines
RFC 1771

You might also like