idnits 2.17.1 draft-ietf-idr-bgp4-17.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** Looks like you're using RFC 2026 boilerplate. This must be updated to follow RFC 3978/3979, as updated by RFC 4748. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- ** The document seems to lack a 1id_guidelines paragraph about 6 months document validity -- however, there's a paragraph with a matching beginning. Boilerplate error? ** The document is more than 15 pages and seems to lack a Table of Contents. == No 'Intended status' indicated for this document; assuming Proposed Standard == The page length should not exceed 58 lines per page, but there was 65 longer pages, the longest (page 2) being 61 lines Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack an Abstract section. ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) ** The document seems to lack separate sections for Informative/Normative References. All references will be assumed normative when checking for downward references. ** There are 2 instances of too long lines in the document, the longest one being 5 characters in excess of 72. == There are 4 instances of lines with non-RFC6890-compliant IPv4 addresses in the document. If these are example addresses, they should be changed. ** The document seems to lack a both a reference to RFC 2119 and the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. RFC 2119 keyword, line 409: '...sage, a BGP speaker MUST calculate the...' RFC 2119 keyword, line 412: '... Hold Time MUST be either zero o...' RFC 2119 keyword, line 802: '...er a BGP speaker MUST be able to proce...' RFC 2119 keyword, line 812: '... interval. KEEPALIVE messages MUST NOT...' RFC 2119 keyword, line 813: '... one per second. An implementation MAY...' (30 more instances...) Miscellaneous warnings: ---------------------------------------------------------------------------- == Line 2900 has weird spacing: '...hen all the d...' -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- Couldn't find a document date in the document -- date freshness check skipped. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) ** Downref: Normative reference to an Historic RFC: RFC 904 (ref. '1') ** Downref: Normative reference to an Unknown state RFC: RFC 1092 (ref. '2') ** Downref: Normative reference to an Unknown state RFC: RFC 1093 (ref. '3') ** Obsolete normative reference: RFC 793 (ref. '4') (Obsoleted by RFC 9293) -- Possible downref: Non-RFC (?) normative reference: ref. '7' ** Obsolete normative reference: RFC 1519 (ref. '8') (Obsoleted by RFC 4632) ** Downref: Normative reference to an Historic RFC: RFC 1518 (ref. '9') ** Obsolete normative reference: RFC 2385 (ref. '10') (Obsoleted by RFC 5925) ** Obsolete normative reference: RFC 2796 (ref. '11') (Obsoleted by RFC 4456) ** Obsolete normative reference: RFC 3065 (ref. '13') (Obsoleted by RFC 5065) Summary: 17 errors (**), 0 flaws (~~), 4 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group Y. Rekhter 3 INTERNET DRAFT Juniper Networks 4 T. Li 5 Procket Networks, Inc. 6 Editors 8 A Border Gateway Protocol 4 (BGP-4) 9 11 Status of this Memo 13 This document is an Internet-Draft and is in full conformance with 14 all provisions of Section 10 of RFC2026. 16 Internet-Drafts are working documents of the Internet Engineering 17 Task Force (IETF), its areas, and its working groups. Note that 18 other groups may also distribute working documents as Internet- 19 Drafts. 21 Internet-Drafts are draft documents valid for a maximum of six months 22 and may be updated, replaced, or obsoleted by other documents at any 23 time. It is inappropriate to use Internet-Drafts as reference 24 material or to cite them other than as ``work in progress.'' 26 The list of current Internet-Drafts can be accessed at 27 http://www.ietf.org/ietf/1id-abstracts.txt 29 The list of Internet-Draft Shadow Directories can be accessed at 30 http://www.ietf.org/shadow.html. 32 1. Acknowledgments 34 This document was originally published as RFC 1267 in October 1991, 35 jointly authored by Kirk Lougheed and Yakov Rekhter. 37 We would like to express our thanks to Guy Almes, Len Bosack, and 38 Jeffrey C. Honig for their contributions to the earlier version of 39 this document. 41 We like to explicitly thank Bob Braden for the review of the earlier 42 version of this document as well as his constructive and valuable 43 comments. 45 RFC DRAFT January 2002 47 We would also like to thank Bob Hinden, Director for Routing of the 48 Internet Engineering Steering Group, and the team of reviewers he 49 assembled to review the earlier version (BGP-2) of this document. 50 This team, consisting of Deborah Estrin, Milo Medin, John Moy, Radia 51 Perlman, Martha Steenstrup, Mike St. Johns, and Paul Tsuchiya, acted 52 with a strong combination of toughness, professionalism, and 53 courtesy. 55 This updated version of the document is the product of the IETF IDR 56 Working Group with Yakov Rekhter and Tony Li as editors. Certain 57 sections of the document borrowed heavily from IDRP [7], which is the 58 OSI counterpart of BGP. For this credit should be given to the ANSI 59 X3S3.3 group chaired by Lyman Chapin and to Charles Kunzinger who was 60 the IDRP editor within that group. We would also like to thank Enke 61 Chen, Edward Crabbe, Mike Craren, Vincent Gillet, Eric Gray, Jeffrey 62 Haas, Dimitry Haskin, John Krawczyk, David LeRoy, Dan Massey, Dan 63 Pei, Mathew Richardson, John Scudder, John Stewart III, Dave Thaler, 64 Paul Traina, Russ White, Curtis Villamizar, and Alex Zinin for their 65 comments. 67 Many thanks to Sue Hares for her contributions to the document, and 68 especially for her work on the BGP Finite State Machine. 70 We would like to specially acknowledge numerous contributions by 71 Dennis Ferguson. 73 2. Introduction 75 The Border Gateway Protocol (BGP) is an inter-Autonomous System 76 routing protocol. It is built on experience gained with EGP as 77 defined in RFC 904 [1] and EGP usage in the NSFNET Backbone as 78 described in RFC 1092 [2] and RFC 1093 [3]. 80 The primary function of a BGP speaking system is to exchange network 81 reachability information with other BGP systems. This network 82 reachability information includes information on the list of 83 Autonomous Systems (ASs) that reachability information traverses. 84 This information is sufficient to construct a graph of AS 85 connectivity from which routing loops may be pruned and some policy 86 decisions at the AS level may be enforced. 88 BGP-4 provides a new set of mechanisms for supporting Classless 89 Inter-Domain Routing (CIDR) [8, 9]. These mechanisms include support 90 for advertising an IP prefix and eliminates the concept of network 91 "class" within BGP. BGP-4 also introduces mechanisms which allow 92 aggregation of routes, including aggregation of AS paths. 94 RFC DRAFT January 2002 96 To characterize the set of policy decisions that can be enforced 97 using BGP, one must focus on the rule that a BGP speaker advertises 98 to its peers (other BGP speakers which it communicates with) in 99 neighboring ASs only those routes that it itself uses. This rule 100 reflects the "hop-by-hop" routing paradigm generally used throughout 101 the current Internet. Note that some policies cannot be supported by 102 the "hop-by-hop" routing paradigm and thus require techniques such as 103 source routing (aka explicit routing) to enforce. For example, BGP 104 does not enable one AS to send traffic to a neighboring AS intending 105 that the traffic take a different route from that taken by traffic 106 originating in the neighboring AS. On the other hand, BGP can support 107 any policy conforming to the "hop-by-hop" routing paradigm. Since the 108 current Internet uses only the "hop-by-hop" inter-AS routing paradigm 109 and since BGP can support any policy that conforms to that paradigm, 110 BGP is highly applicable as an inter-AS routing protocol for the 111 current Internet. 113 A more complete discussion of what policies can and cannot be 114 enforced with BGP is outside the scope of this document (but refer to 115 the companion document discussing BGP usage [5]). 117 BGP runs over a reliable transport protocol. This eliminates the need 118 to implement explicit update fragmentation, retransmission, 119 acknowledgment, and sequencing. Any authentication scheme used by the 120 transport protocol (e.g., RFC2385 [10]) may be used in addition to 121 BGP's own authentication mechanisms. The error notification mechanism 122 used in BGP assumes that the transport protocol supports a "graceful" 123 close, i.e., that all outstanding data will be delivered before the 124 connection is closed. 126 BGP uses TCP [4] as its transport protocol. TCP meets BGP's transport 127 requirements and is present in virtually all commercial routers and 128 hosts. In the following descriptions the phrase "transport protocol 129 connection" can be understood to refer to a TCP connection. BGP uses 130 TCP port 179 for establishing its connections. 132 This document uses the term `Autonomous System' (AS) throughout. The 133 classic definition of an Autonomous System is a set of routers under 134 a single technical administration, using an interior gateway protocol 135 and common metrics to determine how to route packets within the AS, 136 and using an exterior gateway protocol to determine how to route 137 packets to other ASs. Since this classic definition was developed, it 138 has become common for a single AS to use several interior gateway 139 protocols and sometimes several sets of metrics within an AS. The use 140 of the term Autonomous System here stresses the fact that, even when 141 multiple IGPs and metrics are used, the administration of an AS 142 appears to other ASs to have a single coherent interior routing plan 143 and presents a consistent picture of what destinations are reachable 144 RFC DRAFT January 2002 146 through it. 148 The planned use of BGP in the Internet environment, including such 149 issues as topology, the interaction between BGP and IGPs, and the 150 enforcement of routing policy rules is presented in a companion 151 document [5]. This document is the first of a series of documents 152 planned to explore various aspects of BGP application. 154 3. Summary of Operation 156 Two systems form a transport protocol connection between one another. 157 They exchange messages to open and confirm the connection parameters. 159 The initial data flow is the portion of the BGP routing table that is 160 allowed by the export policy, called the Adj-Ribs-Out (see 3.2). 161 Incremental updates are sent as the routing tables change. BGP does 162 not require periodic refresh of the routing table. Therefore, a BGP 163 speaker must retain the current version of the routes advertised by 164 all of its peers for the duration of the connection. If the 165 implementation decides to not store the routes that have been 166 received from a peer, but have been filtered out according to 167 configured local policy, the BGP Route Refresh extension [12] may be 168 used to request the full set of routes from a peer without resetting 169 the BGP session when the local policy configuration changes. 171 KEEPALIVE messages may be sent periodically to ensure the liveness of 172 the connection. NOTIFICATION messages are sent in response to errors 173 or special conditions. If a connection encounters an error condition, 174 a NOTIFICATION message is sent and the connection is closed. 176 The hosts executing the Border Gateway Protocol need not be routers. 177 A non-routing host could exchange routing information with routers 178 via EGP or even an interior routing protocol. That non-routing host 179 could then use BGP to exchange routing information with a border 180 router in another Autonomous System. The implications and 181 applications of this architecture are for further study. 183 Connections between BGP speakers of different ASs are referred to as 184 "external" links. BGP connections between BGP speakers within the 185 same AS are referred to as "internal" links. Similarly, a peer in a 186 different AS is referred to as an external peer, while a peer in the 187 same AS may be described as an internal peer. Internal BGP and 188 external BGP are commonly abbreviated IBGP and EBGP. 190 If a particular AS has multiple BGP speakers and is providing transit 191 service for other ASs, then care must be taken to ensure a consistent 192 view of routing within the AS. A consistent view of the interior 193 RFC DRAFT January 2002 195 routes of the AS is provided by the interior routing protocol. A 196 consistent view of the routes exterior to the AS can be provided by 197 having all BGP speakers within the AS maintain direct IBGP 198 connections with each other. Alternately the interior routing 199 protocol can pass BGP information among routers within an AS, taking 200 care not to lose BGP attributes that will be needed by EBGP speakers 201 if transit connectivity is being provided. For the purpose of 202 discussion, it is assumed that BGP information is passed within an AS 203 using IBGP. Care must be taken to ensure that the interior routers 204 have all been updated with transit information before the EBGP 205 speakers announce to other ASs that transit service is being 206 provided. 208 3.1 Routes: Advertisement and Storage 210 For the purpose of this protocol, a route is defined as a unit of 211 information that pairs a set of destinations with the attributes of a 212 path to those destinations. The set of destinations are the systems 213 whose IP addresses are reported in the Network Layer Reachability 214 Information (NLRI) field and the path is the information reported in 215 the path attributes field of the same UPDATE message. 217 Routes are advertised between BGP speakers in UPDATE messages. 219 Routes are stored in the Routing Information Bases (RIBs): namely, 220 the Adj-RIBs-In, the Loc-RIB, and the Adj-RIBs-Out. Routes that will 221 be advertised to other BGP speakers must be present in the Adj-RIB- 222 Out. Routes that will be used by the local BGP speaker must be 223 present in the Loc-RIB, and the next hop for each of these routes 224 must be resolvable via the local BGP speaker's Routing Table. Routes 225 that are received from other BGP speakers are present in the Adj- 226 RIBs-In. 228 If a BGP speaker chooses to advertise the route, it may add to or 229 modify the path attributes of the route before advertising it to a 230 peer. 232 BGP provides mechanisms by which a BGP speaker can inform its peer 233 that a previously advertised route is no longer available for use. 234 There are three methods by which a given BGP speaker can indicate 235 that a route has been withdrawn from service: 237 a) the IP prefix that expresses the destination for a previously 238 advertised route can be advertised in the WITHDRAWN ROUTES field 239 in the UPDATE message, thus marking the associated route as being 240 no longer available for use 241 RFC DRAFT January 2002 243 b) a replacement route with the same NLRI can be advertised, or 245 c) the BGP speaker - BGP speaker connection can be closed, which 246 implicitly removes from service all routes which the pair of 247 speakers had advertised to each other. 249 3.2 Routing Information Bases 251 The Routing Information Base (RIB) within a BGP speaker consists of 252 three distinct parts: 254 a) Adj-RIBs-In: The Adj-RIBs-In store routing information that has 255 been learned from inbound UPDATE messages. Their contents 256 represent routes that are available as an input to the Decision 257 Process. 259 b) Loc-RIB: The Loc-RIB contains the local routing information 260 that the BGP speaker has selected by applying its local policies 261 to the routing information contained in its Adj-RIBs-In. 263 c) Adj-RIBs-Out: The Adj-RIBs-Out store the information that the 264 local BGP speaker has selected for advertisement to its peers. The 265 routing information stored in the Adj-RIBs-Out will be carried in 266 the local BGP speaker's UPDATE messages and advertised to its 267 peers. 269 In summary, the Adj-RIBs-In contain unprocessed routing information 270 that has been advertised to the local BGP speaker by its peers; the 271 Loc-RIB contains the routes that have been selected by the local BGP 272 speaker's Decision Process; and the Adj-RIBs-Out organize the routes 273 for advertisement to specific peers by means of the local speaker's 274 UPDATE messages. 276 Although the conceptual model distinguishes between Adj-RIBs-In, Loc- 277 RIB, and Adj-RIBs-Out, this neither implies nor requires that an 278 implementation must maintain three separate copies of the routing 279 information. The choice of implementation (for example, 3 copies of 280 the information vs 1 copy with pointers) is not constrained by the 281 protocol. 283 Routing information that the router uses to forward packets (or to 284 construct the forwarding table that is used for packet forwarding) is 285 maintained in the Routing Table. The Routing Table accumulates routes 286 to directly connected networks, static routes, routes learned from 287 the IGP protocols, and routes learned from BGP. Whether or not a 288 specific BGP route should be installed in the Routing Table, and 289 whether a BGP route should override a route to the same destination 290 RFC DRAFT January 2002 292 installed by another source is a local policy decision, not specified 293 in this document. Besides actual packet forwarding, the Routing Table 294 is used for resolution of the next-hop addresses specified in BGP 295 updates (see Section 9.1.2). 297 4. Message Formats 299 This section describes message formats used by BGP. 301 Messages are sent over a reliable transport protocol connection. A 302 message is processed only after it is entirely received. The maximum 303 message size is 4096 octets. All implementations are required to 304 support this maximum message size. The smallest message that may be 305 sent consists of a BGP header without a data portion, or 19 octets. 307 4.1 Message Header Format 309 Each message has a fixed-size header. There may or may not be a data 310 portion following the header, depending on the message type. The 311 layout of these fields is shown below: 313 0 1 2 3 314 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 315 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 316 | | 317 + + 318 | | 319 + + 320 | Marker | 321 + + 322 | | 323 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 324 | Length | Type | 325 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 327 Marker: 329 This 16-octet field contains a value that the receiver of the 330 message can predict. If the Type of the message is OPEN, or if 331 the OPEN message carries no Authentication Information (as an 332 Optional Parameter), then the Marker must be all ones. 333 Otherwise, the value of the marker can be predicted by some a 334 computation specified as part of the authentication mechanism 335 (which is specified as part of the Authentication Information) 336 used. The Marker can be used to detect loss of synchronization 337 RFC DRAFT January 2002 339 between a pair of BGP peers, and to authenticate incoming BGP 340 messages. 342 Length: 344 This 2-octet unsigned integer indicates the total length of the 345 message, including the header, in octets. Thus, e.g., it allows 346 one to locate in the transport-level stream the (Marker field 347 of the) next message. The value of the Length field must always 348 be at least 19 and no greater than 4096, and may be further 349 constrained, depending on the message type. No "padding" of 350 extra data after the message is allowed, so the Length field 351 must have the smallest value required given the rest of the 352 message. 354 Type: 356 This 1-octet unsigned integer indicates the type code of the 357 message. The following type codes are defined: 359 1 - OPEN 360 2 - UPDATE 361 3 - NOTIFICATION 362 4 - KEEPALIVE 364 4.2 OPEN Message Format 366 After a transport protocol connection is established, the first 367 message sent by each side is an OPEN message. If the OPEN message is 368 acceptable, a KEEPALIVE message confirming the OPEN is sent back. 369 Once the OPEN is confirmed, UPDATE, KEEPALIVE, and NOTIFICATION 370 messages may be exchanged. 372 In addition to the fixed-size BGP header, the OPEN message contains 373 the following fields: 375 0 1 2 3 376 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 377 +-+-+-+-+-+-+-+-+ 378 | Version | 379 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 380 | My Autonomous System | 381 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 382 | Hold Time | 383 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 384 | BGP Identifier | 385 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 386 | Opt Parm Len | 387 RFC DRAFT January 2002 389 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 390 | | 391 | Optional Parameters (variable) | 392 | | 393 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 395 Version: 397 This 1-octet unsigned integer indicates the protocol version 398 number of the message. The current BGP version number is 4. 400 My Autonomous System: 402 This 2-octet unsigned integer indicates the Autonomous System 403 number of the sender. 405 Hold Time: 407 This 2-octet unsigned integer indicates the number of seconds 408 that the sender proposes for the value of the Hold Timer. Upon 409 receipt of an OPEN message, a BGP speaker MUST calculate the 410 value of the Hold Timer by using the smaller of its configured 411 Hold Time and the Hold Time received in the OPEN message. The 412 Hold Time MUST be either zero or at least three seconds. An 413 implementation may reject connections on the basis of the Hold 414 Time. The calculated value indicates the maximum number of 415 seconds that may elapse between the receipt of successive 416 KEEPALIVE, and/or UPDATE messages by the sender. 418 BGP Identifier: 420 This 4-octet unsigned integer indicates the BGP Identifier of 421 the sender. A given BGP speaker sets the value of its BGP 422 Identifier to an IP address assigned to that BGP speaker. The 423 value of the BGP Identifier is determined on startup and is the 424 same for every local interface and every BGP peer. 426 Optional Parameters Length: 428 This 1-octet unsigned integer indicates the total length of the 429 Optional Parameters field in octets. If the value of this field 430 is zero, no Optional Parameters are present. 432 Optional Parameters: 434 This field may contain a list of optional parameters, where 435 each parameter is encoded as a triplet. 440 0 1 441 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 442 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-... 443 | Parm. Type | Parm. Length | Parameter Value (variable) 444 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-... 446 Parameter Type is a one octet field that unambiguously 447 identifies individual parameters. Parameter Length is a one 448 octet field that contains the length of the Parameter Value 449 field in octets. Parameter Value is a variable length field 450 that is interpreted according to the value of the Parameter 451 Type field. 453 This document defines the following Optional Parameters: 455 a) Authentication Information (Parameter Type 1): 457 This optional parameter may be used to authenticate a BGP 458 peer. The Parameter Value field contains a 1-octet 459 Authentication Code followed by a variable length 460 Authentication Data. 462 0 1 2 3 4 5 6 7 8 463 +-+-+-+-+-+-+-+-+ 464 | Auth. Code | 465 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 466 | | 467 | Authentication Data | 468 | | 469 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 471 Authentication Code: 473 This 1-octet unsigned integer indicates the 474 authentication mechanism being used. Whenever an 475 authentication mechanism is specified for use within 476 BGP, three things must be included in the 477 specification: 479 - the value of the Authentication Code which indicates 480 use of the mechanism, 481 - the form and meaning of the Authentication Data, and 482 - the algorithm for computing values of Marker fields. 484 RFC DRAFT January 2002 486 Note that a separate authentication mechanism may be 487 used in establishing the transport level connection. 489 Authentication Data: 491 Authentication Data is a variable length field that is 492 interpreted according to the value of the 493 Authentication Code field. 495 The minimum length of the OPEN message is 29 octets (including 496 message header). 498 4.3 UPDATE Message Format 500 UPDATE messages are used to transfer routing information between BGP 501 peers. The information in the UPDATE packet can be used to construct 502 a graph describing the relationships of the various Autonomous 503 Systems. By applying rules to be discussed, routing information loops 504 and some other anomalies may be detected and removed from inter-AS 505 routing. 507 An UPDATE message is used to advertise feasible routes sharing common 508 path attribute to a peer, or to withdraw multiple unfeasible routes 509 from service (see 3.1). An UPDATE message may simultaneously 510 advertise a feasible route and withdraw multiple unfeasible routes 511 from service. The UPDATE message always includes the fixed-size BGP 512 header, and also includes the other fields as shown below (note, some 513 of the shown fields may not be present in every UPDATE message): 515 +-----------------------------------------------------+ 516 | Withdrawn Routes Length (2 octets) | 517 +-----------------------------------------------------+ 518 | Withdrawn Routes (variable) | 519 +-----------------------------------------------------+ 520 | Total Path Attribute Length (2 octets) | 521 +-----------------------------------------------------+ 522 | Path Attributes (variable) | 523 +-----------------------------------------------------+ 524 | Network Layer Reachability Information (variable) | 525 +-----------------------------------------------------+ 527 Withdrawn Routes Length: 529 RFC DRAFT January 2002 531 This 2-octets unsigned integer indicates the total length of 532 the Withdrawn Routes field in octets. Its value must allow the 533 length of the Network Layer Reachability Information field to 534 be determined as specified below. 536 A value of 0 indicates that no routes are being withdrawn from 537 service, and that the WITHDRAWN ROUTES field is not present in 538 this UPDATE message. 540 Withdrawn Routes: 542 This is a variable length field that contains a list of IP 543 address prefixes for the routes that are being withdrawn from 544 service. Each IP address prefix is encoded as a 2-tuple of the 545 form , whose fields are described below: 547 +---------------------------+ 548 | Length (1 octet) | 549 +---------------------------+ 550 | Prefix (variable) | 551 +---------------------------+ 553 The use and the meaning of these fields are as follows: 555 a) Length: 557 The Length field indicates the length in bits of the IP 558 address prefix. A length of zero indicates a prefix that 559 matches all IP addresses (with prefix, itself, of zero 560 octets). 562 b) Prefix: 564 The Prefix field contains an IP address prefix followed by 565 enough trailing bits to make the end of the field fall on an 566 octet boundary. Note that the value of trailing bits is 567 irrelevant. 569 Total Path Attribute Length: 571 This 2-octet unsigned integer indicates the total length of the 572 Path Attributes field in octets. Its value must allow the 573 length of the Network Layer Reachability field to be determined 574 as specified below. 576 A value of 0 indicates that no Network Layer Reachability 577 RFC DRAFT January 2002 579 Information field is present in this UPDATE message. 581 Path Attributes: 583 A variable length sequence of path attributes is present in 584 every UPDATE. Each path attribute is a triple of variable length. 587 Attribute Type is a two-octet field that consists of the 588 Attribute Flags octet followed by the Attribute Type Code 589 octet. 591 0 1 592 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 593 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 594 | Attr. Flags |Attr. Type Code| 595 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 597 The high-order bit (bit 0) of the Attribute Flags octet is the 598 Optional bit. It defines whether the attribute is optional (if 599 set to 1) or well-known (if set to 0). 601 The second high-order bit (bit 1) of the Attribute Flags octet 602 is the Transitive bit. It defines whether an optional attribute 603 is transitive (if set to 1) or non-transitive (if set to 0). 604 For well-known attributes, the Transitive bit must be set to 1. 605 (See Section 5 for a discussion of transitive attributes.) 607 The third high-order bit (bit 2) of the Attribute Flags octet 608 is the Partial bit. It defines whether the information 609 contained in the optional transitive attribute is partial (if 610 set to 1) or complete (if set to 0). For well-known attributes 611 and for optional non-transitive attributes the Partial bit must 612 be set to 0. 614 The fourth high-order bit (bit 3) of the Attribute Flags octet 615 is the Extended Length bit. It defines whether the Attribute 616 Length is one octet (if set to 0) or two octets (if set to 1). 618 The lower-order four bits of the Attribute Flags octet are 619 unused. They must be zero when sent and must be ignored when 620 received. 622 The Attribute Type Code octet contains the Attribute Type Code. 624 RFC DRAFT January 2002 626 Currently defined Attribute Type Codes are discussed in Section 627 5. 629 If the Extended Length bit of the Attribute Flags octet is set 630 to 0, the third octet of the Path Attribute contains the length 631 of the attribute data in octets. 633 If the Extended Length bit of the Attribute Flags octet is set 634 to 1, then the third and the fourth octets of the path 635 attribute contain the length of the attribute data in octets. 637 The remaining octets of the Path Attribute represent the 638 attribute value and are interpreted according to the Attribute 639 Flags and the Attribute Type Code. The supported Attribute Type 640 Codes, their attribute values and uses are the following: 642 a) ORIGIN (Type Code 1): 644 ORIGIN is a well-known mandatory attribute that defines the 645 origin of the path information. The data octet can assume 646 the following values: 648 Value Meaning 650 0 IGP - Network Layer Reachability Information 651 is interior to the originating AS 653 1 EGP - Network Layer Reachability Information 654 learned via the EGP protocol 656 2 INCOMPLETE - Network Layer Reachability 657 Information learned by some other means 659 Its usage is defined in 5.1.1 661 b) AS_PATH (Type Code 2): 663 AS_PATH is a well-known mandatory attribute that is composed 664 of a sequence of AS path segments. Each AS path segment is 665 represented by a triple . 668 The path segment type is a 1-octet long field with the 669 following values defined: 671 Value Segment Type 673 1 AS_SET: unordered set of ASs a route in the 674 RFC DRAFT January 2002 676 UPDATE message has traversed 678 2 AS_SEQUENCE: ordered set of ASs a route in 679 the UPDATE message has traversed 681 The path segment length is a 1-octet long field containing 682 the number of ASs in the path segment value field. 684 The path segment value field contains one or more AS 685 numbers, each encoded as a 2-octets long field. 687 Usage of this attribute is defined in 5.1.2. 689 c) NEXT_HOP (Type Code 3): 691 This is a well-known mandatory attribute that defines the IP 692 address of the border router that should be used as the next 693 hop to the destinations listed in the Network Layer 694 Reachability Information field of the UPDATE message. 696 Usage of this attribute is defined in 5.1.3. 698 d) MULTI_EXIT_DISC (Type Code 4): 700 This is an optional non-transitive attribute that is a four 701 octet non-negative integer. The value of this attribute may 702 be used by a BGP speaker's decision process to discriminate 703 among multiple entry points to a neighboring autonomous 704 system. 706 Its usage is defined in 5.1.4. 708 e) LOCAL_PREF (Type Code 5): 710 LOCAL_PREF is a well-known attribute that is a four octet 711 non-negative integer. A BGP speaker uses it to inform other 712 internal peers of the advertising speaker's degree of 713 preference for an advertised route. Usage of this attribute 714 is described in 5.1.5. 716 f) ATOMIC_AGGREGATE (Type Code 6) 718 ATOMIC_AGGREGATE is a well-known discretionary attribute of 719 length 0. Usage of this attribute is described in 5.1.6. 721 g) AGGREGATOR (Type Code 7) 722 RFC DRAFT January 2002 724 AGGREGATOR is an optional transitive attribute of length 6. 725 The attribute contains the last AS number that formed the 726 aggregate route (encoded as 2 octets), followed by the IP 727 address of the BGP speaker that formed the aggregate route 728 (encoded as 4 octets). This should be the same address as 729 the one used for the BGP Identifier of the speaker. Usage 730 of this attribute is described in 5.1.7. 732 Network Layer Reachability Information: 734 This variable length field contains a list of IP address 735 prefixes. The length in octets of the Network Layer 736 Reachability Information is not encoded explicitly, but can be 737 calculated as: 739 UPDATE message Length - 23 - Total Path Attributes Length - 740 Withdrawn Routes Length 742 where UPDATE message Length is the value encoded in the fixed- 743 size BGP header, Total Path Attribute Length and Withdrawn 744 Routes Length are the values encoded in the variable part of 745 the UPDATE message, and 23 is a combined length of the fixed- 746 size BGP header, the Total Path Attribute Length field and the 747 Withdrawn Routes Length field. 749 Reachability information is encoded as one or more 2-tuples of 750 the form , whose fields are described below: 752 +---------------------------+ 753 | Length (1 octet) | 754 +---------------------------+ 755 | Prefix (variable) | 756 +---------------------------+ 758 The use and the meaning of these fields are as follows: 760 a) Length: 762 The Length field indicates the length in bits of the IP 763 address prefix. A length of zero indicates a prefix that 764 matches all IP addresses (with prefix, itself, of zero 765 octets). 767 b) Prefix: 769 The Prefix field contains IP address prefixes followed by 770 RFC DRAFT January 2002 772 enough trailing bits to make the end of the field fall on an 773 octet boundary. Note that the value of the trailing bits is 774 irrelevant. 776 The minimum length of the UPDATE message is 23 octets -- 19 octets 777 for the fixed header + 2 octets for the Withdrawn Routes Length + 2 778 octets for the Total Path Attribute Length (the value of Withdrawn 779 Routes Length is 0 and the value of Total Path Attribute Length is 780 0). 782 An UPDATE message can advertise at most one set of path attributes, 783 but multiple destinations, provided that the destinations share these 784 attributes. All path attributes contained in a given UPDATE message 785 apply to all destinations carried in the NLRI field of the UPDATE 786 message. 788 An UPDATE message can list multiple routes to be withdrawn from 789 service. Each such route is identified by its destination (expressed 790 as an IP prefix), which unambiguously identifies the route in the 791 context of the BGP speaker - BGP speaker connection to which it has 792 been previously advertised. 794 An UPDATE message might advertise only routes to be withdrawn from 795 service, in which case it will not include path attributes or Network 796 Layer Reachability Information. Conversely, it may advertise only a 797 feasible route, in which case the WITHDRAWN ROUTES field need not be 798 present. 800 An UPDATE message should not include the same address prefix in the 801 WITHDRAWN ROUTES and Network Layer Reachability Information fields, 802 however a BGP speaker MUST be able to process UPDATE messages in this 803 form. A BGP speaker should treat an UPDATE message of this form as if 804 the WITHDRAWN ROUTES doesn't contain the address prefix. 806 4.4 KEEPALIVE Message Format 808 BGP does not use any transport protocol-based keep-alive mechanism to 809 determine if peers are reachable. Instead, KEEPALIVE messages are 810 exchanged between peers often enough as not to cause the Hold Timer 811 to expire. A reasonable maximum time between KEEPALIVE messages would 812 be one third of the Hold Time interval. KEEPALIVE messages MUST NOT 813 be sent more frequently than one per second. An implementation MAY 814 adjust the rate at which it sends KEEPALIVE messages as a function of 815 the Hold Time interval. 817 If the negotiated Hold Time interval is zero, then periodic KEEPALIVE 818 RFC DRAFT January 2002 820 messages MUST NOT be sent. 822 KEEPALIVE message consists of only message header and has a length of 823 19 octets. 825 4.5 NOTIFICATION Message Format 827 A NOTIFICATION message is sent when an error condition is detected. 828 The BGP connection is closed immediately after sending it. 830 In addition to the fixed-size BGP header, the NOTIFICATION message 831 contains the following fields: 833 0 1 2 3 834 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 835 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 836 | Error code | Error subcode | Data (variable) | 837 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 839 Error Code: 841 This 1-octet unsigned integer indicates the type of 842 NOTIFICATION. The following Error Codes have been defined: 844 Error Code Symbolic Name Reference 846 1 Message Header Error Section 6.1 848 2 OPEN Message Error Section 6.2 850 3 UPDATE Message Error Section 6.3 852 4 Hold Timer Expired Section 6.5 854 5 Finite State Machine Error Section 6.6 856 6 Cease Section 6.7 858 Error subcode: 860 This 1-octet unsigned integer provides more specific 861 information about the nature of the reported error. Each Error 862 RFC DRAFT January 2002 864 Code may have one or more Error Subcodes associated with it. If 865 no appropriate Error Subcode is defined, then a zero 866 (Unspecific) value is used for the Error Subcode field. 868 Message Header Error subcodes: 870 1 - Connection Not Synchronized. 871 2 - Bad Message Length. 872 3 - Bad Message Type. 874 OPEN Message Error subcodes: 876 1 - Unsupported Version Number. 877 2 - Bad Peer AS. 878 3 - Bad BGP Identifier. 879 4 - Unsupported Optional Parameter. 880 5 - Authentication Failure. 881 6 - Unacceptable Hold Time. 883 UPDATE Message Error subcodes: 885 1 - Malformed Attribute List. 886 2 - Unrecognized Well-known Attribute. 887 3 - Missing Well-known Attribute. 888 4 - Attribute Flags Error. 889 5 - Attribute Length Error. 890 6 - Invalid ORIGIN Attribute 891 8 - Invalid NEXT_HOP Attribute. 892 9 - Optional Attribute Error. 893 10 - Invalid Network Field. 894 11 - Malformed AS_PATH. 896 Data: 898 This variable-length field is used to diagnose the reason for 899 the NOTIFICATION. The contents of the Data field depend upon 900 the Error Code and Error Subcode. See Section 6 below for more 901 details. 903 Note that the length of the Data field can be determined from 904 the message Length field by the formula: 906 Message Length = 21 + Data Length 908 The minimum length of the NOTIFICATION message is 21 octets 909 (including message header). 911 RFC DRAFT January 2002 913 5. Path Attributes 915 This section discusses the path attributes of the UPDATE message. 917 Path attributes fall into four separate categories: 919 1. Well-known mandatory. 920 2. Well-known discretionary. 921 3. Optional transitive. 922 4. Optional non-transitive. 924 Well-known attributes must be recognized by all BGP implementations. 925 Some of these attributes are mandatory and must be included in every 926 UPDATE message that contains NLRI. Others are discretionary and may 927 or may not be sent in a particular UPDATE message. 929 All well-known attributes must be passed along (after proper 930 updating, if necessary) to other BGP peers. 932 In addition to well-known attributes, each path may contain one or 933 more optional attributes. It is not required or expected that all BGP 934 implementations support all optional attributes. The handling of an 935 unrecognized optional attribute is determined by the setting of the 936 Transitive bit in the attribute flags octet. Paths with unrecognized 937 transitive optional attributes should be accepted. If a path with 938 unrecognized transitive optional attribute is accepted and passed 939 along to other BGP peers, then the unrecognized transitive optional 940 attribute of that path must be passed along with the path to other 941 BGP peers with the Partial bit in the Attribute Flags octet set to 1. 942 If a path with recognized transitive optional attribute is accepted 943 and passed along to other BGP peers and the Partial bit in the 944 Attribute Flags octet is set to 1 by some previous AS, it is not set 945 back to 0 by the current AS. Unrecognized non-transitive optional 946 attributes must be quietly ignored and not passed along to other BGP 947 peers. 949 New transitive optional attributes may be attached to the path by the 950 originator or by any other BGP speaker in the path. If they are not 951 attached by the originator, the Partial bit in the Attribute Flags 952 octet is set to 1. The rules for attaching new non-transitive 953 optional attributes will depend on the nature of the specific 954 attribute. The documentation of each new non-transitive optional 955 attribute will be expected to include such rules. (The description of 956 the MULTI_EXIT_DISC attribute gives an example.) All optional 957 attributes (both transitive and non-transitive) may be updated (if 958 appropriate) by BGP speakers in the path. 960 RFC DRAFT January 2002 962 The sender of an UPDATE message should order path attributes within 963 the UPDATE message in ascending order of attribute type. The receiver 964 of an UPDATE message must be prepared to handle path attributes 965 within the UPDATE message that are out of order. 967 The same attribute cannot appear more than once within the Path 968 Attributes field of a particular UPDATE message. 970 The mandatory category refers to an attribute which must be present 971 in both IBGP and EBGP exchanges if NLRI are contained in the UPDATE 972 message. Attributes classified as optional for the purpose of the 973 protocol extension mechanism may be purely discretionary, or 974 discretionary, required, or disallowed in certain contexts. 976 attribute EBGP IBGP 977 ORIGIN mandatory mandatory 978 AS_PATH mandatory mandatory 979 NEXT_HOP mandatory mandatory 980 MULTI_EXIT_DISC discretionary discretionary 981 LOCAL_PREF disallowed required 982 ATOMIC_AGGREGATE see section 5.1.6 and 9.1.4 983 AGGREGATOR discretionary discretionary 985 5.1 Path Attribute Usage 987 The usage of each BGP path attributes is described in the following 988 clauses. 990 5.1.1 ORIGIN 992 ORIGIN is a well-known mandatory attribute. The ORIGIN attribute 993 shall be generated by the autonomous system that originates the 994 associated routing information. It shall be included in the UPDATE 995 messages of all BGP speakers that choose to propagate this 996 information to other BGP speakers. 998 5.1.2 AS_PATH 1000 AS_PATH is a well-known mandatory attribute. This attribute 1001 RFC DRAFT January 2002 1003 identifies the autonomous systems through which routing information 1004 carried in this UPDATE message has passed. The components of this 1005 list can be AS_SETs or AS_SEQUENCEs. 1007 When a BGP speaker propagates a route which it has learned from 1008 another BGP speaker's UPDATE message, it shall modify the route's 1009 AS_PATH attribute based on the location of the BGP speaker to which 1010 the route will be sent: 1012 a) When a given BGP speaker advertises the route to an internal 1013 peer, the advertising speaker shall not modify the AS_PATH 1014 attribute associated with the route. 1016 b) When a given BGP speaker advertises the route to an external 1017 peer, then the advertising speaker shall update the AS_PATH 1018 attribute as follows: 1020 1) if the first path segment of the AS_PATH is of type 1021 AS_SEQUENCE, the local system shall prepend its own AS number 1022 as the last element of the sequence (put it in the leftmost 1023 position). If the act of prepending will cause an overflow in 1024 the AS_PATH segment, i.e. more than 255 elements, it shall be 1025 legal to prepend a new segment of type AS_SEQUENCE and prepend 1026 its own AS number to this new segment. 1028 2) if the first path segment of the AS_PATH is of type AS_SET, 1029 the local system shall prepend a new path segment of type 1030 AS_SEQUENCE to the AS_PATH, including its own AS number in that 1031 segment. 1033 When a BGP speaker originates a route then: 1035 a) the originating speaker shall include its own AS number in a 1036 path segment of type AS_SEQUENCE in the AS_PATH attribute of all 1037 UPDATE messages sent to an external peer. (In this case, the AS 1038 number of the originating speaker's autonomous system will be the 1039 only entry the path segment, and this path segment will be the 1040 only segment in the AS_PATH attribute). 1042 b) the originating speaker shall include an empty AS_PATH 1043 attribute in all UPDATE messages sent to internal peers. (An 1044 empty AS_PATH attribute is one whose length field contains the 1045 value zero). 1047 Whenever the modification of the AS_PATH attribute calls for 1048 including or prepending the AS number of the local system, the local 1049 system may include/prepend more than one instance of its own AS 1050 number in the AS_PATH attribute. This is controlled via local 1051 RFC DRAFT January 2002 1053 configuration. 1055 5.1.3 NEXT_HOP 1057 The NEXT_HOP path attribute defines the IP address of the border 1058 router that should be used as the next hop to the destinations listed 1059 in the UPDATE message. The NEXT_HOP attribute is calculated as 1060 follows. 1062 1) When sending a message to an internal peer, the BGP speaker 1063 should not modify the NEXT_HOP attribute, unless it has been 1064 explicitly configured to announce its own IP address as the 1065 NEXT_HOP. 1067 2) When sending a message to an external peer X, and the peer is 1068 one IP hop away from the speaker: 1070 - If the route being announced was learned from an internal 1071 peer or is locally originated, the BGP speaker can use for the 1072 NEXT_HOP attribute an interface address of the internal peer 1073 router (or the internal router) through which the announced 1074 network is reachable for the speaker, provided that peer X 1075 shares a common subnet with this address. This is a form of 1076 "third party" NEXT_HOP attribute. 1078 - If the route being announced was learned from an external 1079 peer, the speaker can use in the NEXT_HOP attribute an IP 1080 address of any adjacent router (known from the received 1081 NEXT_HOP attribute) that the speaker itself uses for local 1082 route calculation, provided that peer X shares a common subnet 1083 with this address. This is a second form of "third party" 1084 NEXT_HOP attribute. 1086 - If the external peer to which the route is being advertised 1087 shares a common subnet with one of the announcing router's own 1088 interfaces, the router may use the IP address associated with 1089 such an interface in the NEXT_HOP attribute. This is known as a 1090 "first party" NEXT_HOP attribute. 1092 - By default (if none of the above conditions apply), the BGP 1093 speaker should use in the NEXT_HOP attribute the IP address of 1094 the interface that the speaker uses to establish the BGP 1095 session to peer X. 1097 3) When sending a message to an external peer X, and the peer is 1098 RFC DRAFT January 2002 1100 multiple IP hops away from the speaker (aka "multihop EBGP"): 1102 - The speaker may be configured to propagate the NEXT_HOP 1103 attribute. In this case when advertising a route that the 1104 speaker learned from one of its peers, the NEXT_HOP attribute 1105 of the advertised route is exactly the same as the NEXT_HOP 1106 attribute of the learned route (the speaker just doesn't modify 1107 the NEXT_HOP attribute). 1109 - By default, the BGP speaker should use in the NEXT_HOP 1110 attribute the IP address of the interface that the speaker uses 1111 to establish the BGP session to peer X. 1113 Normally the NEXT_HOP attribute is chosen such that the shortest 1114 available path will be taken. A BGP speaker must be able to support 1115 disabling advertisement of third party NEXT_HOP attributes to handle 1116 imperfectly bridged media. 1118 A BGP speaker must never advertise an address of a peer to that peer 1119 as a NEXT_HOP, for a route that the speaker is originating. A BGP 1120 speaker must never install a route with itself as the next hop. 1122 The NEXT_HOP attribute is used by the BGP speaker to determine the 1123 actual outbound interface and immediate next-hop address that should 1124 be used to forward transit packets to the associated destinations. 1125 The immediate next-hop address is determined by performing a 1126 recursive route lookup operation for the IP address in the NEXT_HOP 1127 attribute using the contents of the Routing Table (see Section 1128 9.1.2.2). The resolving route will always specify the outbound 1129 interface. If the resolving route specifies the next-hop address, 1130 this address should be used as the immediate address for packet 1131 forwarding. If the address in the NEXT_HOP attribute is directly 1132 resolved through a route to an attached subnet (such a route will not 1133 specify the next-hop address), the outbound interface should be taken 1134 from the resolving route and the address in the NEXT_HOP attribute 1135 should be used as the immediate next-hop address. 1137 5.1.4 MULTI_EXIT_DISC 1139 The MULTI_EXIT_DISC attribute may be used on external (inter-AS) 1140 links to discriminate among multiple exit or entry points to the same 1141 neighboring AS. The value of the MULTI_EXIT_DISC attribute is a four 1142 octet unsigned number which is called a metric. All other factors 1143 being equal, the exit point with lower metric should be preferred. If 1144 received over external links, the MULTI_EXIT_DISC attribute MAY be 1145 propagated over internal links to other BGP speakers within the same 1146 RFC DRAFT January 2002 1148 AS. The MULTI_EXIT_DISC attribute received from a neighboring AS MUST 1149 NOT be propagated to other neighboring ASs. 1151 A BGP speaker MUST IMPLEMENT a mechanism based on local configuration 1152 which allows the MULTI_EXIT_DISC attribute to be removed from a 1153 route. This MAY be done prior to determining the degree of preference 1154 of the route and performing route selection (decision process phases 1155 1 and 2). 1157 An implementation MAY also (based on local configuration) alter the 1158 value of the MULTI_EXIT_DISC attribute received over an external 1159 link. If it does so, it shall do so prior to determining the degree 1160 of preference of the route and performing route selection (decision 1161 process phases 1 and 2). 1163 5.1.5 LOCAL_PREF 1165 LOCAL_PREF is a well-known attribute that SHALL be included in all 1166 UPDATE messages that a given BGP speaker sends to the other internal 1167 peers. A BGP speaker SHALL calculate the degree of preference for 1168 each external route based on the locally configured policy, and 1169 include the degree of preference when advertising a route to its 1170 internal peers. The higher degree of preference MUST be preferred. A 1171 BGP speaker shall use the degree of preference learned via LOCAL_PREF 1172 in its decision process (see section 9.1.1). 1174 A BGP speaker MUST NOT include this attribute in UPDATE messages that 1175 it sends to external peers, except for the case of BGP Confederations 1176 [13]. If it is contained in an UPDATE message that is received from 1177 an external peer, then this attribute MUST be ignored by the 1178 receiving speaker, except for the case of BGP Confederations [13]. 1180 5.1.6 ATOMIC_AGGREGATE 1182 ATOMIC_AGGREGATE is a well-known discretionary attribute. 1184 When a router aggregates several routes for the purpose of 1185 advertisement to a particular peer, and the AS_PATH of the aggregated 1186 route excludes at least some of the AS numbers present in the AS_PATH 1187 of the routes that are aggregated, the aggregated route, when 1188 advertised to the peer, MUST include the ATOMIC_AGGREGATE attribute. 1190 A BGP speaker that receives a route with the ATOMIC_AGGREGATE 1191 attribute MUST NOT remove the attribute from the route when 1192 RFC DRAFT January 2002 1194 propagating it to other speakers. 1196 A BGP speaker that receives a route with the ATOMIC_AGGREGATE 1197 attribute MUST NOT make any NLRI of that route more specific (as 1198 defined in 9.1.4) when advertising this route to other BGP speakers. 1200 A BGP speaker that receives a route with the ATOMIC_AGGREGATE 1201 attribute needs to be cognizant of the fact that the actual path to 1202 destinations, as specified in the NLRI of the route, while having the 1203 loop-free property, may not be the path specified in the AS_PATH 1204 attribute of the route. 1206 5.1.7 AGGREGATOR 1208 AGGREGATOR is an optional transitive attribute which may be included 1209 in updates which are formed by aggregation (see Section 9.2.2.2). A 1210 BGP speaker which performs route aggregation may add the AGGREGATOR 1211 attribute which shall contain its own AS number and IP address. The 1212 IP address should be the same as the BGP Identifier of the speaker. 1214 6. BGP Error Handling. 1216 This section describes actions to be taken when errors are detected 1217 while processing BGP messages. 1219 When any of the conditions described here are detected, a 1220 NOTIFICATION message with the indicated Error Code, Error Subcode, 1221 and Data fields is sent, and the BGP connection is closed. If no 1222 Error Subcode is specified, then a zero must be used. 1224 The phrase "the BGP connection is closed" means that the transport 1225 protocol connection has been closed, the associated Adj-RIB-In has 1226 been cleared, and that all resources for that BGP connection have 1227 been deallocated. Entries in the Loc-RIB associated with the remote 1228 peer are marked as invalid. The fact that the routes have become 1229 invalid is passed to other BGP peers before the routes are deleted 1230 from the system. 1232 Unless specified explicitly, the Data field of the NOTIFICATION 1233 message that is sent to indicate an error is empty. 1235 RFC DRAFT January 2002 1237 6.1 Message Header error handling. 1239 All errors detected while processing the Message Header are indicated 1240 by sending the NOTIFICATION message with Error Code Message Header 1241 Error. The Error Subcode elaborates on the specific nature of the 1242 error. 1244 The expected value of the Marker field of the message header is all 1245 ones if the message type is OPEN. The expected value of the Marker 1246 field for all other types of BGP messages determined based on the 1247 presence of the Authentication Information Optional Parameter in the 1248 BGP OPEN message and the actual authentication mechanism (if the 1249 Authentication Information in the BGP OPEN message is present). The 1250 Marker field should be all ones if the OPEN message carried no 1251 authentication information. If the Marker field of the message header 1252 is not the expected one, then a synchronization error has occurred 1253 and the Error Subcode is set to Connection Not Synchronized. 1255 If the Length field of the message header is less than 19 or greater 1256 than 4096, or if the Length field of an OPEN message is less than the 1257 minimum length of the OPEN message, or if the Length field of an 1258 UPDATE message is less than the minimum length of the UPDATE message, 1259 or if the Length field of a KEEPALIVE message is not equal to 19, or 1260 if the Length field of a NOTIFICATION message is less than the 1261 minimum length of the NOTIFICATION message, then the Error Subcode is 1262 set to Bad Message Length. The Data field contains the erroneous 1263 Length field. 1265 If the Type field of the message header is not recognized, then the 1266 Error Subcode is set to Bad Message Type. The Data field contains the 1267 erroneous Type field. 1269 6.2 OPEN message error handling. 1271 All errors detected while processing the OPEN message are indicated 1272 by sending the NOTIFICATION message with Error Code OPEN Message 1273 Error. The Error Subcode elaborates on the specific nature of the 1274 error. 1276 If the version number contained in the Version field of the received 1277 OPEN message is not supported, then the Error Subcode is set to 1278 Unsupported Version Number. The Data field is a 2-octets unsigned 1279 integer, which indicates the largest locally supported version number 1280 less than the version the remote BGP peer bid (as indicated in the 1281 received OPEN message), or if the smallest locally supported version 1282 RFC DRAFT January 2002 1284 number is greater than the version the remote BGP peer bid, then the 1285 smallest locally supported version number. 1287 If the Autonomous System field of the OPEN message is unacceptable, 1288 then the Error Subcode is set to Bad Peer AS. The determination of 1289 acceptable Autonomous System numbers is outside the scope of this 1290 protocol. 1292 If the Hold Time field of the OPEN message is unacceptable, then the 1293 Error Subcode MUST be set to Unacceptable Hold Time. An 1294 implementation MUST reject Hold Time values of one or two seconds. 1295 An implementation MAY reject any proposed Hold Time. An 1296 implementation which accepts a Hold Time MUST use the negotiated 1297 value for the Hold Time. 1299 If the BGP Identifier field of the OPEN message is syntactically 1300 incorrect, then the Error Subcode is set to Bad BGP Identifier. 1301 Syntactic correctness means that the BGP Identifier field represents 1302 a valid IP host address. 1304 If one of the Optional Parameters in the OPEN message is not 1305 recognized, then the Error Subcode is set to Unsupported Optional 1306 Parameters. 1308 If one of the Optional Parameters in the OPEN message is recognized, 1309 but is malformed, then the Error Subcode is set to 0 (Unspecific). 1311 If the OPEN message carries Authentication Information (as an 1312 Optional Parameter), then the corresponding authentication procedure 1313 is invoked. If the authentication procedure (based on Authentication 1314 Code and Authentication Data) fails, then the Error Subcode is set to 1315 Authentication Failure. 1317 6.3 UPDATE message error handling. 1319 All errors detected while processing the UPDATE message are indicated 1320 by sending the NOTIFICATION message with Error Code UPDATE Message 1321 Error. The error subcode elaborates on the specific nature of the 1322 error. 1324 Error checking of an UPDATE message begins by examining the path 1325 attributes. If the Withdrawn Routes Length or Total Attribute Length 1326 is too large (i.e., if Withdrawn Routes Length + Total Attribute 1327 Length + 23 exceeds the message Length), then the Error Subcode is 1328 RFC DRAFT January 2002 1330 set to Malformed Attribute List. 1332 If any recognized attribute has Attribute Flags that conflict with 1333 the Attribute Type Code, then the Error Subcode is set to Attribute 1334 Flags Error. The Data field contains the erroneous attribute (type, 1335 length and value). 1337 If any recognized attribute has Attribute Length that conflicts with 1338 the expected length (based on the attribute type code), then the 1339 Error Subcode is set to Attribute Length Error. The Data field 1340 contains the erroneous attribute (type, length and value). 1342 If any of the mandatory well-known attributes are not present, then 1343 the Error Subcode is set to Missing Well-known Attribute. The Data 1344 field contains the Attribute Type Code of the missing well-known 1345 attribute. 1347 If any of the mandatory well-known attributes are not recognized, 1348 then the Error Subcode is set to Unrecognized Well-known Attribute. 1349 The Data field contains the unrecognized attribute (type, length and 1350 value). 1352 If the ORIGIN attribute has an undefined value, then the Error 1353 Subcode is set to Invalid Origin Attribute. The Data field contains 1354 the unrecognized attribute (type, length and value). 1356 If the NEXT_HOP attribute field is syntactically incorrect, then the 1357 Error Subcode is set to Invalid NEXT_HOP Attribute. The Data field 1358 contains the incorrect attribute (type, length and value). Syntactic 1359 correctness means that the NEXT_HOP attribute represents a valid IP 1360 host address. Semantic correctness applies only to the external BGP 1361 links, and only when the sender and the receiving speaker are one IP 1362 hop away from each other. To be semantically correct, the IP address 1363 in the NEXT_HOP must not be the IP address of the receiving speaker, 1364 and the NEXT_HOP IP address must either be the sender's IP address 1365 (used to establish the BGP session), or the interface associated with 1366 the NEXT_HOP IP address must share a common subnet with the receiving 1367 BGP speaker. If the NEXT_HOP attribute is semantically incorrect, the 1368 error should be logged, and the route should be ignored. In this 1369 case, no NOTIFICATION message should be sent. 1371 The AS_PATH attribute is checked for syntactic correctness. If the 1372 path is syntactically incorrect, then the Error Subcode is set to 1373 Malformed AS_PATH. 1375 The information carried by the AS_PATH attribute is checked for AS 1376 loops. AS loop detection is done by scanning the full AS path (as 1377 RFC DRAFT January 2002 1379 specified in the AS_PATH attribute), and checking that the autonomous 1380 system number of the local system does not appear in the AS path. If 1381 the autonomous system number appears in the AS path the route may be 1382 stored in the Adj-RIB-In, but unless the router is configured to 1383 accept routes with its own autonomous system in the AS path, the 1384 route shall not be passed to the BGP Decision Process. Operations of 1385 a router that is configured to accept routes with its own autonomous 1386 system number in the AS path are outside the scope of this document. 1388 If an optional attribute is recognized, then the value of this 1389 attribute is checked. If an error is detected, the attribute is 1390 discarded, and the Error Subcode is set to Optional Attribute Error. 1391 The Data field contains the attribute (type, length and value). 1393 If any attribute appears more than once in the UPDATE message, then 1394 the Error Subcode is set to Malformed Attribute List. 1396 The NLRI field in the UPDATE message is checked for syntactic 1397 validity. If the field is syntactically incorrect, then the Error 1398 Subcode is set to Invalid Network Field. 1400 If a prefix in the NLRI field is semantically incorrect (e.g., an 1401 unexpected multicast IP address), an error should be logged locally, 1402 and the prefix should be ignored. 1404 An UPDATE message that contains correct path attributes, but no NLRI, 1405 shall be treated as a valid UPDATE message. 1407 6.4 NOTIFICATION message error handling. 1409 If a peer sends a NOTIFICATION message, and there is an error in that 1410 message, there is unfortunately no means of reporting this error via 1411 a subsequent NOTIFICATION message. Any such error, such as an 1412 unrecognized Error Code or Error Subcode, should be noticed, logged 1413 locally, and brought to the attention of the administration of the 1414 peer. The means to do this, however, lies outside the scope of this 1415 document. 1417 6.5 Hold Timer Expired error handling. 1419 If a system does not receive successive KEEPALIVE and/or UPDATE 1420 and/or NOTIFICATION messages within the period specified in the Hold 1421 Time field of the OPEN message, then the NOTIFICATION message with 1422 Hold Timer Expired Error Code must be sent and the BGP connection 1423 RFC DRAFT January 2002 1425 closed. 1427 6.6 Finite State Machine error handling. 1429 Any error detected by the BGP Finite State Machine (e.g., receipt of 1430 an unexpected event) is indicated by sending the NOTIFICATION message 1431 with Error Code Finite State Machine Error. 1433 6.7 Cease. 1435 In absence of any fatal errors (that are indicated in this section), 1436 a BGP peer may choose at any given time to close its BGP connection 1437 by sending the NOTIFICATION message with Error Code Cease. However, 1438 the Cease NOTIFICATION message must not be used when a fatal error 1439 indicated by this section does exist. 1441 A BGP speaker may support the ability to impose an (locally 1442 configured) upper bound on the number of address prefixes the speaker 1443 is willing to accept from a neighbor. When the upper bound is 1444 reached, the speaker (under control of local configuration) may 1445 either (a) discard new address prefixes from the neighbor, or (b) 1446 terminate the BGP peering with the neighbor. If the BGP speaker 1447 decides to terminate its peering with a neighbor because the number 1448 of address prefixes received from the neighbor exceeds the locally 1449 configured upper bound, then the speaker must send to the neighbor a 1450 NOTIFICATION message with the Error Code Cease. 1452 6.8 Connection collision detection. 1454 If a pair of BGP speakers try simultaneously to establish a BGP 1455 connection to each other, then two parallel connections between this 1456 pair of speakers might well be formed. If the source IP address used 1457 by one of these connections is the same as the destination IP address 1458 used by the other, and the destination IP address used by the first 1459 connection is the same as the source IP address used by the other, we 1460 refer to this situation as connection collision. Clearly in the 1461 presence of connection collision, one of these connections must be 1462 closed. 1464 Based on the value of the BGP Identifier a convention is established 1465 for detecting which BGP connection is to be preserved when a 1466 collision does occur. The convention is to compare the BGP 1467 RFC DRAFT January 2002 1469 Identifiers of the peers involved in the collision and to retain only 1470 the connection initiated by the BGP speaker with the higher-valued 1471 BGP Identifier. 1473 Upon receipt of an OPEN message, the local system must examine all of 1474 its connections that are in the OpenConfirm state. A BGP speaker may 1475 also examine connections in an OpenSent state if it knows the BGP 1476 Identifier of the peer by means outside of the protocol. If among 1477 these connections there is a connection to a remote BGP speaker whose 1478 BGP Identifier equals the one in the OPEN message, and this 1479 connection collides with the connection over which the OPEN message 1480 is received then the local system performs the following collision 1481 resolution procedure: 1483 1. The BGP Identifier of the local system is compared to the BGP 1484 Identifier of the remote system (as specified in the OPEN 1485 message). 1487 2. If the value of the local BGP Identifier is less than the 1488 remote one, the local system closes BGP connection that already 1489 exists (the one that is already in the OpenConfirm state), and 1490 accepts BGP connection initiated by the remote system. 1492 3. Otherwise, the local system closes newly created BGP connection 1493 (the one associated with the newly received OPEN message), and 1494 continues to use the existing one (the one that is already in the 1495 OpenConfirm state). 1497 Comparing BGP Identifiers is done by treating them as (4-octet 1498 long) unsigned integers. 1500 Unless allowed via configuration, a connection collision with an 1501 existing BGP connection that is in Established state causes 1502 closing of the newly created connection. 1504 Note that a connection collision cannot be detected with 1505 connections that are in Idle, or Connect, or Active states. 1507 Closing the BGP connection (that results from the collision 1508 resolution procedure) is accomplished by sending the NOTIFICATION 1509 message with the Error Code Cease. 1511 7. BGP Version Negotiation. 1513 BGP speakers may negotiate the version of the protocol by making 1514 RFC DRAFT January 2002 1516 multiple attempts to open a BGP connection, starting with the highest 1517 version number each supports. If an open attempt fails with an Error 1518 Code OPEN Message Error, and an Error Subcode Unsupported Version 1519 Number, then the BGP speaker has available the version number it 1520 tried, the version number its peer tried, the version number passed 1521 by its peer in the NOTIFICATION message, and the version numbers that 1522 it supports. If the two peers do support one or more common versions, 1523 then this will allow them to rapidly determine the highest common 1524 version. In order to support BGP version negotiation, future versions 1525 of BGP must retain the format of the OPEN and NOTIFICATION messages. 1527 8. BGP Finite State machine. 1529 This section specifies BGP operation in terms of a Finite State 1530 Machine (FSM). Following is a brief summary and overview of BGP 1531 operations by state as determined by this FSM. 1533 Initially BGP is in the Idle state. 1535 Idle state: 1537 A manual start event is a start event initiated by an operator. 1538 An automatic start event is a start event generated by the 1539 system. 1541 In this state BGP refuses all incoming BGP connections. No 1542 resources are allocated to the peer. In response to a Start 1543 event (manual or automatic), the local system: 1545 - initializes all BGP resources, 1547 - starts the ConnectRetry timer, 1549 - initiates a transport connection to the other BGP peer, 1551 - listens for a connection that may be initiated by the 1552 remote BGP peer, and 1554 - changes its state to connect. 1556 The exact value of the ConnectRetry timer is a local matter, 1557 but it should be sufficiently large to allow TCP 1558 initialization. 1560 Any other event received in the IDLE state, is ignored. 1562 RFC DRAFT January 2002 1564 IdleHold state: 1566 The IdleHold state keeps the system in "Idle" mode until a 1567 certain time period has passed or an operator intervenes to 1568 manually restart the connection. This "IdleHold timeout" 1569 prevents persistent flapping of a BGP peering session. 1571 Upon entering the Idle Hold state, if the IdleHoldTimer exceeds 1572 the local limit the "Keep Idle" flag is set. 1574 Upon receiving a Manual start, the local system: 1576 - clears the IdleHoldtimer, 1578 - clears "keep Idle" flag 1580 - initializes all BGP resources, 1582 - starts the ConnectRetry timer, 1584 - initiates a transport connection to the other BGP peer, 1586 - listens for a connection that may be initiated by the 1587 remote BGPPeer, and 1589 - changes its state to connect. 1591 Upon receiving a IdleHoldtimer expired event, the local system 1592 checks to see that the Keep Idle flag is set. If the Keep Idle 1593 flag is set, the system stays in the "Idle Hold" state. 1595 If the Keep Idle flag is not set, the local system: 1597 - clears the IdleHoldtimer, 1599 - and transitions the state to Idle. 1601 Getting out of the IdleHoldstate requires either operator 1602 intervention via a manual start or the IdleHoldtimer to expire 1603 with the "Keep Idle" flag to be clear. 1605 Any other event received in the IdleHold state is ignored. 1607 Connect State: 1609 In this state, BGP is waiting for the transport protocol 1610 connection to be completed. 1612 RFC DRAFT January 2002 1614 If the transport connection succeeds, the local system: 1616 - clears the ConnectRetry timer, 1618 - completes initialization, 1620 - send an Open message to its peer, 1622 - set Hold timer to a large value, and 1624 - changes its state to Open Sent. 1626 A hold timer value of 4 minutes is suggested. 1628 If the transport protocol connection fails (e.g., 1629 retransmission timeout), the local system: 1631 - restarts the ConnectRetry timer, 1633 - continues to listen for a connection that may be initiated 1634 by the remote BGP peer, and 1636 - changes its state to Active. 1638 In response to the ConnectRetry timer expired event, the local 1639 system: 1641 - restarts the ConnectRetry timer, 1643 - initiates a transport connection to the other BGP peer, 1645 - continues to listen for a connection that may be initiated 1646 by the remote BGP peer, and 1648 - stays in Connect state. 1650 The start event (manual or automatic) is ignored in the Connect 1651 state. 1653 In response to any other event (initiated by the system or 1654 operator), the local system: 1656 - IdleHoldtimer = 2**(ConnectRetryCnt)*60 1658 - Increment ConnectRetryCnt by 1, 1660 - Set connect retry timer to zero, 1661 RFC DRAFT January 2002 1663 - Drops TCP connection, 1665 - Releases all BGP resources, and 1667 - Goes to IdleHoldstate 1669 Active State: 1671 In this state BGP is trying to acquire a peer by listening for 1672 and accepting a transport protocol connection. 1674 If the transport connection succeeds, the local system: 1676 - clears the ConnectRetry timer, 1678 - completes the initialization, 1680 - sends the Open message to it's peer, 1682 - sets its Hold timer to a large value, 1684 - and changes its state to OpenSent. 1686 A Hold timer value of 4 minutes is suggested. 1688 In response the ConnectRetry timer expired event, the local 1689 system: 1691 - restarts the ConnectRetry timer, 1693 - initiates a transport connection to the other BGP peer, 1695 - continues to listen for connection that may be initiated 1696 by remote BGP peer, 1698 - and changes its state to Connect. 1700 If the local system does not allow BGP connections with 1701 unconfigured peers, then the local system: 1703 - rejects connections from IP addresses that are not 1704 configured peers, 1706 - and remains in the Active state. 1708 The start events (initiated by the system or operator) are 1709 ignored in the Active state. 1711 RFC DRAFT January 2002 1713 In response to any other event (initiated by the system or 1714 operator), the local system: 1716 - IdleHoldtimer = 2**(ConnectRetryCnt)*60 1718 - Increment ConnectRetryCnt by 1, 1720 - Set connect retry timer to zero, and 1722 - Drops TCP connection, 1724 - Releases all BGP resources, 1726 - Goes to IdleHold state. 1728 Open Sent: 1730 In this state BGP waits for an Open Message from its peer. 1731 When an OPEN message is received, all fields are check for 1732 correctness. If the BGP message header checking or OPEN 1733 message check detects an error (see Section 6.2), or a 1734 connection collision (see Section 6.8) the local system: 1736 - sends a NOTIFICATION message 1738 - IdleHoldtimer = 2**(ConnectRetryCnt)*60 1740 - Increment ConnectRetryCnt by 1, 1742 - Set connect retry timer to zero, and 1744 - Drops TCP connection, 1746 - Releases all BGP resources, 1748 - Goes to IdleHold state. 1750 If there are no errors in the OPEN message, the local system: 1752 - sends a KEEPALIVE message and 1754 - sets a KeepAlive timer (via the text below) 1756 - set the Hold timer according to the negotiated value (see 1757 section 4.2), 1759 - set the state to Open Confirm. 1761 RFC DRAFT January 2002 1763 If the negotiated Hold time value is zero, then the Hold Time 1764 timer and KeepAlive timers are not started. If the value of 1765 the Autonomous System field is the same as the local Autonomous 1766 System number, then the connection is an "internal" connection; 1767 otherwise, it is an "external" connection. (This will impact 1768 UPDATE processing as described below.) 1770 If a disconnect NOTIFICATION is received from the underlying 1771 transport protocol, the local system: 1773 - closes the BGP connection, 1775 - restarts the Connect Retry timer, 1777 - and continues to listen for a connection that may be 1778 initiated by the remote BGP peer, and goes into Active 1779 state. 1781 If the Hold Timer expires, the local system: 1783 - send a NOTIFICATION message with error code Hold Timer 1784 Expired, 1786 - IdleHoldtimer = 2**(ConnectRetryCnt)*60 1788 - Increment ConnectRetryCnt by 1, 1790 - Set connect retry timer to zero, and 1792 - Drops TCP connection, 1794 - Releases all BGP resources, and 1796 - Goes to IdleHold state. 1798 The Start event (manual and automatic) is ignored in the 1799 OpenSent state. 1801 If a NOTIFICATION message is received with a version error, the 1802 local system: 1804 - Closes the transport connection 1806 - Releases BGP resources, 1808 - ConnectRetryCnt = 0, 1810 - Connect retry timer = 0, and 1811 RFC DRAFT January 2002 1813 - transition to Idle state. 1815 If any other NOTIFICATION is received, the local system: 1817 - IdleHoldtimer = 2**(ConnectRetryCnt)*60 1819 - Increment ConnectRetryCnt by 1, 1821 - Set connect retry timer to zero, and 1823 - Drops TCP connection, 1825 - Releases all BGP resources, 1827 - Goes to IdleHold state. 1829 In response to any other event, the local system: 1831 - sends the NOTFICATION message with Error Code Finite State 1832 Machine Error, 1834 - IdleHoldtimer = 2**(ConnectRetryCnt)*60 1836 - Increment ConnectRetryCnt by 1, 1838 - Set connect retry timer to zero, 1840 - Drops TCP connection, 1842 - Releases all BGP resources, and 1844 - Goes to IdleHold state. 1846 Open Confirm State 1848 In this state BGP waits for a KEEPALIVE or NOTIFICATION 1849 message. 1851 If the local system receives a KEEPALIVE message, it changes 1852 its state to Established. 1854 If the Hold Timer expires before a KEEPALIVE message is 1855 received, the local system: 1857 - send the NOTIFICATION message with the error code Hold 1858 Timer Expired, 1860 - sets IdleHoldTimer = 2**(ConnectRetryCnt)*60 1861 RFC DRAFT January 2002 1863 - Increments ConnectRetryCnt by 1, 1865 - Sets the connect retry timer to zero, 1867 - Drop the TCP connection, 1869 - Releases all BGP resources, 1871 - Goes to IdleHoldState. 1873 If the local system receives a NOTIFICATION message or receives 1874 a disconnect NOTIFICATION from the underlying transport 1875 protocol, the local system: 1877 - Sets IdleHold Timer = 2**(ConnectRetryCnt)*60 1879 - Increments ConnectRetryCnt by 1, 1881 - Sets the connect retry timer to zero, 1883 - Drops the TCP connection, 1885 - Releases all BGP resources, 1887 - Goes to IdleHoldstate. 1889 In response to the Stop event initiated by the system, the 1890 local system: 1892 - sends the NOTIFICATION message with Cease, 1894 - sets IdleHoldtimer = 2**(ConnectRetryCnt)*60 1896 - Increments ConnectRetryCnt by 1, 1898 - Sets the Connect retry timer to zero, 1900 - Drops the TCP connection, 1902 - Releases all BGP resources, 1904 - Goes to IdleHoldstate. 1906 In response to a Stop event initiated by the operator, the 1907 local system: 1909 - sends the NOTIFICATION message with Cease, 1910 RFC DRAFT January 2002 1912 - releases all BGP resources 1914 - sets the ConnectRetryCnt to zero 1916 - sets the connect retry timer to 0 1918 - transitions to Idle state. 1920 The Start event is ignored in the OpenConfirm state. 1922 In response to any other event, the local system: 1924 - sends a NOTIFICATION with a code of Finite State Machine 1925 Error, 1927 - sets IdleHoldtimer = 2**(ConnectRetryCnt)*60 1929 - Increments ConnectRetryCnt by 1, 1931 - Sets the Connect retry timer to zero, 1933 - Drops the TCP connection, 1935 - Releases all BGP resources, 1937 - Goes to IdleHoldstate. 1939 Established State: 1941 In the Established state BGP can exchange UPDATE, NOTFICATION, 1942 and KEEPALIVE messages with its peer. 1944 If the local system receives an UPDATE or KEEPALIVE message, it 1945 restarts its Hold Timer, if the negotiated Hold Time value is 1946 non-zero. 1948 If the local system receives a NOTIFICATION message or a 1949 disconnect from the underlying transport protocol, it: 1951 - sets IdleHoldtimer = 2**(ConnectRetryCnt)*60, 1953 - Increments ConnectRetryCnt by 1, 1955 - Sets the Connect retry timer to zero, 1957 - Drops the TCP connection, 1959 - Releases all BGP resources, and 1960 RFC DRAFT January 2002 1962 - Goes to IdleHoldstate. 1964 If the local system receives an UPDATE message, and the Update 1965 message error handling procedure (see Section 6.3) detecs an 1966 error, the local system: 1968 - sends a NOTIFICATION message with Update error, 1970 - sets IdleHoldtimer = 2**(ConnectRetryCnt)*60 1972 - Increments ConnectRetryCnt by 1, 1974 - Sets the Connect retry timer to zero, 1976 - Drops the TCP connection, 1978 - Releases all BGP resources, and 1980 - Goes to IdleHoldstate. 1982 If the Hold timer expires, the local system: 1984 - sends a NOTIFICATION message with Error Code Hold Timer 1985 Expired, 1987 - sets IdleHoldtimer = 2**(ConnectRetryCnt)*60 1989 - Increments ConnectRetryCnt by 1, 1991 - Sets the connect retry timer to zero, 1993 - Drops the TCP connection, 1995 - Releases all BGP resources, 1997 - Goes to IdleHold state. 1999 If the KeepAlive timer expires, the local system sends a 2000 KEEPALIVE message, it restarts its KeepAlive timer, unless the 2001 negotiated Hold Time value is zero. 2003 Each time time the local system sends a KEEPALIVE or UPDATE 2004 message, it restarts its KeepAlive timer, unless the negotiated 2005 Hold Time value is zero. 2007 In response to the Stop event initiated by the system 2008 (automatic), the local system: 2010 RFC DRAFT January 2002 2012 - sends a NOTIFICATION with Cease, 2014 - sets IdleHoldtimer = 2**(ConnectRetryCnt)*60 2016 - increments ConnectRetryCnt by 1, 2018 - sets the connect retry timer to zero, 2020 - drops the TCP connection, 2022 - releases all BGP resources, 2024 - goes to IdleHold state, and 2026 - deletes all routes. 2028 An example automatic stop event is exceeding the number of 2029 prefixes for a given peer and the local system automatically 2030 disconnecting the peer. 2032 In response to a stop event initiated by an operator: 2034 - release all resources (including deleting all routes), 2036 - set ConnectRetryCnt to zero (0), 2038 - set connect retry timer to zero (0), and 2040 - transition to the Idle. 2042 The Start event is ignored in the Established state. 2044 In response to any other event, the local system: 2046 - sends a NOTIFICATION message with Error Code Finite State 2047 Machine Error, 2049 - sets IdleHoldtimer = 2**(ConnectRetryCnt)*60 2051 - increments ConnectRetryCnt by 1, 2053 - sets the connect retry timer to zero, 2055 - drops the TCP connection, 2057 - releases all BGP resources 2059 - goes to IdleHoldstate, and 2060 RFC DRAFT January 2002 2062 - deletes all routes. 2064 9. UPDATE Message Handling 2066 An UPDATE message may be received only in the Established state. 2067 When an UPDATE message is received, each field is checked for 2068 validity as specified in Section 6.3. 2070 If an optional non-transitive attribute is unrecognized, it is 2071 quietly ignored. If an optional transitive attribute is unrecognized, 2072 the Partial bit (the third high-order bit) in the attribute flags 2073 octet is set to 1, and the attribute is retained for propagation to 2074 other BGP speakers. 2076 If an optional attribute is recognized, and has a valid value, then, 2077 depending on the type of the optional attribute, it is processed 2078 locally, retained, and updated, if necessary, for possible 2079 propagation to other BGP speakers. 2081 If the UPDATE message contains a non-empty WITHDRAWN ROUTES field, 2082 the previously advertised routes whose destinations (expressed as IP 2083 prefixes) contained in this field shall be removed from the Adj-RIB- 2084 In. This BGP speaker shall run its Decision Process since the 2085 previously advertised route is no longer available for use. 2087 If the UPDATE message contains a feasible route, the Adj-RIB-In will 2088 be updated with this route as follows: if the NLRI of the new route 2089 is identical to the one of the route currently stored in the Adj-RIB- 2090 In, then the new route shall replace the older route in the Adj-RIB- 2091 In, thus implicitly withdrawing the older route from service. 2092 Otherwise, if the Adj-RIB-In has no route with NLRI identical to the 2093 new route, the new route shall be placed in the Adj-RIB-In. 2095 Once the BGP speaker updates the Adj-RIB-In, the speaker shall run 2096 its Decision Process. 2098 9.1 Decision Process 2100 The Decision Process selects routes for subsequent advertisement by 2101 applying the policies in the local Policy Information Base (PIB) to 2102 the routes stored in its Adj-RIBs-In. The output of the Decision 2103 Process is the set of routes that will be advertised to all peers; 2104 the selected routes will be stored in the local speaker's Adj-RIB- 2105 Out. 2107 RFC DRAFT January 2002 2109 The selection process is formalized by defining a function that takes 2110 the attribute of a given route as an argument and returns either (a) 2111 a non-negative integer denoting the degree of preference for the 2112 route, or (b) a value denoting that this route is ineligible to be 2113 installed in LocRib and will be excluded from the next phase of route 2114 selection. 2116 The function that calculates the degree of preference for a given 2117 route shall not use as its inputs any of the following: the existence 2118 of other routes, the non-existence of other routes, or the path 2119 attributes of other routes. Route selection then consists of 2120 individual application of the degree of preference function to each 2121 feasible route, followed by the choice of the one with the highest 2122 degree of preference. 2124 The Decision Process operates on routes contained in the Adj-RIB-In, 2125 and is responsible for: 2127 - selection of routes to be used locally by the speaker 2129 - selection of routes to be advertised to other BGP peers 2131 - route aggregation and route information reduction 2133 The Decision Process takes place in three distinct phases, each 2134 triggered by a different event: 2136 a) Phase 1 is responsible for calculating the degree of preference 2137 for each route received from a peer. 2139 b) Phase 2 is invoked on completion of phase 1. It is responsible 2140 for choosing the best route out of all those available for each 2141 distinct destination, and for installing each chosen route into 2142 the Loc-RIB. 2144 c) Phase 3 is invoked after the Loc-RIB has been modified. It is 2145 responsible for disseminating routes in the Loc-RIB to each peer, 2146 according to the policies contained in the PIB. Route aggregation 2147 and information reduction can optionally be performed within this 2148 phase. 2150 9.1.1 Phase 1: Calculation of Degree of Preference 2152 The Phase 1 decision function shall be invoked whenever the local BGP 2153 speaker receives from a peer an UPDATE message that advertises a new 2154 route, a replacement route, or withdrawn routes. 2156 RFC DRAFT January 2002 2158 The Phase 1 decision function is a separate process which completes 2159 when it has no further work to do. 2161 The Phase 1 decision function shall lock an Adj-RIB-In prior to 2162 operating on any route contained within it, and shall unlock it after 2163 operating on all new or unfeasible routes contained within it. 2165 For each newly received or replacement feasible route, the local BGP 2166 speaker shall determine a degree of preference as follows: 2168 If the route is learned from an internal peer, either the value of 2169 the LOCAL_PREF attribute shall be taken as the degree of 2170 preference, or the local system may compute the degree of 2171 preference of the route based on preconfigured policy information. 2172 Note that the latter (computing the degree of preference based on 2173 preconfigured policy information) may result in formation of 2174 persistent routing loops. 2176 If the route is learned from an external peer, then the local BGP 2177 speaker computes the degree of preference based on preconfigured 2178 policy information. If the return value indicates that the route 2179 is ineligible, the route may not serve as an input to the next 2180 phase of route selection; otherwise the return value is used as 2181 the LOCAL_PREF value in any IBGP readvertisement. 2183 The exact nature of this policy information and the computation 2184 involved is a local matter. 2186 9.1.2 Phase 2: Route Selection 2188 The Phase 2 decision function shall be invoked on completion of Phase 2189 1. The Phase 2 function is a separate process which completes when it 2190 has no further work to do. The Phase 2 process shall consider all 2191 routes that are eligible in the Adj-RIBs-In. 2193 The Phase 2 decision function shall be blocked from running while the 2194 Phase 3 decision function is in process. The Phase 2 function shall 2195 lock all Adj-RIBs-In prior to commencing its function, and shall 2196 unlock them on completion. 2198 If the NEXT_HOP attribute of a BGP route depicts an address that is 2199 not resolvable, or it would become unresolvable if the route was 2200 installed in the routing table the BGP route should be excluded from 2201 the Phase 2 decision function. 2203 It is critical that routers within an AS do not make conflicting 2204 RFC DRAFT January 2002 2206 decisions regarding route selection that would cause forwarding loops 2207 to occur. 2209 For each set of destinations for which a feasible route exists in the 2210 Adj-RIBs-In, the local BGP speaker shall identify the route that has: 2212 a) the highest degree of preference of any route to the same set 2213 of destinations, or 2215 b) is the only route to that destination, or 2217 c) is selected as a result of the Phase 2 tie breaking rules 2218 specified in 9.1.2.2. 2220 The local speaker SHALL then install that route in the Loc-RIB, 2221 replacing any route to the same destination that is currently being 2222 held in the Loc-RIB. If the new BGP route is installed in the Routing 2223 Table (as a result of the local policy decision), care must be taken 2224 to ensure that invalid BGP routes to the same destination are removed 2225 from the Routing Table. Whether or not the new route replaces an 2226 already existing non-BGP route in the routing table depends on the 2227 policy configured on the BGP speaker. 2229 The local speaker MUST determine the immediate next hop to the 2230 address depicted by the NEXT_HOP attribute of the selected route by 2231 performing a best matching route lookup in the Routing Table and 2232 selecting one of the possible paths (if multiple best paths to the 2233 same prefix are available). If the route to the address depicted by 2234 the NEXT_HOP attribute changes such that the immediate next hop or 2235 the IGP cost to the NEXT_HOP (if the NEXT_HOP is resolved through an 2236 IGP route) changes, route selection should be recalculated as 2237 specified above. 2239 Notice that even though BGP routes do not have to be installed in the 2240 Routing Table with the immediate next hop(s), implementations must 2241 take care that before any packets are forwarded along a BGP route, 2242 its associated NEXT_HOP address is resolved to the immediate 2243 (directly connected) next-hop address and this address (or multiple 2244 addresses) is finally used for actual packet forwarding. 2246 Unresolvable routes SHALL be removed from the Loc-RIB and the routing 2247 table. However, corresponding unresolvable routes SHOULD be kept in 2248 the Adj-RIBs-In. 2250 RFC DRAFT January 2002 2252 9.1.2.1 Route Resolvability Condition 2254 As indicated in Section 9.1.2, BGP routers should exclude 2255 unresolvable routes from the Phase 2 decision. This ensures that only 2256 valid routes are installed in Loc-RIB and the Routing Table. 2258 The route resolvability condition is defined as follows. 2260 1. A route Rte1, referencing only the intermediate network 2261 address, is considered resolvable if the Routing Table contains at 2262 least one resolvable route Rte2 that matches Rte1's intermediate 2263 network address and is not recursively resolved (directly or 2264 indirectly) through Rte1. If multiple matching routes are 2265 available, only the longest matching route should be considered. 2267 2. Routes referencing interfaces (with or without intermediate 2268 addresses) are considered resolvable if the state of the 2269 referenced interface is up and IP processing is enabled on this 2270 interface. 2272 BGP routes do not refer to interfaces, but can be resolved through 2273 the routes in the Routing Table that can be of both types. IGP routes 2274 and routes to directly connected networks are expected to specify the 2275 outbound interface. 2277 Note that a BGP route is considered unresolvable not only in 2278 situations where the router's Routing Table contains no route 2279 matching the BGP route's NEXT_HOP. Mutually recursive routes (routes 2280 resolving each other or themselves), also fail the resolvability 2281 check. 2283 It is also important that implementations do not consider feasible 2284 routes that would become unresolvable if they were installed in the 2285 Routing Table even if their NEXT_HOPs are resolvable using the 2286 current contents of the Routing Table (an example of such routes 2287 would be mutually recursive routes). This check ensures that a BGP 2288 speaker does not install in the Routing Table routes that will be 2289 removed and not used by the speaker. Therefore, in addition to local 2290 Routing Table stability, this check also improves behavior of the 2291 protocol in the network. 2293 Whenever a BGP speaker identifies a route that fails the 2294 resolvability check because of mutual recursion, an error message 2295 should be logged. 2297 RFC DRAFT January 2002 2299 9.1.2.2 Breaking Ties (Phase 2) 2301 In its Adj-RIBs-In a BGP speaker may have several routes to the same 2302 destination that have the same degree of preference. The local 2303 speaker can select only one of these routes for inclusion in the 2304 associated Loc-RIB. The local speaker considers all routes with the 2305 same degrees of preference, both those received from internal peers, 2306 and those received from external peers. 2308 The following tie-breaking procedure assumes that for each candidate 2309 route all the BGP speakers within an autonomous system can ascertain 2310 the cost of a path (interior distance) to the address depicted by the 2311 NEXT_HOP attribute of the route, and follow the same route selection 2312 algorithm. 2314 The tie-breaking algorithm begins by considering all equally 2315 preferable routes to the same destination, and then selects routes to 2316 be removed from consideration. The algorithm terminates as soon as 2317 only one route remains in consideration. The criteria must be 2318 applied in the order specified. 2320 Several of the criteria are described using pseudo-code. Note that 2321 the pseudo-code shown was chosen for clarity, not efficiency. It is 2322 not intended to specify any particular implementation. BGP 2323 implementations MAY use any algorithm which produces the same results 2324 as those described here. 2326 a) Remove from consideration all routes which are not tied for 2327 having the smallest number of AS numbers present in their AS_PATH 2328 attributes. Note, that when counting this number, an AS_SET counts 2329 as 1, no matter how many ASs are in the set, and that, if the 2330 implementation supports [13], then AS numbers present in segments 2331 of type AS_CONFED_SEQUENCE or AS_CONFED_SET are not included in 2332 the count of AS numbers present in the AS_PATH. 2334 b) Remove from consideration all routes which are not tied for 2335 having the lowest Origin number in their Origin attribute. 2337 c) Remove from consideration routes with less-preferred 2338 MULTI_EXIT_DISC attributes. MULTI_EXIT_DISC is only comparable 2339 between routes learned from the same neighboring AS. Routes which 2340 do not have the MULTI_EXIT_DISC attribute are considered to have 2341 the lowest possible MULTI_EXIT_DISC value. 2343 This is also described in the following procedure: 2345 for m = all routes still under consideration 2346 RFC DRAFT January 2002 2348 for n = all routes still under consideration 2349 if (neighborAS(m) == neighborAS(n)) and (MED(n) < MED(m)) 2350 remove route m from consideration 2352 In the pseudo-code above, MED(n) is a function which returns the 2353 value of route n's MULTI_EXIT_DISC attribute. If route n has no 2354 MULTI_EXIT_DISC attribute, the function returns the lowest 2355 possible MULTI_EXIT_DISC value, i.e. 0. 2357 Similarly, neighborAS(n) is a function which returns the neighbor 2358 AS from which the route was received. 2360 d) If at least one of the candidate routes was received from an 2361 external peer in a neighboring autonomous system, remove from 2362 consideration all routes which were received from internal peers. 2364 e) Remove from consideration any routes with less-preferred 2365 interior cost. The interior cost of a route is determined by 2366 calculating the metric to the next hop for the route using the 2367 Routing Table. If the next hop for a route is reachable, but no 2368 cost can be determined, then this step should be skipped 2369 (equivalently, consider all routes to have equal costs). 2371 This is also described in the following procedure. 2373 for m = all routes still under consideration 2374 for n = all routes in still under consideration 2375 if (cost(n) is better than cost(m)) 2376 remove m from consideration 2378 In the pseudo-code above, cost(n) is a function which returns the 2379 cost of the path (interior distance) to the address given in the 2380 NEXT_HOP attribute of the route. 2382 f) Remove from consideration all routes other than the route that 2383 was advertised by the BGP speaker whose BGP Identifier has the 2384 lowest value. 2386 g) Prefer the route received from the lowest neighbor address. 2388 9.1.3 Phase 3: Route Dissemination 2390 The Phase 3 decision function shall be invoked on completion of Phase 2391 2, or when any of the following events occur: 2393 a) when routes in the Loc-RIB to local destinations have changed 2394 RFC DRAFT January 2002 2396 b) when locally generated routes learned by means outside of BGP 2397 have changed 2399 c) when a new BGP speaker - BGP speaker connection has been 2400 established 2402 The Phase 3 function is a separate process which completes when it 2403 has no further work to do. The Phase 3 Routing Decision function 2404 shall be blocked from running while the Phase 2 decision function is 2405 in process. 2407 All routes in the Loc-RIB shall be processed into Adj-RIBs-Out 2408 according to configured policy. This policy may exclude a route in 2409 the Loc-RIB from being installed in a particular Adj-RIB-Out. A 2410 route shall not be installed in the Adj-Rib-Out unless the 2411 destination and NEXT_HOP described by this route may be forwarded 2412 appropriately by the Routing Table. If a route in Loc-RIB is excluded 2413 from a particular Adj-RIB-Out the previously advertised route in that 2414 Adj-RIB-Out must be withdrawn from service by means of an UPDATE 2415 message (see 9.2). 2417 Route aggregation and information reduction techniques (see 9.2.2.1) 2418 may optionally be applied. 2420 When the updating of the Adj-RIBs-Out and the Routing Table is 2421 complete, the local BGP speaker shall run the Update-Send process of 2422 9.2. 2424 9.1.4 Overlapping Routes 2426 A BGP speaker may transmit routes with overlapping Network Layer 2427 Reachability Information (NLRI) to another BGP speaker. NLRI overlap 2428 occurs when a set of destinations are identified in non-matching 2429 multiple routes. Since BGP encodes NLRI using IP prefixes, overlap 2430 will always exhibit subset relationships. A route describing a 2431 smaller set of destinations (a longer prefix) is said to be more 2432 specific than a route describing a larger set of destinations (a 2433 shorted prefix); similarly, a route describing a larger set of 2434 destinations (a shorter prefix) is said to be less specific than a 2435 route describing a smaller set of destinations (a longer prefix). 2437 The precedence relationship effectively decomposes less specific 2438 routes into two parts: 2440 - a set of destinations described only by the less specific route, 2441 and 2442 RFC DRAFT January 2002 2444 - a set of destinations described by the overlap of the less 2445 specific and the more specific routes 2447 When overlapping routes are present in the same Adj-RIB-In, the more 2448 specific route shall take precedence, in order from more specific to 2449 least specific. 2451 The set of destinations described by the overlap represents a portion 2452 of the less specific route that is feasible, but is not currently in 2453 use. If a more specific route is later withdrawn, the set of 2454 destinations described by the overlap will still be reachable using 2455 the less specific route. 2457 If a BGP speaker receives overlapping routes, the Decision Process 2458 MUST consider both routes based on the configured acceptance policy. 2459 If both a less and a more specific route are accepted, then the 2460 Decision Process MUST either install both the less and the more 2461 specific routes or it MUST aggregate the two routes and install the 2462 aggregated route, provided that both routes have the same value of 2463 the NEXT_HOP attribute. 2465 If a BGP speaker chooses to aggregate, then it MUST add 2466 ATOMIC_AGGREGATE attribute to the route. A route that carries 2467 ATOMIC_AGGREGATE attribute can not be de-aggregated. That is, the 2468 NLRI of this route can not be made more specific. Forwarding along 2469 such a route does not guarantee that IP packets will actually 2470 traverse only ASs listed in the AS_PATH attribute of the route. 2472 9.2 Update-Send Process 2474 The Update-Send process is responsible for advertising UPDATE 2475 messages to all peers. For example, it distributes the routes chosen 2476 by the Decision Process to other BGP speakers which may be located in 2477 either the same autonomous system or a neighboring autonomous system. 2479 When a BGP speaker receives an UPDATE message from an internal peer, 2480 the receiving BGP speaker shall not re-distribute the routing 2481 information contained in that UPDATE message to other internal peers, 2482 unless the speaker acts as a BGP Route Reflector [11]. 2484 As part of Phase 3 of the route selection process, the BGP speaker 2485 has updated its Adj-RIBs-Out. All newly installed routes and all 2486 newly unfeasible routes for which there is no replacement route shall 2487 be advertised to its peers by means of an UPDATE message. 2489 RFC DRAFT January 2002 2491 A BGP speaker should not advertise a given feasible BGP route from 2492 its Adj-RIB-Out if it would produce an UPDATE message containing the 2493 same BGP route as was previously advertised. 2495 Any routes in the Loc-RIB marked as unfeasible shall be removed. 2496 Changes to the reachable destinations within its own autonomous 2497 system shall also be advertised in an UPDATE message. 2499 9.2.1 Controlling Routing Traffic Overhead 2501 The BGP protocol constrains the amount of routing traffic (that is, 2502 UPDATE messages) in order to limit both the link bandwidth needed to 2503 advertise UPDATE messages and the processing power needed by the 2504 Decision Process to digest the information contained in the UPDATE 2505 messages. 2507 9.2.1.1 Frequency of Route Advertisement 2509 The parameter MinRouteAdvertisementInterval determines the minimum 2510 amount of time that must elapse between advertisement of routes to a 2511 particular destination from a single BGP speaker. This rate limiting 2512 procedure applies on a per-destination basis, although the value of 2513 MinRouteAdvertisementInterval is set on a per BGP peer basis. 2515 Two UPDATE messages sent from a single BGP speaker that advertise 2516 feasible routes to some common set of destinations received from 2517 external peers must be separated by at least 2518 MinRouteAdvertisementInterval. Clearly, this can only be achieved 2519 precisely by keeping a separate timer for each common set of 2520 destinations. This would be unwarranted overhead. Any technique which 2521 ensures that the interval between two UPDATE messages sent from a 2522 single BGP speaker that advertise feasible routes to some common set 2523 of destinations received from external peers will be at least 2524 MinRouteAdvertisementInterval, and will also ensure a constant upper 2525 bound on the interval is acceptable. 2527 Since fast convergence is needed within an autonomous system, this 2528 procedure does not apply for routes received from other internal 2529 peers. To avoid long-lived black holes, the procedure does not apply 2530 to the explicit withdrawal of unfeasible routes (that is, routes 2531 whose destinations (expressed as IP prefixes) are listed in the 2532 WITHDRAWN ROUTES field of an UPDATE message). 2534 This procedure does not limit the rate of route selection, but only 2535 RFC DRAFT January 2002 2537 the rate of route advertisement. If new routes are selected multiple 2538 times while awaiting the expiration of MinRouteAdvertisementInterval, 2539 the last route selected shall be advertised at the end of 2540 MinRouteAdvertisementInterval. 2542 9.2.1.2 Frequency of Route Origination 2544 The parameter MinASOriginationInterval determines the minimum amount 2545 of time that must elapse between successive advertisements of UPDATE 2546 messages that report changes within the advertising BGP speaker's own 2547 autonomous systems. 2549 9.2.1.3 Jitter 2551 To minimize the likelihood that the distribution of BGP messages by a 2552 given BGP speaker will contain peaks, jitter should be applied to the 2553 timers associated with MinASOriginationInterval, Keepalive, and 2554 MinRouteAdvertisementInterval. A given BGP speaker shall apply the 2555 same jitter to each of these quantities regardless of the 2556 destinations to which the updates are being sent; that is, jitter 2557 will not be applied on a "per peer" basis. 2559 The amount of jitter to be introduced shall be determined by 2560 multiplying the base value of the appropriate timer by a random 2561 factor which is uniformly distributed in the range from 0.75 to 1.0. 2563 9.2.2 Efficient Organization of Routing Information 2565 Having selected the routing information which it will advertise, a 2566 BGP speaker may avail itself of several methods to organize this 2567 information in an efficient manner. 2569 9.2.2.1 Information Reduction 2571 Information reduction may imply a reduction in granularity of policy 2572 control - after information is collapsed, the same policies will 2573 apply to all destinations and paths in the equivalence class. 2575 The Decision Process may optionally reduce the amount of information 2576 that it will place in the Adj-RIBs-Out by any of the following 2577 RFC DRAFT January 2002 2579 methods: 2581 a) Network Layer Reachability Information (NLRI): 2583 Destination IP addresses can be represented as IP address 2584 prefixes. In cases where there is a correspondence between the 2585 address structure and the systems under control of an autonomous 2586 system administrator, it will be possible to reduce the size of 2587 the NLRI carried in the UPDATE messages. 2589 b) AS_PATHs: 2591 AS path information can be represented as ordered AS_SEQUENCEs or 2592 unordered AS_SETs. AS_SETs are used in the route aggregation 2593 algorithm described in 9.2.2.2. They reduce the size of the 2594 AS_PATH information by listing each AS number only once, 2595 regardless of how many times it may have appeared in multiple 2596 AS_PATHs that were aggregated. 2598 An AS_SET implies that the destinations listed in the NLRI can be 2599 reached through paths that traverse at least some of the 2600 constituent autonomous systems. AS_SETs provide sufficient 2601 information to avoid routing information looping; however their 2602 use may prune potentially feasible paths, since such paths are no 2603 longer listed individually as in the form of AS_SEQUENCEs. In 2604 practice this is not likely to be a problem, since once an IP 2605 packet arrives at the edge of a group of autonomous systems, the 2606 BGP speaker at that point is likely to have more detailed path 2607 information and can distinguish individual paths to destinations. 2609 9.2.2.2 Aggregating Routing Information 2611 Aggregation is the process of combining the characteristics of 2612 several different routes in such a way that a single route can be 2613 advertised. Aggregation can occur as part of the decision process to 2614 reduce the amount of routing information that will be placed in the 2615 Adj-RIBs-Out. 2617 Aggregation reduces the amount of information that a BGP speaker must 2618 store and exchange with other BGP speakers. Routes can be aggregated 2619 by applying the following procedure separately to path attributes of 2620 like type and to the Network Layer Reachability Information. 2622 Routes that have the following attributes shall not be aggregated 2623 unless the corresponding attributes of each route are identical: 2624 MULTI_EXIT_DISC, NEXT_HOP. 2626 RFC DRAFT January 2002 2628 If the aggregation occurs as part of the update process, routes with 2629 different NEXT_HOP values can be aggregated when announced through an 2630 external BGP session. 2632 Path attributes that have different type codes can not be aggregated 2633 together. Path attributes of the same type code may be aggregated, 2634 according to the following rules: 2636 ORIGIN attribute: If at least one route among routes that are 2637 aggregated has ORIGIN with the value INCOMPLETE, then the 2638 aggregated route must have the ORIGIN attribute with the value 2639 INCOMPLETE. Otherwise, if at least one route among routes that 2640 are aggregated has ORIGIN with the value EGP, then the aggregated 2641 route must have the origin attribute with the value EGP. In all 2642 other case the value of the ORIGIN attribute of the aggregated 2643 route is IGP. 2645 AS_PATH attribute: If routes to be aggregated have identical 2646 AS_PATH attributes, then the aggregated route has the same AS_PATH 2647 attribute as each individual route. 2649 For the purpose of aggregating AS_PATH attributes we model each AS 2650 within the AS_PATH attribute as a tuple , where 2651 "type" identifies a type of the path segment the AS belongs to 2652 (e.g. AS_SEQUENCE, AS_SET), and "value" is the AS number. If the 2653 routes to be aggregated have different AS_PATH attributes, then 2654 the aggregated AS_PATH attribute shall satisfy all of the 2655 following conditions: 2657 - all tuples of type AS_SEQUENCE in the aggregated AS_PATH 2658 shall appear in all of the AS_PATH in the initial set of routes 2659 to be aggregated. 2661 - all tuples of type AS_SET in the aggregated AS_PATH shall 2662 appear in at least one of the AS_PATH in the initial set (they 2663 may appear as either AS_SET or AS_SEQUENCE types). 2665 - for any tuple X of type AS_SEQUENCE in the aggregated AS_PATH 2666 which precedes tuple Y in the aggregated AS_PATH, X precedes Y 2667 in each AS_PATH in the initial set which contains Y, regardless 2668 of the type of Y. 2670 - No tuple of type AS_SET with the same value shall appear more 2671 than once in the aggregated AS_PATH. 2673 - Multiple tuples of type AS_SEQUENCE with the same value may 2674 appear in the aggregated AS_PATH only when adjacent to another 2675 tuple of the same type and value. 2677 RFC DRAFT January 2002 2679 An implementation may choose any algorithm which conforms to these 2680 rules. At a minimum a conformant implementation shall be able to 2681 perform the following algorithm that meets all of the above 2682 conditions: 2684 - determine the longest leading sequence of tuples (as defined 2685 above) common to all the AS_PATH attributes of the routes to be 2686 aggregated. Make this sequence the leading sequence of the 2687 aggregated AS_PATH attribute. 2689 - set the type of the rest of the tuples from the AS_PATH 2690 attributes of the routes to be aggregated to AS_SET, and append 2691 them to the aggregated AS_PATH attribute. 2693 - if the aggregated AS_PATH has more than one tuple with the 2694 same value (regardless of tuple's type), eliminate all, but one 2695 such tuple by deleting tuples of the type AS_SET from the 2696 aggregated AS_PATH attribute. 2698 Appendix 6, section 6.8 presents another algorithm that satisfies 2699 the conditions and allows for more complex policy configurations. 2701 ATOMIC_AGGREGATE: If at least one of the routes to be aggregated 2702 has ATOMIC_AGGREGATE path attribute, then the aggregated route 2703 shall have this attribute as well. 2705 AGGREGATOR: All AGGREGATOR attributes of all routes to be 2706 aggregated should be ignored. The BGP speaker performing the route 2707 aggregation may attach a new AGGREGATOR attribute (see Section 2708 5.1.7). 2710 9.3 Route Selection Criteria 2712 Generally speaking, additional rules for comparing routes among 2713 several alternatives are outside the scope of this document. There 2714 are two exceptions: 2716 - If the local AS appears in the AS path of the new route being 2717 considered, then that new route cannot be viewed as better than 2718 any other route (provided that the speaker is configured to accept 2719 such routes). If such a route were ever used, a routing loop could 2720 result (see Section 6.3). 2722 - In order to achieve successful distributed operation, only 2723 routes with a likelihood of stability can be chosen. Thus, an AS 2724 must avoid using unstable routes, and it must not make rapid 2725 RFC DRAFT January 2002 2727 spontaneous changes to its choice of route. Quantifying the terms 2728 "unstable" and "rapid" in the previous sentence will require 2729 experience, but the principle is clear. 2731 Care must be taken to ensure that BGP speakers in the same AS do 2732 not make inconsistent decisions. 2734 9.4 Originating BGP routes 2736 A BGP speaker may originate BGP routes by injecting routing 2737 information acquired by some other means (e.g. via an IGP) into BGP. 2738 A BGP speaker that originates BGP routes shall assign the degree of 2739 preference to these routes by passing them through the Decision 2740 Process (see Section 9.1). These routes may also be distributed to 2741 other BGP speakers within the local AS as part of the update process 2742 (see Section 9.2). The decision whether to distribute non-BGP 2743 acquired routes within an AS via BGP or not depends on the 2744 environment within the AS (e.g. type of IGP) and should be controlled 2745 via configuration. 2747 Appendix 1. Comparison with RFC1771 2749 There are numerous editorial changes (too many to list here). 2751 The following list the technical changes: 2753 Changes to reflect the usages of such features as TCP MD5 [10], 2754 BGP Route Reflectors [11], BGP Confederations [13], and BGP Route 2755 Refresh [12]. 2757 Clarification on the use of the BGP Identifier in the AGGREGATOR 2758 attribute. 2760 Procedures for imposing an upper bound on the number of prefixes 2761 that a BGP speaker would accept from a peer. 2763 The ability of a BGP speaker to include more than one instance of 2764 its own AS in the AS_PATH attribute for the purpose of inter-AS 2765 traffic engineering. 2767 Clarifications on the various types of NEXT_HOPs. 2769 RFC DRAFT January 2002 2771 Clarifications to the use of the ATOMIC_AGGREGATE attribute. 2773 The relationship between the immediate next hop, and the next hop 2774 as specified in the NEXT_HOP path attribute. 2776 Clarifications on the tie-breaking procedures. 2778 Appendix 2. Comparison with RFC1267 2780 All the changes listed in Appendix 1, plus the following. 2782 BGP-4 is capable of operating in an environment where a set of 2783 reachable destinations may be expressed via a single IP prefix. The 2784 concept of network classes, or subnetting is foreign to BGP-4. To 2785 accommodate these capabilities BGP-4 changes semantics and encoding 2786 associated with the AS_PATH attribute. New text has been added to 2787 define semantics associated with IP prefixes. These abilities allow 2788 BGP-4 to support the proposed supernetting scheme [9]. 2790 To simplify configuration this version introduces a new attribute, 2791 LOCAL_PREF, that facilitates route selection procedures. 2793 The INTER_AS_METRIC attribute has been renamed to be MULTI_EXIT_DISC. 2794 A new attribute, ATOMIC_AGGREGATE, has been introduced to insure that 2795 certain aggregates are not de-aggregated. Another new attribute, 2796 AGGREGATOR, can be added to aggregate routes in order to advertise 2797 which AS and which BGP speaker within that AS caused the aggregation. 2799 To insure that Hold Timers are symmetric, the Hold Time is now 2800 negotiated on a per-connection basis. Hold Times of zero are now 2801 supported. 2803 Appendix 3. Comparison with RFC 1163 2805 All of the changes listed in Appendices 1 and 2, plus the following. 2807 To detect and recover from BGP connection collision, a new field (BGP 2808 Identifier) has been added to the OPEN message. New text (Section 2809 6.8) has been added to specify the procedure for detecting and 2810 recovering from collision. 2812 The new document no longer restricts the border router that is passed 2813 in the NEXT_HOP path attribute to be part of the same Autonomous 2814 System as the BGP Speaker. 2816 RFC DRAFT January 2002 2818 New document optimizes and simplifies the exchange of the information 2819 about previously reachable routes. 2821 Appendix 4. Comparison with RFC 1105 2823 All of the changes listed in Appendices 1, 2 and 3, plus the 2824 following. 2826 Minor changes to the RFC1105 Finite State Machine were necessary to 2827 accommodate the TCP user interface provided by 4.3 BSD. 2829 The notion of Up/Down/Horizontal relations present in RFC1105 has 2830 been removed from the protocol. 2832 The changes in the message format from RFC1105 are as follows: 2834 1. The Hold Time field has been removed from the BGP header and 2835 added to the OPEN message. 2837 2. The version field has been removed from the BGP header and 2838 added to the OPEN message. 2840 3. The Link Type field has been removed from the OPEN message. 2842 4. The OPEN CONFIRM message has been eliminated and replaced with 2843 implicit confirmation provided by the KEEPALIVE message. 2845 5. The format of the UPDATE message has been changed 2846 significantly. New fields were added to the UPDATE message to 2847 support multiple path attributes. 2849 6. The Marker field has been expanded and its role broadened to 2850 support authentication. 2852 Note that quite often BGP, as specified in RFC 1105, is referred 2853 to as BGP-1, BGP, as specified in RFC 1163, is referred to as 2854 BGP-2, BGP, as specified in RFC1267 is referred to as BGP-3, and 2855 BGP, as specified in this document is referred to as BGP-4. 2857 Appendix 5. TCP options that may be used with BGP 2859 If a local system TCP user interface supports TCP PUSH function, then 2860 each BGP message should be transmitted with PUSH flag set. Setting 2861 PUSH flag forces BGP messages to be transmitted promptly to the 2862 RFC DRAFT January 2002 2864 receiver. 2866 If a local system TCP user interface supports setting precedence for 2867 TCP connection, then the BGP transport connection should be opened 2868 with precedence set to Internetwork Control (110) value (see also 2869 [6]). 2871 A local system may protect its BGP sessions by using the TCP MD5 2872 Signature Option [10]. 2874 Appendix 6. Implementation Recommendations 2876 This section presents some implementation recommendations. 2878 6.1 Multiple Networks Per Message 2880 The BGP protocol allows for multiple address prefixes with the same 2881 path attributes to be specified in one message. Making use of this 2882 capability is highly recommended. With one address prefix per message 2883 there is a substantial increase in overhead in the receiver. Not only 2884 does the system overhead increase due to the reception of multiple 2885 messages, but the overhead of scanning the routing table for updates 2886 to BGP peers and other routing protocols (and sending the associated 2887 messages) is incurred multiple times as well. 2889 One method of building messages containing many address prefixes per 2890 a path attribute set from a routing table that is not organized on a 2891 per path attribute set basis is to build many messages as the routing 2892 table is scanned. As each address prefix is processed, a message for 2893 the associated set of path attributes is allocated, if it does not 2894 exist, and the new address prefix is added to it. If such a message 2895 exists, the new address prefix is just appended to it. If the message 2896 lacks the space to hold the new address prefix, it is transmitted, a 2897 new message is allocated, and the new address prefix is inserted into 2898 the new message. When the entire routing table has been scanned, all 2899 allocated messages are sent and their resources released. Maximum 2900 compression is achieved when all the destinations covered by the 2901 address prefixes share a common set of path attributes making it 2902 possible to send many address prefixes in one 4096-byte message. 2904 When peering with a BGP implementation that does not compress 2905 multiple address prefixes into one message, it may be necessary to 2906 take steps to reduce the overhead from the flood of data received 2907 when a peer is acquired or a significant network topology change 2908 RFC DRAFT January 2002 2910 occurs. One method of doing this is to limit the rate of updates. 2911 This will eliminate the redundant scanning of the routing table to 2912 provide flash updates for BGP peers and other routing protocols. A 2913 disadvantage of this approach is that it increases the propagation 2914 latency of routing information. By choosing a minimum flash update 2915 interval that is not much greater than the time it takes to process 2916 the multiple messages this latency should be minimized. A better 2917 method would be to read all received messages before sending updates. 2919 6.2 Processing Messages on a Stream Protocol 2921 BGP uses TCP as a transport mechanism. Due to the stream nature of 2922 TCP, all the data for received messages does not necessarily arrive 2923 at the same time. This can make it difficult to process the data as 2924 messages, especially on systems such as BSD Unix where it is not 2925 possible to determine how much data has been received but not yet 2926 processed. 2928 One method that can be used in this situation is to first try to read 2929 just the message header. For the KEEPALIVE message type, this is a 2930 complete message; for other message types, the header should first be 2931 verified, in particular the total length. If all checks are 2932 successful, the specified length, minus the size of the message 2933 header is the amount of data left to read. An implementation that 2934 would "hang" the routing information process while trying to read 2935 from a peer could set up a message buffer (4096 bytes) per peer and 2936 fill it with data as available until a complete message has been 2937 received. 2939 6.3 Reducing route flapping 2941 To avoid excessive route flapping a BGP speaker which needs to 2942 withdraw a destination and send an update about a more specific or 2943 less specific route SHOULD combine them into the same UPDATE message. 2945 6.4 BGP Timers 2947 BGP employs five timers: ConnectRetry, Hold Time, KeepAlive, 2948 MinASOriginationInterval, and MinRouteAdvertisementInterval The 2949 suggested value for the ConnectRetry timer is 120 seconds. The 2950 suggested value for the Hold Time is 90 seconds. The suggested value 2951 for the KeepAlive timer is 1/3 of the Hold Time. The suggested value 2952 RFC DRAFT January 2002 2954 for the MinASOriginationInterval is 15 seconds. The suggested value 2955 for the MinRouteAdvertisementInterval is 30 seconds. 2957 An implementation of BGP MUST allow the Hold Time timer to be 2958 configurable, and MAY allow the other timers to be configurable. 2960 6.5 Path attribute ordering 2962 Implementations which combine update messages as described above in 2963 6.1 may prefer to see all path attributes presented in a known order. 2964 This permits them to quickly identify sets of attributes from 2965 different update messages which are semantically identical. To 2966 facilitate this, it is a useful optimization to order the path 2967 attributes according to type code. This optimization is entirely 2968 optional. 2970 6.6 AS_SET sorting 2972 Another useful optimization that can be done to simplify this 2973 situation is to sort the AS numbers found in an AS_SET. This 2974 optimization is entirely optional. 2976 6.7 Control over version negotiation 2978 Since BGP-4 is capable of carrying aggregated routes which cannot be 2979 properly represented in BGP-3, an implementation which supports BGP-4 2980 and another BGP version should provide the capability to only speak 2981 BGP-4 on a per-peer basis. 2983 6.8 Complex AS_PATH aggregation 2985 An implementation which chooses to provide a path aggregation 2986 algorithm which retains significant amounts of path information may 2987 wish to use the following procedure: 2989 For the purpose of aggregating AS_PATH attributes of two routes, 2990 we model each AS as a tuple , where "type" identifies 2991 a type of the path segment the AS belongs to (e.g. AS_SEQUENCE, 2992 AS_SET), and "value" is the AS number. Two ASs are said to be the 2993 RFC DRAFT January 2002 2995 same if their corresponding tuples are the same. 2997 The algorithm to aggregate two AS_PATH attributes works as 2998 follows: 3000 a) Identify the same ASs (as defined above) within each AS_PATH 3001 attribute that are in the same relative order within both 3002 AS_PATH attributes. Two ASs, X and Y, are said to be in the 3003 same order if either: 3004 - X precedes Y in both AS_PATH attributes, or - Y precedes X 3005 in both AS_PATH attributes. 3007 b) The aggregated AS_PATH attribute consists of ASs identified 3008 in (a) in exactly the same order as they appear in the AS_PATH 3009 attributes to be aggregated. If two consecutive ASs identified 3010 in (a) do not immediately follow each other in both of the 3011 AS_PATH attributes to be aggregated, then the intervening ASs 3012 (ASs that are between the two consecutive ASs that are the 3013 same) in both attributes are combined into an AS_SET path 3014 segment that consists of the intervening ASs from both AS_PATH 3015 attributes; this segment is then placed in between the two 3016 consecutive ASs identified in (a) of the aggregated attribute. 3017 If two consecutive ASs identified in (a) immediately follow 3018 each other in one attribute, but do not follow in another, then 3019 the intervening ASs of the latter are combined into an AS_SET 3020 path segment; this segment is then placed in between the two 3021 consecutive ASs identified in (a) of the aggregated attribute. 3023 If as a result of the above procedure a given AS number appears 3024 more than once within the aggregated AS_PATH attribute, all, but 3025 the last instance (rightmost occurrence) of that AS number should 3026 be removed from the aggregated AS_PATH attribute. 3028 Security Considerations 3030 BGP supports the ability to authenticate BGP messages by using BGP 3031 authentication. The authentication could be done on a per peer basis. 3032 In addition, BGP supports the ability to authenticate its data stream 3033 by using [10]. This authentication could be done on a per peer basis. 3034 Finally, BGP could also use IPSec to authenticate its data stream. 3035 Among the mechanisms mentioned in this paragraph, [10] is the most 3036 widely deployed. 3038 RFC DRAFT January 2002 3040 References 3042 [1] Mills, D., "Exterior Gateway Protocol Formal Specification", 3043 RFC904, April 1984. 3045 [2] Rekhter, Y., "EGP and Policy Based Routing in the New NSFNET 3046 Backbone", RFC1092, February 1989. 3048 [3] Braun, H-W., "The NSFNET Routing Architecture", RFC1093, February 3049 1989. 3051 [4] Postel, J., "Transmission Control Protocol - DARPA Internet 3052 Program Protocol Specification", RFC793, September 1981. 3054 [5] Rekhter, Y., and P. Gross, "Application of the Border Gateway 3055 Protocol in the Internet", RFC1772, March 1995. 3057 [6] Postel, J., "Internet Protocol - DARPA Internet Program Protocol 3058 Specification", RFC791, September 1981. 3060 [7] "Information Processing Systems - Telecommunications and 3061 Information Exchange between Systems - Protocol for Exchange of 3062 Inter-domain Routeing Information among Intermediate Systems to 3063 Support Forwarding of ISO 8473 PDUs", ISO/IEC IS10747, 1993 3065 [8] Fuller, V., Li, T., Yu, J., and Varadhan, K., ""Classless Inter- 3066 Domain Routing (CIDR): an Address Assignment and Aggregation 3067 Strategy", RFC1519, September 1993. 3069 [9] Rekhter, Y., Li, T., "An Architecture for IP Address Allocation 3070 with CIDR", RFC 1518, September 1993. 3072 [10] Heffernan, A., "Protection of BGP Sessions via the TCP MD5 3073 Signature Option", RFC2385, August 1998. 3075 [11] Bates, T., Chandra, R., Chen, E., "BGP Route Reflection - An 3076 Alternative to Full Mesh IBGP", RFC2796, April 2000. 3078 [12] Chen, E., "Route Refresh Capability for BGP-4", RFC2918, 3079 September 2000. 3081 [13] Traina, P, McPherson, D., Scudder, J., "Autonomous System 3082 Confederations for BGP", RFC3065, February 2001. 3084 RFC DRAFT January 2002 3086 Editors' Addresses 3088 Yakov Rekhter 3089 Juniper Networks 3090 1194 N. Mathilda Avenue 3091 Sunnyvale, CA 94089 3092 email: yakov@juniper.net 3094 Tony Li 3095 Procket Networks 3096 1100 Cadillac Ct. 3097 Milpitas, CA 95035 3098 Email: tli@procket.com