14_hec oda030010 bgp routing protocol issue1.05

Upload: yann-ferrante

Post on 03-Jun-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    1/36

    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

    http://www.docudesk.com/http://www.docudesk.com/
  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    2/36

    Page1Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    3/36

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    4/36

    Page3Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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. Itsbasic function is to automatically exchange the loopless routinginformation between Autonomous Systems (AS). By exchanging thepath-reachable information with AS sequence attribute, it canconstruct the topology map of the autonomous area, thus removing

    the route loop and implementing the routing strategy configured bythe user. Compared with protocols like OSPF and RIP, which runinside the autonomous area, BGP is a kind of Exterior GatewayProtocol (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 areRFC1105 (BGP-1), RFC1163 (BGP-2) and RFC1267 (BGP-3)respectively. The current version is RFC1771 (BGP- 4). With thefast development of the Internet, the volume of the routing tableexpands quickly as well, and the amount of routing informationexchanged between ASs is also ever increasing, which affects thenetwork performance. BGP supports Classless Inter-DomainRouting (CIDR), which can effectively reduce the ever-expandingrouting table. BGP-4 is fast turning into the actual standard of theInternet border routing protocol. Its features are described asfollows:

    BGP is a kind of exterior routing protocol, different from interiorrouting protocol like OSPF and RIP. It focuses on the control ofroute advertising and the selection of optimal routes, instead ofroute discovery and calculation.

    By taking the AS path information, it can thoroughly solve theroblem of route c cle.PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    5/36

    Page4Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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 aremanaged by the same technical management organization and adopt

    the unified routing strategy. Each AS has a unique AS number, whichis allocated by the management organization authorized by theInternet.

    IGP routing protocol such as static route, OSPF , IS-IS etc

    BGP only

    The Autonomous System (AS) refers to a set of routers, which aremanaged by the same technical management organization and adoptthe unified routing strategy. Each AS has a unique AS number, whichis allocated by the management organization authorized by theInternet.

    The basic concept of introducing the AS is to differentiate different ASsby different numbers. Thus, when the network administrator does notwant his own communication data to pass some AS, this numberingmethod becomes very useful. Maybe the administrator's network canaccess this AS absolutely. However, if this AS is managed by hiscomponent or lacks enough security mechanism, he needs to avoidthis AS. By adopting the routing protocol and AS number, the routerscan specify the path between them and the method for routinginformation exchange.

    The AS numbers range from 1 to 65535. Among them, the numbers

    from 1 to 64511 are the registered Internet number, and those from64512 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

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    6/36

    Page5Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts reserved.

    Working Mechanism Of BGP

    AS1

    AS7

    AS6

    AS5

    AS4

    AS3

    AS2

    As the application layer protocol, the BGP system runs on a specialrouter. During the first startup of the system, the routing information isexchanged by sending the whole BGP routing table. Later, for theobjectives of updating the routing table, only the update message isexchanged. 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, andadvertises it to other BGP speakers. When a BGP speaker receivesnew route advertisement from other ASs, it will advertise this route toall the other BGP speakers inside the AS if this route is better than thecurrently known route, or currently there is no acceptable route. ABGP speaker calls other BGP speakers that exchange message with itas 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 theboundary of the AS. Then, The Autonomous System Boundary Router(ASBR) spreads it to other ASs via the EBGP connection. During thespreading, the route may pass several ASs, which are called thetransitional 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 boundaryrouters, such as AS2, AS3 and AS4. After the route reaches the ASboundary, ASBR can redistribute the route into the interior routingprotocol if the interior router needs to know these exterior routes. The

    exterior routes have a large amount, which will usually exceed thePDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    7/36

    Page6Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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 areInternal 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 BGPconnection between different border routers of an AS. Only in this way, canrouting information be transmitted in the entire network, such as RTB andRTD. To establish the communication between AS100 and AS300, we needto establish IBGP connection between them.

    The direct connection is not necessarily established between IBGP peersphysically, but the full logical connection between them must be ensured (itsuffices 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 thecommand "neighbor neighbor-address ebgp-multihop[ttl]". Here, "ttl" is themaximum 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.

    PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    8/36

    Page7Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts reserved.

    Route Advertising Principles ofBGP 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 bestone for its own use.

    The BGP Speaker only advertises the routes used by itself to itsneighbors.

    For the routes obtained from EBGP, the BGP Speaker will advertisethem to all its neighbors (including EBGP and IBGP).

    For the routes obtained from IBGP, the BGP Speaker will notadvertise them to its IBGP neighbors.

    For the routes obtained from IBGP, whether the BGP Speaker willadvertise them to its EBGP neighbors depends on the synchronizationstate of IGP and BGP.

    Once the connection is established, the BGP Speaker will advertiseall its BGP routes to the new neighbors.

    These principles were stipulated by the BGP designers when theywere developing the BGP routing protocol. Further study of thereasons 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/IBGPrelationshiPDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    9/36

    Page8Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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 advertisethe routing information learnt from the internal BGP peers to theexternal peers, unless this information can also be obtained from IGP.If a router can learn about this routing information via IGP, then it canbe 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 reachabilityinformation of this AS to other ASs. As shown in the figure above, RTBwill encapsulate the routing information toward 10.1.1.1/24 into theUPDATE message, and advertise it to RTE via the TCP connectionestablished by RTC and RTD. If RTE does not take synchronizationinto account, it will directly accept such routing information and reportit to RTF, then if RTF or RTE has the data packet to be sent to10.1.1.1/24, this packet must pass RTD and RTC if it wants to reachthe destination. As the synchronization was not taken into account inadvance, the routing tables of RTD and RTC have no routinginformation to 10.1.1.1/24 and the data packet will be discarded whenit reaches RTD. So, BGP must be synchronous with IGP (e.g., RIP,OSPF, etc.). Synchronization means that BGP will not advertise thetransitional information to other ASs until IGP broadcasts this routinginformation successfully in its AS . That is, after a router receives theupdate information of a destination from the IBGP peer, it shall attemptto verify whether this destination can be reached via the internal ASbefore advertising it to other EBGP peers (i.e., verify whether thisdestination is within IGP, and whether the non-BGP router cantransmit this traffic to this destination). If IGP knows this destination, it

    will receive such routing information and then advertise it to EBGPPDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    10/36

    Page9Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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 totransmit routing information between ASs, instead of discovering andcalculating routing information. The work of discovering and calculatingrouting information is done by the IGP routing protocol, e.g. RIP andOSPF. 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 threetypes: purely dynamic redistribution, semi-dynamic redistribution andstatic redistribution.

    Purely dynamic redistribution means that the router gets the routinginformation by IGP routing protocol and then dynamically redistributesit into BGP.

    As shown in the figure above, RTB dynamically detects the routesgoing to the network 18.0.0.0/8 via OSPF protocol and thendynamically 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 intoBGP.

    PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    11/36

    Page10Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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 isdynamically discovered and calculated by IGP routing protocol. Part ofthe specified routing information will be selectively redistributed withthe 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 thenredistributes it into BGP statically. Such a kind of route redistributionmode is called semi-dynamic redistribution.

    The route to be redistributed should be specified with the userinterface of the router. As a result, only one specified OSPF route isredistributed into the BGP routing table.

    PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    12/36

    Page11Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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 therouter is the static routing information manually configured, which willbe statically redistributed into the BGP system.

    As shown in the figure above, router B first establishes a static routegoing 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 routingtable.

    How many methods can you use to installed the route to the bgprouting 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

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    13/36

    Page12Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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, NOTIFICATIONand KEEPALIVE.

    Between BGP peers, an OPEN message is transmitted so as toexchange information such as version, AS number, hold time and BGPidentifier for negotiation.

    What UPDATE message carries is route update information, includingroute withdrawal information, reachable information and its pathattributes.

    When BGP detects errors (e.g. connection interruption, negotiationerror , message error), it will send the NOTIFICATION message toshut off the connection with its peers.

    The KEEPALIVE messages are sent periodically between BGPneighbors , so as to ensure the connection is kept alive . The defaulttimer is 60 seconds.

    The OPEN message is mainly used to establish the neighborhood(BGP peers). It is the initial handshake information between BGProuters and shall occur before all notification information. Others willrespond with the KEEPALIVE message after receiving the OPENmessage. Once the handshake succeeds, these BGP neighbors canexchange messages like UPDATE, KEEPALIVE and NOTIFICATION.

    Quiz

    (1) How many BGP messages available for the BGP version 4(chooseall apply)

    A: OPENPDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    14/36

    Page13Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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 widthof each line is 4 bytes.

    Marker authentication information: 16 bytes; all 1s. It is mainly usedto check whether the synchronization between BGP peers is lostand 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 BGPmessage is 19 bytes (Keepalive message) and the maximum lengthof BGP message is 4096 bytes.

    Type: 1 byte, indicating the message type, such as OPEN orUPDATE.

    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:KEEPALIVEPDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    15/36

    Page14Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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 theoriginating end.

    BGP Identifier: (4-byte) identifier of the router at the originating end.Optional parameters Len: (1-byte) the total length of optionalparameters field.

    Optional Parameters: (variable length) optional parameters.

    The beginning of the message includes the version number of BGPand the AS number of the sending party. And what follows is the fieldof hold time, which is the set seconds of hold timer recommended bythe sending party. The hold timer prescribes the time length withinwhich BGP neighbors consider the information from the sending partyvalid. The next field is BGP identifier (BGP), i.e. the identifier of the

    sending party of BGP. This value is determined during the handshakeoperation between BGP peers. It remains the same between eachlocal interface and each BGP peer.

    PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    16/36

    Page15Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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 oflinks and running states between peer routers. It consists of a BGPdata header only. The requirement for the exchange periodically ofKeepalive message between peer routers is to ensure the peer cankeep the timer within the time limit of expiry.

    After a router establishes BGP connection with its neighbors, it willperiodically send the Keepalive message to the peers according to thetime interval set by Keepalive-interval, indicating whether thisconnection 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

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    17/36

    Page16Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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 ofunreachable 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 indetail).

    Network Layer Reachability Information: (variable length) informationon Reachability of the network (destination).

    Among them, the expression of the withdrawn route and destinationaddress is . "length" indicates the length of the addressprefix, occupying 1 byte. "prefix" is the address prefix, occupying 1-4bytes.

    The UPDATE message is the most important information in the BGPsystem, used to exchange routing information between peers. It

    comprises three parts at most, i.e. unreachable, path attributes, andNetwork Layer Reachability Information (NLRI).

    The UPDATE message can advertise a route to BGP peers, and alsocan withdraw multiple unreachable routes. The unreachable fieldincludes a list of IP address prefixes of withdrawn routes. The pathattributes field is a list of path attributes, including attribute type,attribute length and attribute value. The NLRI field includes a list ofreachable IP address prefixes known by the BGP router.

    One UPDATE message can advertise one route only at one time, butit 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

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    18/36

    Page17Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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

    ExitError Type

    6Error

    Code

    A notification message is used when error occurs or the peerconnection is stopped. This message carries various error codes (e.g.timer expiry), including error code, auxiliary error code and errorinformation.

    Error code: (1 byte) error code:

    Error subcode: (1 byte) auxiliary error code.

    Data: (variable length) depending on various error codes and auxiliaryerror codes; used to diagnose error causes.

    PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    19/36

    Page18Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts reserved.

    Finite State Machine of BGP

    Active

    Open-sent

    Open-confirm Established

    Idle

    Connect

    Connect-Retrytimer expiry

    TCP connection fails

    Connect-Retry

    timer expiry

    Start

    Others

    TCP connection fails

    Error

    Error Error

    KeepAlivetimer expiry

    KeepAlive packetreceived

    1. KeepAlivetimer expiry

    2. Update received3. KeepAlive received

    Correct OPENpacket received

    TCP connection setup

    TCP connection setupOthers

    The BGP finite state machine (FSM) has six states. The procedure oftransition 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 BGPstate machine will stay in the "Connect" state. Meanwhile, BGP will

    attempt to establish the TCP connection. If the creation of TCPconnection fails, the BGP state machine will enter the "Active" state. Ifthe TCP connection is established successfully, the BGP statemachine will enter the "OpenSent" state directly. In "Active" state, ifthe TCP connection cannot be established yet, the BGP state machinewill stay in the "Active" state and will not enter the "OpenSent" stateuntil the TCP connection is established successfully. In the"OpenSent" state, once BGP receives a correct Open message, it willenter the "OpenConfirm" state. In the "OpenConfirm" state, if theKeepAlive 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 isreally established.

    In addition, when any of the five states ("Idle" excluded) has errors, theBGP state machine will return to the "Idle" state.

    Idle: "Idle" is the first state of BGP connection. In this state, BGP iswaiting for a start event. After such an event emerges, BGP willinitialize the resources, reset the Connect-Retry timer, and initiate aTCP connection. Meanwhile, it will enter the "Connect" state.

    Connect: in this state, BGP establishes the first TCP connection. Ifthe Connect-Retry timer expires, BGP will establish the TCPconnection a ain and continue to sta in the "Connect" state. If thePDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    20/36

    Page19Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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 is179. The establishment of BGP connection needs a series of dialogsand handshakes, which is the same as that of TCP connection. TCPuses the handshake negotiation to advertise parameters like port. Thehandshake 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 besent to advertise the routing information to the peer end if there is aroute to be sent. The Update message is mainly used to advertise therouting information, including failed (withdrawn) route. When theUpdate message is used to distribute out the route, the attribute of thisroute needs to be specified so as to help the peer BGP protocol selectthe best route. For the application of route attribute for BGP to selectthe route, please refer to the application part of he BGP protocol routeattribute.

    When the local BGP route changes, the Update message can also beused to correct the routing table of the peer BGP.

    If, after exchanging the routing information for a period of time both thelocal BGP and the peer BGP have no new route advertisement, thecondition becomes stable. Now the KEEPALIVE message shall besent regularly so as to make the BGP connection remain valid. For thelocal BGP, if it receives no BGP message after the hold time is over,this BGP connection will be regarded as invalid and disconnection ofthis BGP will take place.

    If, during the running, the local BGP detects an error, for example, thePDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    21/362

    Page20Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts reserved.

    Contents

    1. Principle of BGP

    2. BGP Route Attributes

    PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    22/362

    Page21Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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 theattribute.

    Mandatory means the attribute must be included in all BGP Update

    messagesDiscretionary means they may or may not be sent in a specific Updatemessages

    Transitive means a BGP process should accept the path in which theattribute is included even if it doesnt support this attribute and itshould pass the path on to its peers

    Non-transitive means a BGP process that does not recognize theattribute can quietly ignore the Update in which the attribute is includedand not advertise the path to its other peers

    The enterprises and service providers are often concerned about suchquestions: how to prevent my private network from being advertisedout? How to filter the route update that comes from some neighboringroute? how to make certain that I am using this link instead of anyother link?. It is through the use of route attribute that BGP answersthese questions.

    BGP route attribute is a set of parameters. It further describes thespecific route so as to enable BGP to filter and select routes. Whenconfiguring 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 dataPDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    23/362

    Page22Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts reserved.

    Path AttributeWell-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. TheBGP speaker puts its own AS preamble to the head of the received ASpath, which can avoid route loop and be used for route filtering andselection.

    Next hop: it includes the IP address of the next hop border router thatreaches the network listed in the update information. The next hop ofthe BGP is somewhat different from that of IGP. It can be an addressof the peer that notifies this route, such as EBGP, which is similar tothe IGP. But in some other cases, the BGP uses the next hop of thethird party. For example, the IBGP transmits without any change the

    next hop obtained from the EBGP peer in the AS. In the multipleaccess media, the BGP takes the actual origin of the route as the nexthop, 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 routerselect a better entry path. The smaller the MED value of a route, thehigher its precedence.

    Local-Preference: this attribute is used to select in the AS the routereaching some destination by preference. It reflects the preferencelevel 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

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    24/362

    Page23Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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 attributeinto account to determine the precedence levels between multipleroutes. Specifically, the BGP will prefer the route with the minimumorigin attribute value, i.e. the IGP has the precedence over EGP, andEGP 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 routingtable ,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

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    25/362

    Page24Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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)

    AS200AS300

    AS400

    AS100AS500

    RTA

    RTB

    30.0.0.1

    30.0.0.2D (400 300 200)

    D (500 200)

    The AS-Path attribute is also a mandatory one. It is the sequence of numbers of allthe ASs passed by a route to a certain destination. The BGP uses the AS-pathattribute as a part of the route update (message update) to ensure a looplesstopology structure over the Internet. The BGP will not accept the route of this ASnumber 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 itsown 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 arethe same, the route with shorter AS path will be selected. As shown in the figureabove, the path for the network segment D18.0.0.0/8 in AS200 to reach AS100 bypassing AS200, AS300, and AS400 is d1 (400 300 200) and that for it to reachAS100 by passing AS200 and AS500 is d2 (500 200). In this case, the BGP willselect 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 passesAS200 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 onroute 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 pathd2 will change into 500 200 200 200, which is longer than the path d1. So now theBGP will select the shorter path d1 by precedence.

    Quiz

    (1) When a route is passing AS100 from other AS, where the AS 100 value wouldPDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    26/362

    Page25Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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)

    AS200AS300

    AS400

    AS100AS500

    RTA

    RTB

    30.0.0.1

    30.0.0.2D (400 300 200)

    D (500 200,200,200)

    D (200 200 200)

    PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    27/362

    Page26Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts reserved.

    Next Hop Attribute

    18.0.0.0/8

    20.0.0.0/8

    RTA

    RTC

    RTB

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

    IBGPEBGP

    RTBI can reach 18.0.0.0/8 via the next hop 10.0.0.2I can reach 20.0.0.0/8 via the next hop 10.0.0.3

    RTAI can reach 18.0.0.0/8 via the next hop10.0.0.2I can reach 20.0.0.0/8 via the next hop 10.0.0.3I can reach 19.0.0.0/8 via the next hop 21.0.0.1

    RTCI can reach 19.0.0.0/8 via the next hop 10.0.0.1I 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. Thenext hop in the BGP is different from that in the IGP. The concept ofthe next hop in the BGP is a little complicated. It can be one of thefollowing 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. Thelocal BGP directly transmits the next hop attribute obtained from theEBGP to the IBGP. As shown in the figure above, the next hopattribute is 10.0.0.2 when the RTA notifies the route 18.0.0.0 to RTBvia the IBGP.

    When the BGP notifies the EBGP peer of the route, the next hopattribute is the port address of the connection between the BGP andits peer. As shown in the figure above, the next hop attribute is10.0.0.2 when the RTC notifies the RTA of the route 18.0.0.0/8. Andwhen 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, whenRTC is advertising the route 20.0.0.0/8 to the EBGP router RTA, itfinds that the local port 10.0.0.2 and the next hop 10.0.0.3 of thisroute are the same shared subnet. So, it uses 10.0.0.3 as the nexthop to advertise the route to the EBGP, instead of 10.0.0.2.

    Quiz

    (1)select the following statement which are true

    PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    28/362

    Page27Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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 theprecedence level assigned to a route, with which we can comparedifferent routes that have the same destination. The bigger theattribute value, the higher the precedence level of the route. Thisattribute is used only inside the AS and exchanged between IBGPpeers, but not notified to the EBGP peer. In short, the local

    precedence attribute is used to help the router inside the AS selectthe optimal egress for it to go out, i.e. select the egress with higherlocal precedence level.

    What shall be noted is: configuring the attribute value of localprecedence level will only affect the traffic that leaves this AS, butnot the traffic that enters this AS. By default, the value of localprecedence 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 bydefault ?

    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

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    29/362

    Page28Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts reserved.

    LOCAL_PREF Attribute

    D

    local-pref1 100 Dlocal-pref2 200 RTA will select local-pref2 that has higher local preference

    AS400

    AS100

    AS300AS200

    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 levelof the route received via the RTD as local-pref1 100, and the RTC setsthe 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 ahigher precedence level.

    PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    30/362

    Page29Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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 forthe external neighbor router to enter some AS that has multiple entries.When an AS has multiple entries, the MED attribute can be used tohelp 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 MEDvalue ,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

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    31/363

    Page30Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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 thenetwork D notified by the RTB as metric 1 10 and that of the network Dnotified by the RTC as metric 2 20. In this way, the RTA will select themetric 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 differentASs. If comparison is required, the Quidway series routers offer theone user interface command to change this default behavior.

    Note: By default, it is not allowed to compare the MED attribute valuesof paths from different AS neighbors, unless it can be confirmed thatdifferent ASs adopt the same IGP and route selection method.

    PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    32/363

    Page31Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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 thathave the same nature. It is not limited to a network or an AS and hasno physical boundary.

    PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    33/363

    Page32Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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 areaccepted, i.e. they have the global meaning. These communities are:

    NO_EXPORT: after a route with such a community attribute value is received, itshall 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 shallbe notified to the peers inside the local AS, but not to any EBGP peers (includingthe EBGP peers inside the confederation).

    INTERNET: After a route with such a community attribute value is received, it shallbe notified to all other routers.

    Besides these accepted community attribute values, the private communityattribute values can also be used for special objectives. These attribute values aremarked 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 BGProuter, in which there are multiple community attribute values within one route, can take actionaccording to one or more or all of these attribute values. The router can add ormodify the community attribute values before it transmits the route to other peers.

    PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    34/363

    Page33Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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 andthere 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 ofroutes (in case load sharing is configured and there are multiple external routes tothe 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

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    35/363

    Page34Copyright 2008 Huawei Technologies Co., Ltd. All ri ghts 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

  • 8/12/2019 14_hec Oda030010 Bgp Routing Protocol Issue1.05

    36/36

    Thank youwww.huawei.com