Professional Documents
Culture Documents
Border Gateway Protocol-4: K.K.Singh DGM (DX) Tel: +91-120-2728209 (O) +91-120-2728219 (R) E-Mail: KK - Singh@bsnl - in
Border Gateway Protocol-4: K.K.Singh DGM (DX) Tel: +91-120-2728209 (O) +91-120-2728219 (R) E-Mail: KK - Singh@bsnl - in
K.K.Singh
DGM(DX)
Tel: +91-120-2728209 (O)
+91-120-2728219 (R)
E-mail: kk_singh@bsnl.in
Why BGP-4 ?
IGPs decide about the best path based on technical
considerations and limitations. IGPs don’t allow
network administrators to have much say in deciding
about the routes.
Some times due to security, business, political,
economical and other considerations network
administrators need to deploy some routing policy
while getting connected with other networks.
Deployment of these routing policies are possible only
with BGP-4 as IGPs does not have the flexibility to
allow the network administrators to play with the
routing decisions taken by IGPs.
ALTTC/DX/KKS/BGP 2
Why BGP-4 ?
BGP-4 is an Exterior Gateway Routing
protocol(EGP) which is run between
Autonomous systems.
BGP-4 allows the network administrators to
deploy routing policies depending on different
considerations.
At present BGP-4 is only available exterior
gateway protocol deployed between
autonomous systems.
ALTTC/DX/KKS/BGP 3
The BGP Routing Process
A pool of routes that a router receives from its peers
An input Policy Engine that can filter the routes or
manipulate their attributes
A decision process that decides which routes the router
itself will use
A pool of routes that the router itself uses
An Output Policy Engine that can filter the routes or
manipulate their attributes.
A pool of routes that the router advertises to other
peers
ALTTC/DX/KKS/BGP 4
The BGP routing Process
BGP Table
IP Routing Table
ALTTC/DX/KKS/BGP 5
Autonomous System
A set of routers that has a single routing policy,
that run under a single technical administration,
and commonly utilises a single IGP. It could
also be a collection of IGPs working together to
provide interior routing
To the outside world the entire AS is viewed as
a single entity
Each AS has a unique identifying number,
assigned by Internet Registry or an ISP in the
instance of a private AS
ALTTC/DX/KKS/BGP 6
Autonomous System
Routing information between ASs is exchanged
via an exterior gateway protocol such as BGP4
Each AS can run its own set of IGPs,
independent of other ASs
Intra-AS routing is usually optimised in
accordance with the required technical demands
Inter-AS usually reflects political and business
relationships between the networks and
companies involved
ALTTC/DX/KKS/BGP 7
BGP4
The whole Internet is a graph of ASs
BGP constructs an graph of ASs based on
information exchanged between BGP routers
Connection between two ASs form a path
Collection of path information forms a route to
reach a specific destination
BGP uses the path information associated with a
given destination to ensure loop-free inter
domain routing
ALTTC/DX/KKS/BGP 8
Stub-Autonomous System
Stub-AS is an AS which reaches networks outside its
domain via a single exit point
Also known as Single-Homed AS
Hard to get a registered AS number for Stub-AS
because the customer routing policies are an extension
of the policies of a single provider
Provider give the customer an AS number from private
pool of ASs i.e. from 65412-65535
Stub-AS does not have to learn Internet routes from its
provider because of single exit point
ALTTC/DX/KKS/BGP 9
Stub-Autonomous System
Provider can use different methods to advertise
the customer’s routes to other networks
List the customer’s subnets as static entries in its
router
These entries would then be advertised towards the
internet via BGP
Provider can employ IGP between the customer and
provider for advertising customer’s networks
Provider can learn and advertise customer’s route by
employing BGP between the customer and the
provider
ALTTC/DX/KKS/BGP 10
Multi-Homes Autonomous System
An AS is multi-homed if it has more than one
exit point to the outside world
An AS can be multi-homed to a single provider
or multiple providers
Multi-Homed Non-Transit AS
A Non-Transit AS does not allow transit traffic to go
through it
Multi-Homed Transit AS
A Transit AS allows transit traffic to go through it
ALTTC/DX/KKS/BGP 11
Multi-Homed Non-Transit AS
AS 2 AS 3
N3,N4 N5,N6
N1, N2 N1, N2
N3, N4 N5, N6
X X
N5, N6 AS 1 N3, N4
N1,N2
ALTTC/DX/KKS/BGP 12
Multi-Homed Transit AS
AS 2 AS 3
N3,N4 N5,N6
N3, N4 N5, N6
N1, N2 N1, N2
N5, N6 N3, N4
AS 1
N1,N2
ALTTC/DX/KKS/BGP 13
BGP4
BGP is an EGP but can be used inside an AS as a pipe
to exchange BGP updates
BGP connection between routers inside an AS are
referred to as internal BGP (iBGP)
IBGP is a tunnel through which routing information
flows
BGP connection between routers in separate ASs are
referred to as external BGP (eBGP)
Routers that are running iBGP are called transit routers
when they carry transit traffic going through the AS
ALTTC/DX/KKS/BGP 14
Why iBGP ?
When an AS is configured as transit AS, routes
learned from one ASBR of that AS should must
forward those routes to other ASBRs of its own
AS.
Redistributing BGP into IGP for carrying the
BGP routes to other ASBRs will result in
crashing of IGP as IGP is not designed to
handle that many routes.
iBGP works as conduit between BGP speaking
routers and carries the BGP routes without
getting mixed into IGP
ALTTC/DX/KKS/BGP 15
Why iBGP ?
EBGP
EBGP
OSPF
Full Mesh iBGP session is required
iBGP
To be created between all iBGP
GP
iB
ALTTC/DX/KKS/BGP 16
How BGP works?
BGP is a path vector protocol used to carry routing
information between ASs
Routing information carries a sequence of AS numbers that
identifies the path of ASs that a network prefix has traversed
The path information associated with prefix is used to enable
loop prevention
BGP uses TCP as its transport protocol (Port 179)
All the transport reliability is taken care of by TCP
Routers that run a BGP routing process are referred to
as BGP speakers
ALTTC/DX/KKS/BGP 17
How BGP works?
Two BGP speakers that form a TCP connection
for the purpose of exchanging routing
information are referred to as neighbors or peers
BGP speakers exchange four type of packets
between them
1. Open Message
2. Update message
3. Notification message
4. Keepalive
ALTTC/DX/KKS/BGP 18
BGP Messages
KEEPALIVE Messages
ALTTC/DX/KKS/BGP 19
BGP Messages
OPEN Message
Exchanged between BGP peer routers to establish
session
Certain connection parameters are communicated
e.g. BGP speaker’s version number
NOTIFICATION Error Message
Due to disagreement between connection parameters
the session is not established and NOTIFICATION
error message is sent
ALTTC/DX/KKS/BGP 20
BGP Messages
UPDATE Messages
Complete routes are exchanged between the peers
Only incremental updates are sent after this
KEEPALIVE Messages
In a steady state situation, the peer routers exchange
only KEEPALIVE Messages every 60 seconds
ALTTC/DX/KKS/BGP 21
BGP Message Header Format
Octet-0 Octet-1 Octet-2 Octet-3
MARKER
MARKER
MARKER
MARKER
LENGTH TYPE
ALTTC/DX/KKS/BGP 22
BGP Message Header Format
Marker-16 Bytes
Either used to authenticate incoming messages or
detect loss of synchronisation between two BGP
peers
Can have one of the two formats for OPEN type
messages
If the OPEN message has no authentication, the Marker
field must be all 1s
Otherwise, the Marker field will be computed based on
part of the authentication mechanism used.
ALTTC/DX/KKS/BGP 23
BGP Message Header Format
Length-2 Bytes
Indicates total BGP message length, including the
header
Smallest BGP Message is 19 bytes i.e. BGP Header only
Largest BGP Message can be upto 4096 bytes
Type-1 Byte
Indicate the message(Packet) type
OPEN (1)
UPDATE (2)
NOTIFICATION (3)
KEEPALIVE (4)
ALTTC/DX/KKS/BGP 24
BGP Neighbor Negotiation
BGP protocol establish sessions between BGP
peers
Neighbor negotiation is based on
The successful completion of a TCP transport
connection
The successful processing of the OPEN message
ALTTC/DX/KKS/BGP 25
OPEN Message Format
Octet-0 Octet-1 Octet-2 Octet-3
VERSION
MY AUTONOMOUS SYSTEM
HOLD TIME
BGP IDENTIFIER
OPT PARA LEN
OPTIONAL PARAMETERS
OPTIONAL PARAMETERS
ALTTC/DX/KKS/BGP 26
OPEN Message Format
Version-1 Byte
Indicates the version of BGP message
During neighbor negotiation, BGP peers negotiate
the highest common version that both can support
BGP session is reset until a common supported
version is determined by the peers
Most implementations default to BGP4
ALTTC/DX/KKS/BGP 27
OPEN Message Format
Hold Timer
Maximum time in seconds that may elapse between
the receipt of successive KEEPALIVE or UPDATE
messages
BGP peers negotiate the hold time but unlike
Version the session is not reset if the values do not
match
Receipt of KEEPALIVE/UPDATE message reset
the timer to zero
The timer could be set to zero, means the connection
is considered to be always up
ALTTC/DX/KKS/BGP 28
OPEN Message Format
BGP Identifier-4 Bytes
Indicates the sender’s BGP ID
Usually equal to the Router ID
ALTTC/DX/KKS/BGP 29
OPEN Message Format
The field is represented by the triplet
Parameter Type-1 Byte
Parameter Length-1 Byte
ALTTC/DX/KKS/BGP 30
NOTIFICATION Message Format
Octet-0 Octet-1 Octet-2 Octet-3
ERROR ERROR SUBCODE DATA ..….
DATA …….
Unfeasible Routes
ALTTC/DX/KKS/BGP 33
Network Layer Reachability
Information
NLRI lists the set of destinations about which
BGP is trying to inform its neighbors
NLRI consists of one or more instances of the
2-tuple format <Length, Prefix>
Length
Number of masking bits
Prefix
Network’s IP Address
<19, 198.24.160.0>
11000110.00011000.101/00000.00000000
ALTTC/DX/KKS/BGP 34
Unfeasible Routes
Withdrawn routes provides a list of routes that
are no longer in service and need to be
withdrawn from BGP routing tables
Like NLRI, withdrawn routes are also
represented by 2-tuple format <Length, Prefix>
Unfeasible Route Length-2 Bytes
Length in bytes of the total withdrawn routes
Length of zero indicates that no routes to be
withdrawn
Multiple routes can be withdrawn at the same time
ALTTC/DX/KKS/BGP 35
Path Attributes
Set of parameters used to keep track of route
specific information
Used in BGP filtering and route decision process
A triple of the form <Attribute Type, Attribute
Length, Attribute Value>
Falls under 4 categories
Well-known Mandatory
Well-known Discretionary
Optional Transitive
Optional Non-transitive
ALTTC/DX/KKS/BGP 36
Path Attributes
Well-known Mandatory
Has to exist in BGP UPDATE packet
If missing, a NOTIFICATION error is generated
and session is closed
AS_PATH (Attribute Code-2)
NEXT_HOP (Attribute Code-3)
Well-known Discretionary
Might or might not be sent in BGP UPDATE packet
LOCAL_ PREF (Attribute Code-5)
ATOMIC AGGREGATE (Attribute Code-6)
ALTTC/DX/KKS/BGP 37
Path Attributes
Optional Transitive
BGP implementation should accept and pass on to
other BGP peers
AGGREGATOR (Attribute Code-7)
COMMUNITY (Attribute Code-8)
Optional Non-transitive
The attribute should be quietly ignored and not
passed along to other BGP peers
ORIGINATOR_ID (Attribute Code-9)
CLUSTER_LIST (Attribute Code-10)
ALTTC/DX/KKS/BGP 38
Path Attributes
The attribute type is a 2 Byte field
ALTTC/DX/KKS/BGP 39
ORIGIN (Code-1)
Indicates the origin of the routing update w.r.t.
the AS that originated it
0-IGP: NLRI is internal to the originating AS
1-EGP: NLRI is learnt via the EGP
2-INCOMPLETE: NLRI is learnt by some other
means
Used for preference ranking among multiple
routes
BGP prefers the path with the lowest origin
value
ALTTC/DX/KKS/BGP 40
AS_PATH (Code-2)
Each AS while passing the routes to other EBGP
peers, prepend its AS number
The list represents all the AS numbers that a
route has traversed
If the route is advertised to an AS whose AS
number is already present in the list, the
UPDATE is ignored
Used to ensure a loop free topology
While comparing different routes, a shorter
AS_PATH is always preferred over a longer one
ALTTC/DX/KKS/BGP 41
AS_Path
AS2 X.
X.
X.
X
- 1 –2
X ,1
.X.
X
X.
AS1 AS3
1
,2,
X.
– 3
X
X
.X
.X.
.X
X
X.
–
X.X.X.X
4,
3,
2,
AS4
1
ALTTC/DX/KKS/BGP 42
NEXT_HOP (Code-3)
Next hop in IGP is the IP address of the
connected interface of the router that has
announced the route
Next hop in BGP takes one of the following 4
forms
For eBGP sessions
The next hop is the IP address of the neighbor that
announced the route
For iBGP sessions, for routes originated inside the
AS
The next hop is the IP address of the neighbor that
announced the route
ALTTC/DX/KKS/BGP 43
NEXT_HOP (Code-3)
For routes injected into the AS via eBGP
The next hop learned from eBGP is carried unaltered into
iBGP
The next hop is the IP address of the eBGP neighbor from
which the route was learnt
When the route is advertised on a multi-access
medium like ethernet or FR
The next hop is usually the IP address of the interface of
the router connected to the medium that originated the
route
ALTTC/DX/KKS/BGP 44
Next_Hop (Code-3)
128.213.1.0/24
3.3.3.3 1.1.1.1
EBGP
2.2.2.2
IBGP
ALTTC/DX/KKS/BGP 45
Next_Hop (Code-3)
192.212.1.0/24 2.2.2.2
128.213.1.0/24 1.1.1.1
192.212.1.0/24 2.2.2.2
2.2.2.0/24 3.3.3.3
3.3.3.0/24 Connected, serial 0
128.213.1.0.24 1.1.1.1
1.1.1.0/24 3.3.3.3
ALTTC/DX/KKS/BGP 46
MULTI_EXIT_DISC (Code-4)
Hint to external neighbors about the preferred
path into an AS that has multiple entry points
Also known as external metric of a route
A lower MED is preferred over a higher MED
MED attribute is exchanged between ASs
MED attribute received by an AS does not leave
the AS
ALTTC/DX/KKS/BGP 47
MULTI_EXIT_DISC (Code-4)
AS1
17 2
2. 16 . route
.1 6
.0, 0
.0.0
M
,M
ED3
ED
00
200
AS2
Network 172.16.0.0/24
ALTTC/DX/KKS/BGP 48
LOCAL_PREFERENCE (Code-5)
Degree of preference given to a route to
compare it with other routes for the same
destination
Local to the AS and is exchanged between
iBGP peers only
Used to set the exit point of an AS to reach a
certain destination
Higher the local preference value more
preferred the route will be
ALTTC/DX/KKS/BGP 49
LOCAL_PREFERENCE (Code-5)
Network 172.16.0.0/24
AS2
24
/24
0.0/
0.0
6 .
.
.16
.1
17 2
172
Attach a local
Attach a local
AS1 preference 200
preference 300
ALTTC/DX/KKS/BGP 50
ATOMIC_AGGREGATE (Code-6)
Route aggregation causes a loss of information
because the aggregate is coming from different
sources that have different attributes
If a system propagates an aggregate that causes
loss of information, it is required to attach the
ATOMIC_AGGREGATE attribute to the route
ALTTC/DX/KKS/BGP 51
AGGREGATOR (Code-7)
Specifies the AS and the router that has
generated the aggregate
A BGP speaker that performs route aggregation
might add the AGGREGATOR attribute i.e.
speaker’s AS number and Router_ID
ALTTC/DX/KKS/BGP 52
COMMUNITY (Code-8)
A Community is
a group of destinations that share some common
property
not restricted to one network or one AS
e.g. a group of networks belonging to the educational or
government communities
Used to simplify routing policies by identifying
routes based on a logical property rather than an
IP prefix or an AS number
ALTTC/DX/KKS/BGP 53
Controlling Large AS
As the size of AS increases the requirement of
full mesh peering between all iBGP speaking
routers becomes a bottleneck.
To do away with this requirement two methods
are available
Confederations
Route reflectors
ALTTC/DX/KKS/BGP 54
Confederations
AS100
AS65050
EBGP AS65060
EBGP
iBGP
iBGP
EBGP
ALTTC/DX/KKS/BGP 55
Route Reflector
EBGP
Update
Reflected Route
Update
Route
Reflector
IBGP IBGP
RR Client RR Client
Update
Update
EBGP
EBGP
ALTTC/DX/KKS/BGP 56
Route Reflector
The following rules are are used by route
reflector to reflect the routes received from
other BGP speakers ;
If the route received from a non client peer, reflect
to clients only.
If the route is received from a client peer, reflect to
all non-client peers and also to client peers, except
the originator of the route.
If the route is received from an EBGP peer, reflect
to all client and non-client peers.
ALTTC/DX/KKS/BGP 57
ALTTC/DX/KKS/BGP 58