Sie sind auf Seite 1von 36

0

www.huawei.com
Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
BGP Routing Protocol
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
1
Page1 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Objectives
Upon completion of this course, you will be able to:
Understand the principle of BGP
Understand the features of Attributes
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
2
Page2 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Contents
1. Principle of BGP
2. BGP Route Attributes
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
3
Page3 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Overview Of BGP
BGP is an exterior routing protocol, used to transmit routing
information between ASs
It is a kind of distance-vector routing protocol and avoids the
occurrence of loop in design. It provides additional attribute
information for the route
Transfer protocol: TCP; port No.: 179
It supports Classless Inter-Domain Routing (CIDR)
Route updating: transmit incremental routes only
Abundant route filtering and routing policies
Border Gateway Protocol (BGP) is a dynamic routing protocol. Its
basic function is to automatically exchange the loopless routing
information between Autonomous Systems (AS). By exchanging the
path-reachable information with AS sequence attribute, it can
construct the topology map of the autonomous area, thus removing
the route loop and implementing the routing strategy configured by
the user. Compared with protocols like OSPF and RIP, which run
inside the autonomous area, BGP is a kind of Exterior Gateway
Protocol (EGP) while OSPF and RIP are Interior Gateway Protocol
(IGP). BGP is usually used between ISPs.
BGP has been put into use since 1989. Its three earliest versions are
RFC1105 (BGP-1), RFC1163 (BGP-2) and RFC1267 (BGP-3)
respectively. The current version is RFC1771 (BGP- 4). With the
fast development of the Internet, the volume of the routing table
expands quickly as well, and the amount of routing information
exchanged between ASs is also ever increasing, which affects the
network performance. BGP supports Classless Inter-Domain
Routing (CIDR), which can effectively reduce the ever-expanding
routing table. BGP-4 is fast turning into the actual standard of the
Internet border routing protocol. Its features are described as
follows:
BGP is a kind of exterior routing protocol, different from interior
routing protocol like OSPF and RIP. It focuses on the control of
route advertising and the selection of optimal routes, instead of
route discovery and calculation.
By taking the AS path information, it can thoroughly solve the
problem of route cycle.
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
4
Page4 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Autonomous System
What is an Autonomous System (AS)?
which routing protocol running inside the AS
Which routing protocol running between ASs
The Autonomous System (AS) refers to a set of routers, which are
managed by the same technical management organization and adopt
the unified routing strategy. Each AS has a unique AS number, which
is allocated by the management organization authorized by the
Internet.
IGP routing protocol such as static route, OSPF , IS-IS etc
BGP only
The Autonomous System (AS) refers to a set of routers, which are
managed by the same technical management organization and adopt
the unified routing strategy. Each AS has a unique AS number, which
is allocated by the management organization authorized by the
Internet.
The basic concept of introducing the AS is to differentiate different ASs
by different numbers. Thus, when the network administrator does not
want his own communication data to pass some AS, this numbering
method becomes very useful. Maybe the administrator's network can
access this AS absolutely. However, if this AS is managed by his
component or lacks enough security mechanism, he needs to avoid
this AS. By adopting the routing protocol and AS number, the routers
can specify the path between them and the method for routing
information exchange.
The AS numbers range from 1 to 65535. Among them, the numbers
from 1 to 64511 are the registered Internet number, and those from
64512 to 65535 are the private network numbers.
Quiz
How many AS number available to the public internet network?
A: 1~64511
B: 1~65525
C: 64512~65535
D: 0~65535
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
5
Page5 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Working Mechanism Of BGP
AS1
AS7
AS6
AS5
AS4
AS3
AS2
As the application layer protocol, the BGP system runs on a special
router. During the first startup of the system, the routing information is
exchanged by sending the whole BGP routing table. Later, for the
objectives of updating the routing table, only the update message is
exchanged. During the operation, the system checks whether the
connection is normal by receiving and sending the keep-alive message.
The router, which sends the BGP message, is called the BGP speaker.
It continuously receives and generates new routing information, and
advertises it to other BGP speakers. When a BGP speaker receives
new route advertisement from other ASs, it will advertise this route to
all the other BGP speakers inside the AS if this route is better than the
currently known route, or currently there is no acceptable route. A
BGP speaker calls other BGP speakers that exchange message with it
as peer. Several related peers can construct a group.
Generally, a route is generated inside the AS. It is discovered and
calculated by some interior routing protocol and transmitted to the
boundary of the AS. Then, The Autonomous System Boundary Router
(ASBR) spreads it to other ASs via the EBGP connection. During the
spreading, the route may pass several ASs, which are called the
transitional AS, such as AS5. If this AS has multiple boundary routers,
information will be exchanged among these routers by running IBGP.
In this case, the internal routers need not know these exterior routes.
They only need to maintain the IP connectivity among the boundary
routers, such as AS2, AS3 and AS4. After the route reaches the AS
boundary, ASBR can redistribute the route into the interior routing
protocol if the interior router needs to know these exterior routes. The
exterior routes have a large amount, which will usually exceed the
processing capability of the interior routers. So, filtering or aggregation
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
6
Page6 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
IBGP Neighbor & EBGP Neighbor
EBGP
RTB
RTC
IBGP
RTA
RTD
RTE
EBGP
AS100
AS200
AS300
On the router, BGP runs in the following two modes: IBGP (Internal BGP),
EBGP (External BGP)
If two peers that exchange BGP messages belong to the same AS, they are
Internal BGP (IBGP), such as RTB and RTD.
If two peers that exchange BGP messages do not belong to the same AS,
they are External BGP (EBGP), such as RTA and RTB.
Although BGP runs between ASs, it is also necessary to establish BGP
connection between different border routers of an AS. Only in this way, can
routing information be transmitted in the entire network, such as RTB and
RTD. To establish the communication between AS100 and AS300, we need
to establish IBGP connection between them.
The direct connection is not necessarily established between IBGP peers
physically, but the full logical connection between them must be ensured (it
suffices if TCP connection can be created).
In most of the cases, there is physically direct link between EBGP peers.
However, if it is hard to realize, remedy can be done by configuring the
command "neighbor neighbor-address ebgp-multihop[ttl]". Here, "ttl" is the
maximum hop count. Its default value is 64 and the value range is 1-255.
Quiz
1. Which of the following statements about IBGP routers are true? (Select one.)
A. They must be fully meshed.
B. They can be in a different AS.
C. They must be directly connected.
D. They do not need to be directly connected.
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
7
Page7 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Route Advertising Principles of
BGP
BGP Speaker only selects the best one for its own use
BGP Speaker only advertises the routes used by itself to its neighbors
For the routes obtained from EBGP, the BGP Speaker will advertise them
to all its neighbors (including EBGP and IBGP)
For the routes obtained from IBGP, the BGP Speaker will not advertise
them to its IBGP neighbors
For the routes obtained from IBGP, whether the BGP Speaker will
advertise them to its EBGP neighbors depends on the synchronization
state of IGP and BGP
Once the connection is established, the BGP Speaker will advertise all its
BGP routes to the new neighbors
Route advertising principles of BGP:
In the case of multiple paths, the BGP Speaker only selects the best
one for its own use.
The BGP Speaker only advertises the routes used by itself to its
neighbors.
For the routes obtained from EBGP, the BGP Speaker will advertise
them to all its neighbors (including EBGP and IBGP).
For the routes obtained from IBGP, the BGP Speaker will not
advertise them to its IBGP neighbors.
For the routes obtained from IBGP, whether the BGP Speaker will
advertise them to its EBGP neighbors depends on the synchronization
state of IGP and BGP.
Once the connection is established, the BGP Speaker will advertise
all its BGP routes to the new neighbors.
These principles were stipulated by the BGP designers when they
were developing the BGP routing protocol. Further study of the
reasons is outside the scope of this document.
Quiz
what would BGP router do when the TCP connection established ?
A: exchange the routing table between the BGP neighbors
B: exchange the BGP routes between the BGP neighbors
C: check the BGP version ,as numbers to form the EBGP/IBGP
relationship
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
8
Page8 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
BGP Synchronization
EBGP
EBGP
RTB
RTC
IBGP
RTA
RTD
RTE
RTF
E0:10.1.1.1/24
AS100
AS200
AS300
It is stated in the BGP protocol that: a BGP router does not advertise
the routing information learnt from the internal BGP peers to the
external peers, unless this information can also be obtained from IGP.
If a router can learn about this routing information via IGP, then it can
be considered that the route can be broadcast inside AS and the
internal connection is ensured.
One of major duties of BGP is to transmit the network reachability
information of this AS to other ASs. As shown in the figure above, RTB
will encapsulate the routing information toward 10.1.1.1/24 into the
UPDATE message, and advertise it to RTE via the TCP connection
established by RTC and RTD. If RTE does not take synchronization
into account, it will directly accept such routing information and report
it to RTF, then if RTF or RTE has the data packet to be sent to
10.1.1.1/24, this packet must pass RTD and RTC if it wants to reach
the destination. As the synchronization was not taken into account in
advance, the routing tables of RTD and RTC have no routing
information to 10.1.1.1/24 and the data packet will be discarded when
it reaches RTD. So, BGP must be synchronous with IGP (e.g., RIP,
OSPF, etc.). Synchronization means that BGP will not advertise the
transitional information to other ASs until IGP broadcasts this routing
information successfully in its AS . That is, after a router receives the
update information of a destination from the IBGP peer, it shall attempt
to verify whether this destination can be reached via the internal AS
before advertising it to other EBGP peers (i.e., verify whether this
destination is within IGP, and whether the non-BGP router can
transmit this traffic to this destination). If IGP knows this destination, it
will receive such routing information and then advertise it to EBGP
peers. Otherwise, it will consider that this route is asynchronous with
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
9
Page9 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Full Dynamic Redistribution
OSPF discovers route 18.0.0.1/8
Dynamically redistribute the route discovered by IGP (OSPF)
into the BGP routing table of RTB
18.0.0.1/8
OSPF
RTB
AS200
The BGP routing protocol runs between ASs. Its major work is to
transmit routing information between ASs, instead of discovering and
calculating routing information. The work of discovering and calculating
routing information is done by the IGP routing protocol, e.g. RIP and
OSPF. The routing information of BGP needs to be redistributed into
BGP in the mode of configuration commands.
According to the redistribution mode, it can be classified into three
types: purely dynamic redistribution, semi-dynamic redistribution and
static redistribution.
Purely dynamic redistribution means that the router gets the routing
information by IGP routing protocol and then dynamically redistributes
it into BGP.
As shown in the figure above, RTB dynamically detects the routes
going to the network 18.0.0.0/8 via OSPF protocol and then
dynamically redistributes it into BGP. We call such a kind of route
redistribution mode as purely dynamic redistribution.
The route leading to the network 18.0.0.0/8 is redistributed from OSPF.
Meanwhile, other routing information of OSPF is also redistributed into
BGP.
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
10
Page10 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Semi Dynamic Redistribution
OSPF discovers the route 18.0.0.1/8
Semi-dynamically redistribute the route discovered by IGP
(OSPF) into the BGP routing table of RTB
18.0.0.1/8
RTB
AS200
OSPF
Semi-dynamic redistribution means that the routing information is
dynamically discovered and calculated by IGP routing protocol. Part of
the specified routing information will be selectively redistributed with
the network command when it is redistributed into the BGP system.
AS shown in the figure above, router B dynamically detects the route
going to the network 18.0.0.0/8 via OSPF protocol and then
redistributes it into BGP statically. Such a kind of route redistribution
mode is called semi-dynamic redistribution.
The route to be redistributed should be specified with the user
interface of the router. As a result, only one specified OSPF route is
redistributed into the BGP routing table.
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
11
Page11 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Static Redistribution
Manually configure the static route 18.0.0.1/8
Redistribute the static route manually configured into the BGP
routing table of RTB
18.0.0.1/8
AS200
RTB
Static redistribution means that the routing information obtained by the
router is the static routing information manually configured, which will
be statically redistributed into the BGP system.
As shown in the figure above, router B first establishes a static route
going to the network 18.0.0.0/8 and then redistributes it into BGP.
Such kind of route redistribution mode is called static redistribution.
As a result, a manually configured route is added into the BGP routing
table.
How many methods can you use to installed the route to the bgp
routing table ?(choose all apply)
A: Full Dynamic Redistribution
B: Semi Dynamic Redistribution
C: Static Redistribution
D: IGP route redistribute
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
12
Page12 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
BGP Messages
There are four types of BGP messages:
Open: greeting--"hello, let's make friends!"
Keepalive: I'm alive, don't leave me alone
Update: fresh news...
Notification: i won't play with you any more!
BGP has four types of messagesOPEN, UPDATE, NOTIFICATION
and KEEPALIVE.
Between BGP peers, an OPEN message is transmitted so as to
exchange information such as version, AS number, hold time and BGP
identifier for negotiation.
What UPDATE message carries is route update information, including
route withdrawal information, reachable information and its path
attributes.
When BGP detects errors (e.g. connection interruption, negotiation
error , message error), it will send the NOTIFICATION message to
shut off the connection with its peers.
The KEEPALIVE messages are sent periodically between BGP
neighbors , so as to ensure the connection is kept alive . The default
timer is 60 seconds.
The OPEN message is mainly used to establish the neighborhood
(BGP peers). It is the initial handshake information between BGP
routers and shall occur before all notification information. Others will
respond with the KEEPALIVE message after receiving the OPEN
message. Once the handshake succeeds, these BGP neighbors can
exchange messages like UPDATE, KEEPALIVE and NOTIFICATION.
Quiz
(1) How many BGP messages available for the BGP version 4(choose
all apply)
A: OPEN
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
13
Page13 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
BGP Message Header
BGP messages have the same format: "message header +
packet body"
The BGP header is given as follows:
Marker(16 byte)
Length(2 byte) Type(1 byte)
The format of BGP header is as shown in the figure above. The width
of each line is 4 bytes.
Marker authentication information: 16 bytes; all 1s. It is mainly used
to check whether the synchronization between BGP peers is lost
and verify the incoming BGP information.
Length: 2 bytes, indicating the length of the entire BGP message,
including the length of the header. The minimum length of BGP
message is 19 bytes (Keepalive message) and the maximum length
of BGP message is 4096 bytes.
Type: 1 byte, indicating the message type, such as OPEN or
UPDATE.
1.OPEN
2.UPDATE
3.NOTIFICATION
4.KEEPALIVE
Quiz
(1)When a BGP speaker receives a message with the type value is 4,
which BGP message type does this message belong to
A: OPEN
B: UPDATE
C: NOTIFICATION
D: KEEPALIVE
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
14
Page14 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Open Message
Open Message consists of the Message header and the
structure below
Optional Parameters
Length (1byte)
Hold Time (2byte)
Version(1byte)
My Autonomous System (2byte)
BGP Identifier (4byte)
Optional Parameters
Version: (1 byte) originating BGP version number.
My Autonomous System: (2-byte unsigned integer), local AS number.
Hold Time: (2-byte unsigned integer), hold time suggested by the
originating end.
BGP Identifier: (4-byte) identifier of the router at the originating end.
Optional parameters Len: (1-byte) the total length of optional
parameters field.
Optional Parameters: (variable length) optional parameters.
The beginning of the message includes the version number of BGP
and the AS number of the sending party. And what follows is the field
of hold time, which is the set seconds of hold timer recommended by
the sending party. The hold timer prescribes the time length within
which BGP neighbors consider the information from the sending party
valid. The next field is BGP identifier (BGP), i.e. the identifier of the
sending party of BGP. This value is determined during the handshake
operation between BGP peers. It remains the same between each
local interface and each BGP peer.
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
15
Page15 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Keepalive Message
Keepalive Message only has the header
Marker(16 byte)
Length(2 byte) Type(1 byte)
The Keepalive message is mainly used to confirm the availability of
links and running states between peer routers. It consists of a BGP
data header only. The requirement for the exchange periodically of
Keepalive message between peer routers is to ensure the peer can
keep the timer within the time limit of expiry.
After a router establishes BGP connection with its neighbors, it will
periodically send the Keepalive message to the peers according to the
time interval set by Keepalive-interval, indicating whether this
connection can be still held.
By default, the time interval between sending Keepalive is 60 seconds.
Quiz
How often are BGP keepalive messages sent by default?
A: every 10 seconds
B: every 30 seconds
C: every 1 minute
D: every 5 minutes
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
16
Page16 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Update Message
An Update Message consists of the header and the
following structure
Withdrawn Routes (variable length)
Unfeasible Routes Length (2byte)
Path Attribute Length (2byte)
Network Layer Reachability Information (variable length)
Path Attributes (variable length)
Unfeasible Routes Len: (2-byte unsigned integer), length of
unreachable route.
Withdrawn Routes: (variable length) withdrawn route.
Path Attribute Len: (2-byte unsigned integer), length of path attribute.
Path Attributes: (variable length) path attributes (described below in
detail).
Network Layer Reachability Information: (variable length) information
on Reachability of the network (destination).
Among them, the expression of the withdrawn route and destination
address is <length, prefix>. "length" indicates the length of the address
prefix, occupying 1 byte. "prefix" is the address prefix, occupying 1-4
bytes.
The UPDATE message is the most important information in the BGP
system, used to exchange routing information between peers. It
comprises three parts at most, i.e. unreachable, path attributes, and
Network Layer Reachability Information (NLRI).
The UPDATE message can advertise a route to BGP peers, and also
can withdraw multiple unreachable routes. The unreachable field
includes a list of IP address prefixes of withdrawn routes. The path
attributes field is a list of path attributes, including attribute type,
attribute length and attribute value. The NLRI field includes a list of
reachable IP address prefixes known by the BGP router.
One UPDATE message can advertise one route only at one time, but
it can also carry multiple path attributes.
One UPDATE message can also advertise multiple routes at one time,
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
17
Page17 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Notification Message
A Notification packet consists of the header and the
structure below
Data (variable length)
Error Code
(1byte)
Error Sub-code
(1byte)
Header
error
1
OPEN
Message
error
2
UPDATE
Message
error
3
Hold
time
expiry
4
State
Machine
error
5
Exit Error Type
6
Error
Code
A notification message is used when error occurs or the peer
connection is stopped. This message carries various error codes (e.g.
timer expiry), including error code, auxiliary error code and error
information.
Error code: (1 byte) error code:
Error subcode: (1 byte) auxiliary error code.
Data: (variable length) depending on various error codes and auxiliary
error codes; used to diagnose error causes.
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
18
Page18 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Finite State Machine of BGP
Active
Open-sent
Open-confirm Established
Idle
Connect
Connect-Retry
timer expiry
TCP connection fails
Connect-Retry
timer expiry
Start
Others
TCP connection fails
Error
Error
Error
KeepAlive
timer expiry
KeepAlive packet
received
1. KeepAlive
timer expiry
2. Update received
3. KeepAlive received
Correct OPEN
packet received
TCP connection setup
TCP connection setup
Others
The BGP finite state machine (FSM) has six states. The procedure of
transition shows the establishment procedure of BGP neighborhood.
The first state is "Idle". Once BGP starts, the state machine enters the
"Connect" state. In this sate, if Connect-Retry timer expires, the BGP
state machine will stay in the "Connect" state. Meanwhile, BGP will
attempt to establish the TCP connection. If the creation of TCP
connection fails, the BGP state machine will enter the "Active" state. If
the TCP connection is established successfully, the BGP state
machine will enter the "OpenSent" state directly. In "Active" state, if
the TCP connection cannot be established yet, the BGP state machine
will stay in the "Active" state and will not enter the "OpenSent" state
until the TCP connection is established successfully. In the
"OpenSent" state, once BGP receives a correct Open message, it will
enter the "OpenConfirm" state. In the "OpenConfirm" state, if the
KeepAlive timer expires, the BGP state machine will stay in the
"OpenConfirm" state. And it will not enter the "Established" state until
BGP receives the KeepAlive message. Till now, the BGP connection is
really established.
In addition, when any of the five states ("Idle" excluded) has errors, the
BGP state machine will return to the "Idle" state.
Idle: "Idle" is the first state of BGP connection. In this state, BGP is
waiting for a start event. After such an event emerges, BGP will
initialize the resources, reset the Connect-Retry timer, and initiate a
TCP connection. Meanwhile, it will enter the "Connect" state.
Connect: in this state, BGP establishes the first TCP connection. If
the Connect-Retry timer expires, BGP will establish the TCP
connection again and continue to stay in the "Connect" state. If the
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
19
Page19 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Application of Messages in BGP
The Open message is sent when establishing a BGP connection
via TCP
After the connection is established, the UPDATE message is sent
to notify the peer of the routing information if a route needs to be
sent or route change occurs
After stabilization, it is necessary to send the KEEPALIVE
message periodically to keep the validity of the BGP connection
When an error is found during the running of local BGP,
NOTIFICATION message shall be sent to notify the BGP peer
BGP establishes the connection via TCP. The local monitoring port is
179. The establishment of BGP connection needs a series of dialogs
and handshakes, which is the same as that of TCP connection. TCP
uses the handshake negotiation to advertise parameters like port. The
handshake negotiation parameters of BGP include BGP version, hold
time of BGP connection, local router ID and authorization information.
They are included in the Open message.
After BGP connection is established, the Update message shall be
sent to advertise the routing information to the peer end if there is a
route to be sent. The Update message is mainly used to advertise the
routing information, including failed (withdrawn) route. When the
Update message is used to distribute out the route, the attribute of this
route needs to be specified so as to help the peer BGP protocol select
the best route. For the application of route attribute for BGP to select
the route, please refer to the application part of he BGP protocol route
attribute.
When the local BGP route changes, the Update message can also be
used to correct the routing table of the peer BGP.
If, after exchanging the routing information for a period of time both the
local BGP and the peer BGP have no new route advertisement, the
condition becomes stable. Now the KEEPALIVE message shall be
sent regularly so as to make the BGP connection remain valid. For the
local BGP, if it receives no BGP message after the hold time is over,
this BGP connection will be regarded as invalid and disconnection of
this BGP will take place.
If, during the running, the local BGP detects an error, for example, the
local BGP does not support the version of the BGP peer or receives
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
20
Page20 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Contents
1. Principle of BGP
2. BGP Route Attributes
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
21
Page21 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
BGP Path Attributes
A Path Attribute is a characteristic of an advertised BGP
route.
Each Path Attribute falls into one of four categories:
Well-known mandatory
Well-known discretionary
Optional transitive
Optional non-transitive
Notes:
Well-known means it must be recognized by all BGP implementations.
Optional means BGP implementation is not required to support the
attribute.
Mandatory means the attribute must be included in all BGP Update
messages
Discretionary means they may or may not be sent in a specific Update
messages
Transitive means a BGP process should accept the path in which the
attribute is included even if it doesnt support this attribute and it
should pass the path on to its peers
Non-transitive means a BGP process that does not recognize the
attribute can quietly ignore the Update in which the attribute is included
and not advertise the path to its other peers
The enterprises and service providers are often concerned about such
questions: how to prevent my private network from being advertised
out? How to filter the route update that comes from some neighboring
route? how to make certain that I am using this link instead of any
other link?. It is through the use of route attribute that BGP answers
these questions.
BGP route attribute is a set of parameters. It further describes the
specific route so as to enable BGP to filter and select routes. When
configuring the route strategy, we often use the route attribute.
However, not all of them will be involved.
In fact, route attributes are classified into the following categories:
Mandatory attribute: one that is necessary in the route update data
message. In the BGP routing information, this kind of attribute domain
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
22
Page22 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Path Attribute
Well-known mandatory
ORIGIN
AS-Path
Next hop
Well-known discretionary
Local-Preference
Atomic-Aggregate
Optional transitive
Aggregator
Community
Optional nontransitive
Multi-Exit-Disc (MED)
ORIGINATOR-ID
Cluster-List
Destination Pref (MCI)
Advertiser (Baynet)
Rcid-Path (Baynet)
MP_Reach_NLRI
MP_Unreach_NLRI
Extended_Communities
There are six attributes that are commonly used:
Origin: it is used to define the origin of the routing information,
indicating how a route becomes the BGP route, such as IGP, EGP,
and Incomplete.
As-Path: it is the sequence of the ASs passed by a route, listing all
the ASs passed by a route before it reaches the notified network. The
BGP speaker puts its own AS preamble to the head of the received AS
path, which can avoid route loop and be used for route filtering and
selection.
Next hop: it includes the IP address of the next hop border router that
reaches the network listed in the update information. The next hop of
the BGP is somewhat different from that of IGP. It can be an address
of the peer that notifies this route, such as EBGP, which is similar to
the IGP. But in some other cases, the BGP uses the next hop of the
third party. For example, the IBGP transmits without any change the
next hop obtained from the EBGP peer in the AS. In the multiple
access media, the BGP takes the actual origin of the route as the next
hop, even though it is not the BGP peer.
Multi-Exit-Discriminators (MED): when some AS has multiple entries,
the MED attribute can be used to help its external neighboring router
select a better entry path. The smaller the MED value of a route, the
higher its precedence.
Local-Preference: this attribute is used to select in the AS the route
reaching some destination by preference. It reflects the preference
level of the BGP speaker for each external route. The bigger the local-
preference value, the higher the preference level of the route.
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
23
Page23 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
ORIGIN Attribute
ORIGIN specifies the origin of the routing update. When BGP has
multiple routes, it uses ORIGIN as one factor in determining the preferred
route.
IGP NLRI (Network layer Reachability Information) was learned from a
protocol internal to the originating AS. BGP routes are given an origin of IGP if
they are learned from an IGP routing table via the network statement.
EGP NLRI was learned from the Exterior Gateway Protocol.
Incomplete NLRI was learned by some other means. Incomplete imply that the
information for determining the origin of the route is incomplete. Routes that
BGP learns through redistribution carry the incomplete origin attribute.
Which one is preferred? IGP > EGP > Incomplete
When the BGP makes the route decision, it will take the origin attribute
into account to determine the precedence levels between multiple
routes. Specifically, the BGP will prefer the route with the minimum
origin attribute value, i.e. the IGP has the precedence over EGP, and
EGP has the precedence over INCOMPLETE. We can configure these
three origin attributes manually.
Generally:
If a route is redistributed into the BGP routing table with the specifically,
the origin attribute shall be IGP
If a route is obtained via EGP, the origin attribute shall be EGP
Otherwise, the Origin attribute should be Incomplete
Quiz
(1)When import a route from ospf routing protocol into the BGP routing
table ,which origin attribute value would this route to be ?
A: IGP
B: EGP
C: OSPF
D: Incomplete
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
24
Page24 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
AS_PATH Attribute
AS-PATH uses a sequence of AS numbers to describe the inter-AS path or route to the
destination specified by the NLRI.
AS-PATH describes all AS it has passed through ,beginning with the most recent AS
and ending with the originating AS.
D(18.0.0.0/8)
AS200
AS300
AS400
AS100
AS500
RTA
RTB
30.0.0.1
30.0.0.2
D (400 300 200)
D (500 200)
The AS-Path attribute is also a mandatory one. It is the sequence of numbers of all
the ASs passed by a route to a certain destination. The BGP uses the AS-path
attribute as a part of the route update (message update) to ensure a loopless
topology structure over the Internet. The BGP will not accept the route of this AS
number contained in the AS-path attribute, because this route has been processed
by this AS. In this way, route loop is avoided. For this reason, the BGP will add its
own AS number to the AS-path attribute when advertising a route to the EBGP peer,
so as to record the information on the AS area passed by the route.
Meanwhile, the AS-path attribute acts on route selection. In case other factors are
the same, the route with shorter AS path will be selected. As shown in the figure
above, the path for the network segment D18.0.0.0/8 in AS200 to reach AS100 by
passing AS200, AS300, and AS400 is d1 (400 300 200) and that for it to reach
AS100 by passing AS200 and AS500 is d2 (500 200). In this case, the BGP will
select the shorter path d2 by precedence.
Note: when the AS-Path field of a route records the AS-number, it will always put
the new AS-number in front. As shown in the figure above, the route first passes
AS200 and records d2 (200); then it passes AS500 and records: d2 (500 200).
We can increase the path length by adding the pseudo AS number, so as to act on
route selection, We can configure RTA to add two AS element 200, 200 to the AS-
Path list carried by the route it sent to 30.0.0.2. After such a configuration, the path
d2 will change into 500 200 200 200, which is longer than the path d1. So now the
BGP will select the shorter path d1 by precedence.
Quiz
(1) When a route is passing AS100 from other AS, where the AS 100 value would
be put in the as-path field ?
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
25
Page25 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
AS_PATH Attribute
The Function of AS-PATH
AS can influence its incoming traffic by changing the AS_PATH of its
advertising route
AS_PATH can be used for loop avoidance
D(18.0.0.0/8)
AS200
AS300
AS400
AS100
AS500
RTA
RTB
30.0.0.1
30.0.0.2
D (400 300 200)
D (500 200,200,200)
D (200 200 200)
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
26
Page26 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Next Hop Attribute
18.0.0.0/8
20.0.0.0/8
RTA
RTC
RTB
RTD
19.0.0.0/8
21.0.0.2
21.0.0.1
10.0.0.2
10.0.0.3
10.0.0.1
AS100
AS200
IBGP
IBGP
EBGP
RTB
I can reach 18.0.0.0/8 via the next hop 10.0.0.2
I can reach 20.0.0.0/8 via the next hop 10.0.0.3
RTA
I can reach 18.0.0.0/8 via the next hop10.0.0.2
I can reach 20.0.0.0/8 via the next hop 10.0.0.3
I can reach 19.0.0.0/8 via the next hop 21.0.0.1
RTC
I can reach 19.0.0.0/8 via the next hop 10.0.0.1
I can reach 20.0.0.0/8 via the next hop 10.0.0.3
The next hop attribute is also an accepted mandatory attribute. The
next hop in the BGP is different from that in the IGP. The concept of
the next hop in the BGP is a little complicated. It can be one of the
following three types:
When the BGP notifies the IBGP of the route obtained from other
EBGPs, it does not change the next hop attribute of the route. The
local BGP directly transmits the next hop attribute obtained from the
EBGP to the IBGP. As shown in the figure above, the next hop
attribute is 10.0.0.2 when the RTA notifies the route 18.0.0.0 to RTB
via the IBGP.
When the BGP notifies the EBGP peer of the route, the next hop
attribute is the port address of the connection between the BGP and
its peer. As shown in the figure above, the next hop attribute is
10.0.0.2 when the RTC notifies the RTA of the route 18.0.0.0/8. And
when it notifies the RTC of the route 19.0.0.0/8, the next hop
attribute is 10.0.0.1.
For the multi-access network (e.g. Ethernet or frame relay), something
is different with the next hop. As shown in the figure above, when
RTC is advertising the route 20.0.0.0/8 to the EBGP router RTA, it
finds that the local port 10.0.0.2 and the next hop 10.0.0.3 of this
route are the same shared subnet. So, it uses 10.0.0.3 as the next
hop to advertise the route to the EBGP, instead of 10.0.0.2.
Quiz
(1)select the following statement which are true
A: When the BGP notifies the IBGP of the route obtained from other
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
27
Page27 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
LOCAL_PREF Attribute
LOCAL_PREF is used to communicate a BGP routers
degree of preference for an advertised route.
LOCAL_PREF is only in updates between internal BGP
peers and it is not passed to other AS.
If an internal BGP speaker receives multiple routes to the
same destination, it compares the LOCAL_PREF attribute
of the routes. The route with highest LOCAL_PREF is
selected.
The LOCAL_PREF attribute affects only traffic leaving the
AS.
The local precedence attribute is an optional attribute. It represents the
precedence level assigned to a route, with which we can compare
different routes that have the same destination. The bigger the
attribute value, the higher the precedence level of the route. This
attribute is used only inside the AS and exchanged between IBGP
peers, but not notified to the EBGP peer. In short, the local
precedence attribute is used to help the router inside the AS select
the optimal egress for it to go out, i.e. select the egress with higher
local precedence level.
What shall be noted is: configuring the attribute value of local
precedence level will only affect the traffic that leaves this AS, but
not the traffic that enters this AS. By default, the value of local
precedence attribute is 100.
Quiz
(1)A BGP speaker received the same route from its two IBGP peer
with different preference ,which route the BGP speaker will use by
default ?
A: the route with the bigger preference value
B: the route with the smaller preference value
C: the route with the bigger router-id
D: the route with the smaller router-id
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
28
Page28 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
LOCAL_PREF Attribute
Dlocal-pref1 100
Dlocal-pref2 200 RTA will select local-pref2 that has higher local preference
AS400
AS100
AS300
AS200
RTA
RTB RTC
RTD
RTE
RTF
D (18.0.0.0/8)
30.0.0.1
30.0.0.2
20.0.0.1
20.0.0.2
Dlocal-pref1 100 Dlocal-pref2 200
As shown in the figure above, the RTB sets the local precedence level
of the route received via the RTD as local-pref1 100, and the RTC sets
the local precedence level of the route received via the RTE as local-
pref2 200. In this way, the RTA will prefer local-pref2 which has a
higher precedence level.
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
29
Page29 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
MULTI-EXIT-DISC (MED) Attribute
MED is carried in EBGP updates and allows an AS to inform another AS
of its preferred ingress points. It is meant only for a single AS to
demonstrate a degree of preference when it has multiple ingress points.
MED attribute affects only the incoming traffic to the AS.
If all else is equal , an AS receiving multiple routes to the same
destination compare the MED of the routes. The lowest MED value is
preferred. MEDs are not compared if two routes to the same destination
are received from two different AS.
The MED is passed between internal peers of the receiving AS but not
passed beyond the receiving AS. MED is used only to influence traffic
between two directly connected AS.
The MED attribute is optional, used to indicate the preferable path for
the external neighbor router to enter some AS that has multiple entries.
When an AS has multiple entries, the MED attribute can be used to
help its external neighbor router select a better entry path. That is,
select the entry path with smaller MED value by precedence.
A BGP speaker received the same route from its two EBGP peer with different MED
value ,which route the BGP speaker will use by default ?
A: the route with the bigger MED value
B: the route with the smaller MED value
C: use tow for backup
D: the route with the smaller router-id
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
30
Page30 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
MULTI-EXIT-DISC (MED) Attribute
D(18.0.0.0/8)
RTA
RTB RTC
30.0.0.1
30.0.0.2
20.0.0.1
20.0.0.2
AS100
AS200
D,metric1 10
D,metric2 20
D,metric1 10 D,metric2 20
RTA will select the lower metric
IBGP
As shown in the figure above, we can set the metric value of the
network D notified by the RTB as metric 1 10 and that of the network D
notified by the RTC as metric 2 20. In this way, the RTA will select the
metric 1 that has smaller metric value by precedence.
Generally, the router only compares the MED values of respective
EBGP neighbor paths from the same AS, but not those from different
ASs. If comparison is required, the Quidway series routers offer the
one user interface command to change this default behavior.
Note: By default, it is not allowed to compare the MED attribute values
of paths from different AS neighbors, unless it can be confirmed that
different ASs adopt the same IGP and route selection method.
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
31
Page31 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Community Attribute
Community is designed to simplify policy enforcement. It
identifies a destination as a member of some community of
destinations that share one or more common properties.
The COMMUNITY attribute is a set of four octets values
AA:NN. AA is AS number. NN is an administratively defined
identifier.
In the range of the BGP, a community is a group of destinations that
have the same nature. It is not limited to a network or an AS and has
no physical boundary.
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
32
Page32 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Well-known Community
NO_EXPORT
Routes received carrying this value cannot be advertised to EBGP peers and outside
of the confederation
NO_ADVERTISE
Routes received carrying this value cannot be advertised at all to either EBGP or
IBGP peers.
LOCAL_AS
Routes received carrying this value cannot be advertised to EBGP peers including
peers in other AS within a confederation.
INTERNET
All routes belong to this community by default. Received routes belonging to this
community are advertised freely
The community attribute is an optional transitional attribute. Some communities are
accepted, i.e. they have the global meaning. These communities are:
NO_EXPORT: after a route with such a community attribute value is received, it
shall not be notified to the peers outside an confederation.
NO_ADVERTISE: after a route with such a community attribute value is received, it
shall not be notified to any BGP peers.
LOCAL-AS: after a route with such a community attribute value is received, it shall
be notified to the peers inside the local AS, but not to any EBGP peers (including
the EBGP peers inside the confederation).
INTERNET: After a route with such a community attribute value is received, it shall
be notified to all other routers.
Besides these accepted community attribute values, the private community
attribute values can also be used for special objectives. These attribute values are
marked with some numbers.
One route can have multiple community attribute values, which is similar to the case
where a route can have multiple AS numbers in its AS path attribute. The BGP
router, in which there are multiple community attribute values within one route, can take action
according to one or more or all of these attribute values. The router can add or
modify the community attribute values before it transmits the route to other peers.
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
33
Page33 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
BGP Route Selection Procedure
In general, the procedure of local BGP route selection is:
1. If the next hop of this route is unreachable, this route is not selected.
2. Select the route with a higher local preference.
3. Select the originated route by the local router (same local
precedence).
4. Select the route with shortest AS path.
5. Select the route with lowest origin code (IGP lower than EGP, EGP
lower than Incomplete ).
6. Select the route with smallest MED .
7.Performing load sharing on multiple routes according to the
configured number of routes (in case load sharing is configured and
there are multiple external routes to the same AS)
8. Select the route with smallest Router ID .
Generally, the procedure of local BGP route selection is:
(1)If the next hop of this route is unreachable, then drop this route.
(2)Select the route with a higher local precedence level.
(3)Select the originated route by the local router (the same local precedence level).
(4)Select the route whose AS path is shortest.
(5)Select the route whose origin type is IGP, EGP, and Incomplete in turn.
(6)Select the route whose MED is smallest.
(7)performing load sharing on multiple routes according to the configured number of
routes (in case load sharing is configured and there are multiple external routes to
the same AS)
(8)Select the route whose Router ID is smallest.
Select the best answer for the BGP route selection ( )
(1)Select the route with a higher local precedence level.
(2)Select the route whose AS path is shortest.
(3)Select the route whose MED is smallest
(4)If the next hop of this route is unreachable, then drop this route.
A: 4-1-2-3
B: 4-1-3-2
C: 1-2-3-4
D: 1-3-2-4
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
34
Page34 Copyright 2008 Huawei Technologies Co., Ltd. All rights reserved.
Summary
Feature of BGP
Difference with the IGP and EGP
Principle of BGP
The route attributes of BGP
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com
35
Thank you
www.huawei.com
PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com