idnits 2.17.1 draft-ietf-idr-bgp4-04.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** Cannot find the required boilerplate sections (Copyright, IPR, etc.) in this document. Expected boilerplate is as follows today (2024-04-26) according to https://trustee.ietf.org/license-info : IETF Trust Legal Provisions of 28-dec-2009, Section 6.a: This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. IETF Trust Legal Provisions of 28-dec-2009, Section 6.b(i), paragraph 2: Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved. IETF Trust Legal Provisions of 28-dec-2009, Section 6.b(i), paragraph 3: This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- ** Missing expiration date. The document expiration date should appear on the first and last page. ** The document seems to lack a 1id_guidelines paragraph about Internet-Drafts being working documents. ** The document seems to lack a 1id_guidelines paragraph about 6 months document validity. ** The document seems to lack a 1id_guidelines paragraph about the list of current Internet-Drafts. ** The document seems to lack a 1id_guidelines paragraph about the list of Shadow Directories. ** 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 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 6 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 390: '...sage, a BGP speaker MUST calculate the...' RFC 2119 keyword, line 393: '... Hold Time MUST be either zero o...' RFC 2119 keyword, line 789: '... MUST NOT be sent more frequently th...' RFC 2119 keyword, line 790: '... tion MAY adjust the rate at which i...' RFC 2119 keyword, line 794: '... messages MUST NOT be sent....' (24 more instances...) Miscellaneous warnings: ---------------------------------------------------------------------------- == Line 726 has weird spacing: '... Length are t...' == Line 1173 has weird spacing: '...is less than...' == Line 1664 has weird spacing: '...s whose desti...' == Line 2068 has weird spacing: '...nations of th...' == Line 2236 has weird spacing: '...ecision proce...' == (2 more instances...) -- 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.) -- The document date (October 1996) is 10055 days in the past. Is this intentional? 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. '5' -- 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') Summary: 18 errors (**), 0 flaws (~~), 8 warnings (==), 4 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group Y. Rekhter 3 INTERNET DRAFT cisco Systems 4 T. Li 5 Juniper Networks 6 Editors 7 October 1996 9 A Border Gateway Protocol 4 (BGP-4) 11 Status of this Memo 13 This document, together with its companion document, "Application of 14 the Border Gateway Protocol in the Internet", define an inter- 15 autonomous system routing protocol for the Internet. This document 16 specifies an IAB standards track protocol for the Internet community, 17 and requests discussion and suggestions for improvements. Please 18 refer to the current edition of the "IAB Official Protocol Standards" 19 for the standardization state and status of this protocol. Distribu- 20 tion of this document is unlimited. 22 This document is an Internet Draft. Internet Drafts are working docu- 23 ments of the Internet Engineering Task Force (IETF), its Areas, and 24 its Working Groups. Note that other groups may also distribute work- 25 ing documents as Internet Drafts. 27 Internet Drafts are draft documents valid for a maximum of six 28 months. Internet Drafts may be updated, replaced, or obsoleted by 29 other documents at any time. It is not appropriate to use Internet 30 Drafts as reference material or to cite them other than as a "working 31 draft" or "work in progress". 33 1. Acknowledgments 35 This document was originally published as RFC 1267 in October 1991, 36 jointly authored by Kirk Lougheed and Yakov Rekhter. 38 We would like to express our thanks to Guy Almes, Len Bosack, and 39 Jeffrey C. Honig for their contributions to the earlier version of 40 this document. 42 We like to explicitly thank Bob Braden for the review of the earlier 43 version of this document as well as his constructive and valuable 44 comments. 46 RFC DRAFT October 1996 48 We would also like to thank Bob Hinden, Director for Routing of the 49 Internet Engineering Steering Group, and the team of reviewers he 50 assembled to review the previous version (BGP-2) of this document. 51 This team, consisting of Deborah Estrin, Milo Medin, John Moy, Radia 52 Perlman, Martha Steenstrup, Mike St. Johns, and Paul Tsuchiya, acted 53 with a strong combination of toughness, professionalism, and cour- 54 tesy. 56 This updated version of the document is the product of the IETF IDR 57 Working Group with Yakov Rekhter and Tony Li as editors. Certain sec- 58 tions of the document borrowed heavily from IDRP [7], which is the 59 OSI counterpart of BGP. For this credit should be given to the ANSI 60 X3S3.3 group chaired by Lyman Chapin and to Charles Kunzinger who was 61 the IDRP editor within that group. We would also like to thank Mike 62 Craren, Dimitry Haskin, John Krawczyk, David LeRoy, John Scudder, 63 Paul Traina, and Curtis Villamizar for their comments. 65 We would like to specially acknowledge numerous contributions by Den- 66 nis Ferguson. 68 2. Introduction 70 The Border Gateway Protocol (BGP) is an inter-Autonomous System rout- 71 ing protocol. It is built on experience gained with EGP as defined 72 in RFC 904 [1] and EGP usage in the NSFNET Backbone as described in 73 RFC 1092 [2] and RFC 1093 [3]. 75 The primary function of a BGP speaking system is to exchange network 76 reachability information with other BGP systems. This network reach- 77 ability information includes information on the list of Autonomous 78 Systems (ASs) that reachability information traverses. This informa- 79 tion is sufficient to construct a graph of AS connectivity from which 80 routing loops may be pruned and some policy decisions at the AS level 81 may be enforced. 83 BGP-4 provides a new set of mechanisms for supporting classless 84 interdomain routing. These mechanisms include support for advertis- 85 ing an IP prefix and eliminates the concept of network "class" within 86 BGP. BGP-4 also introduces mechanisms which allow aggregation of 87 routes, including aggregation of AS paths. These changes provide 88 support for the proposed supernetting scheme [8, 9]. 90 To characterize the set of policy decisions that can be enforced 91 using BGP, one must focus on the rule that a BGP speaker advertise to 92 its peers (other BGP speakers which it communicates with) in neigh- 93 boring ASs only those routes that it itself uses. This rule reflects 94 the "hop-by-hop" routing paradigm generally used throughout the 96 RFC DRAFT October 1996 98 current Internet. Note that some policies cannot be supported by the 99 "hop-by-hop" routing paradigm and thus require techniques such as 100 source routing to enforce. For example, BGP does not enable one AS 101 to send traffic to a neighboring AS intending that the traffic take a 102 different route from that taken by traffic originating in the neigh- 103 boring AS. On the other hand, BGP can support any policy conforming 104 to the "hop-by-hop" routing paradigm. Since the current Internet 105 uses only the "hop-by-hop" routing paradigm and since BGP can support 106 any policy that conforms to that paradigm, BGP is highly applicable 107 as an inter-AS routing protocol for the current Internet. 109 A more complete discussion of what policies can and cannot be 110 enforced with BGP is outside the scope of this document (but refer to 111 the companion document discussing BGP usage [5]). 113 BGP runs over a reliable transport protocol. This eliminates the 114 need to implement explicit update fragmentation, retransmission, 115 acknowledgment, and sequencing. Any authentication scheme used by 116 the transport protocol may be used in addition to BGP's own authenti- 117 cation mechanisms. The error notification mechanism used in BGP 118 assumes that the transport protocol supports a "graceful" close, 119 i.e., that all outstanding data will be delivered before the connec- 120 tion is closed. 122 BGP uses TCP [4] as its transport protocol. TCP meets BGP's trans- 123 port requirements and is present in virtually all commercial routers 124 and hosts. In the following descriptions the phrase "transport pro- 125 tocol connection" can be understood to refer to a TCP connection. 126 BGP uses TCP port 179 for establishing its connections. 128 This document uses the term `Autonomous System' (AS) throughout. The 129 classic definition of an Autonomous System is a set of routers under 130 a single technical administration, using an interior gateway protocol 131 and common metrics to route packets within the AS, and using an exte- 132 rior gateway protocol to route packets to other ASs. Since this 133 classic definition was developed, it has become common for a single 134 AS to use several interior gateway protocols and sometimes several 135 sets of metrics within an AS. The use of the term Autonomous System 136 here stresses the fact that, even when multiple IGPs and metrics are 137 used, the administration of an AS appears to other ASs to have a sin- 138 gle coherent interior routing plan and presents a consistent picture 139 of what destinations are reachable through it. 141 The planned use of BGP in the Internet environment, including such 142 issues as topology, the interaction between BGP and IGPs, and the 143 enforcement of routing policy rules is presented in a companion docu- 144 ment [5]. This document is the first of a series of documents 145 planned to explore various aspects of BGP application. Please send 147 RFC DRAFT October 1996 149 comments to the BGP mailing list (bgp@ans.net). 151 3. Summary of Operation 153 Two systems form a transport protocol connection between one another. 154 They exchange messages to open and confirm the connection parameters. 155 The initial data flow is the entire BGP routing table. Incremental 156 updates are sent as the routing tables change. BGP does not require 157 periodic refresh of the entire BGP routing table. Therefore, a BGP 158 speaker must retain the current version of the entire BGP routing 159 tables of all of its peers for the duration of the connection. 160 KeepAlive messages are sent periodically to ensure the liveness of 161 the connection. Notification messages are sent in response to errors 162 or special conditions. If a connection encounters an error condi- 163 tion, a notification message is sent and the connection is closed. 165 The hosts executing the Border Gateway Protocol need not be routers. 166 A non-routing host could exchange routing information with routers 167 via EGP or even an interior routing protocol. That non-routing host 168 could then use BGP to exchange routing information with a border 169 router in another Autonomous System. The implications and applica- 170 tions of this architecture are for further study. 172 Connections between BGP speakers of different ASs are referred to as 173 "external" links. BGP connections between BGP speakers within the 174 same AS are referred to as "internal" links. Similarly, a peer in a 175 different AS is referred to as an external peer, while a peer in the 176 same AS may be described as an internal peer. Internal BGP and 177 external BGP are commonly abbreviated IBGP and EBGP. 179 If a particular AS has multiple BGP speakers and is providing transit 180 service for other ASs, then care must be taken to ensure a consistent 181 view of routing within the AS. A consistent view of the interior 182 routes of the AS is provided by the interior routing protocol. A 183 consistent view of the routes exterior to the AS can be provided by 184 having all BGP speakers within the AS maintain direct IBGP connec- 185 tions with each other. Alternately the interior routing protocol can 186 pass BGP information among routers within an AS, taking care not to 187 lose BGP attributes that will be needed by EBGP speakers if transit 188 connectivity is being provided. For the purpose of discussion, it is 189 assumed that BGP information is passed within an AS using IBGP. Care 190 must be taken to ensure that the interior routers have all been 191 updated with transit information before the EBGP speakers announce to 192 other ASs that transit service is being provided. 194 RFC DRAFT October 1996 196 3.1 Routes: Advertisement and Storage 198 For purposes of this protocol a route is defined as a unit of infor- 199 mation that pairs a destination with the attributes of a path to that 200 destination: 202 - Routes are advertised between a pair of BGP speakers in UPDATE 203 messages: the destination is the systems whose IP addresses are 204 reported in the Network Layer Reachability Information (NLRI) 205 field, and the the path is the information reported in the path 206 attributes fields of the same UPDATE message. 208 - Routes are stored in the Routing Information Bases (RIBs): 209 namely, the Adj-RIBs-In, the Loc-RIB, and the Adj-RIBs-Out. Routes 210 that will be advertised to other BGP speakers must be present in 211 the Adj-RIB-Out; routes that will be used by the local BGP speaker 212 must be present in the Loc-RIB, and the next hop for each of these 213 routes must be present in the local BGP speaker's forwarding 214 information base; and routes that are received from other BGP 215 speakers are present in the Adj-RIBs-In. 217 If a BGP speaker chooses to advertise the route, it may add to or 218 modify the path attributes of the route before advertising it to a 219 peer. 221 BGP provides mechanisms by which a BGP speaker can inform its peer 222 that a previously advertised route is no longer available for use. 223 There are three methods by which a given BGP speaker can indicate 224 that a route has been withdrawn from service: 226 a) the IP prefix that expresses destinations for a previously 227 advertised route can be advertised in the WITHDRAWN ROUTES field 228 in the UPDATE message, thus marking the associated route as being 229 no longer available for use 231 b) a replacement route with the same Network Layer Reachability 232 Information can be advertised, or 234 c) the BGP speaker - BGP speaker connection can be closed, which 235 implicitly removes from service all routes which the pair of 236 speakers had advertised to each other. 238 RFC DRAFT October 1996 240 3.2 Routing Information Bases 242 The Routing Information Base (RIB) within a BGP speaker consists of 243 three distinct parts: 245 a) Adj-RIBs-In: The Adj-RIBs-In store routing information that has 246 been learned from inbound UPDATE messages. Their contents repre- 247 sent routes that are available as an input to the Decision Pro- 248 cess. 250 b) Loc-RIB: The Loc-RIB contains the local routing information 251 that the BGP speaker has selected by applying its local policies 252 to the routing information contained in its Adj-RIBs-In. 254 c) Adj-RIBs-Out: The Adj-RIBs-Out store the information that the 255 local BGP speaker has selected for advertisement to its peers. The 256 routing information stored in the Adj-RIBs-Out will be carried in 257 the local BGP speaker's UPDATE messages and advertised to its 258 peers. 260 In summary, the Adj-RIBs-In contain unprocessed routing information 261 that has been advertised to the local BGP speaker by its peers; the 262 Loc-RIB contains the routes that have been selected by the local BGP 263 speaker's Decision Process; and the Adj-RIBs-Out organize the routes 264 for advertisement to specific peers by means of the local speaker's 265 UPDATE messages. 267 Although the conceptual model distinguishes between Adj-RIBs-In, Loc- 268 RIB, and Adj-RIBs-Out, this neither implies nor requires that an 269 implementation must maintain three separate copies of the routing 270 information. The choice of implementation (for example, 3 copies of 271 the information vs 1 copy with pointers) is not constrained by the 272 protocol. 274 4. Message Formats 276 This section describes message formats used by BGP. 278 Messages are sent over a reliable transport protocol connection. A 279 message is processed only after it is entirely received. The maximum 280 message size is 4096 octets. All implementations are required to 281 support this maximum message size. The smallest message that may be 282 sent consists of a BGP header without a data portion, or 19 octets. 284 RFC DRAFT October 1996 286 4.1 Message Header Format 288 Each message has a fixed-size header. There may or may not be a data 289 portion following the header, depending on the message type. The 290 layout of these fields is shown below: 292 0 1 2 3 293 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 294 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 295 | | 296 + + 297 | | 298 + + 299 | Marker | 300 + + 301 | | 302 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 303 | Length | Type | 304 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 306 Marker: 308 This 16-octet field contains a value that the receiver of the 309 message can predict. If the Type of the message is OPEN, or if 310 the OPEN message carries no Authentication Information (as an 311 Optional Parameter), then the Marker must be all ones. Other- 312 wise, the value of the marker can be predicted by some a compu- 313 tation specified as part of the authentication mechanism (which 314 is specified as part of the Authentication Information) used. 315 The Marker can be used to detect loss of synchronization 316 between a pair of BGP peers, and to authenticate incoming BGP 317 messages. 319 Length: 321 This 2-octet unsigned integer indicates the total length of the 322 message, including the header, in octets. Thus, e.g., it 323 allows one to locate in the transport-level stream the (Marker 324 field of the) next message. The value of the Length field must 326 RFC DRAFT October 1996 328 always be at least 19 and no greater than 4096, and may be fur- 329 ther constrained, depending on the message type. No "padding" 330 of extra data after the message is allowed, so the Length field 331 must have the smallest value required given the rest of the 332 message. 334 Type: 336 This 1-octet unsigned integer indicates the type code of the 337 message. The following type codes are defined: 339 1 - OPEN 340 2 - UPDATE 341 3 - NOTIFICATION 342 4 - KEEPALIVE 344 4.2 OPEN Message Format 346 After a transport protocol connection is established, the first mes- 347 sage sent by each side is an OPEN message. If the OPEN message is 348 acceptable, a KEEPALIVE message confirming the OPEN is sent back. 349 Once the OPEN is confirmed, UPDATE, KEEPALIVE, and NOTIFICATION mes- 350 sages may be exchanged. 352 In addition to the fixed-size BGP header, the OPEN message contains 353 the following fields: 355 0 1 2 3 356 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 357 +-+-+-+-+-+-+-+-+ 358 | Version | 359 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 360 | My Autonomous System | 361 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 362 | Hold Time | 363 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 364 | BGP Identifier | 365 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 366 | Opt Parm Len | 367 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 368 | | 369 | Optional Parameters | 370 | | 372 RFC DRAFT October 1996 374 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 376 Version: 378 This 1-octet unsigned integer indicates the protocol version 379 number of the message. The current BGP version number is 4. 381 My Autonomous System: 383 This 2-octet unsigned integer indicates the Autonomous System 384 number of the sender. 386 Hold Time: 388 This 2-octet unsigned integer indicates the number of seconds 389 that the sender proposes for the value of the Hold Timer. Upon 390 receipt of an OPEN message, a BGP speaker MUST calculate the 391 value of the Hold Timer by using the smaller of its configured 392 Hold Time and the Hold Time received in the OPEN message. The 393 Hold Time MUST be either zero or at least three seconds. An 394 implementation may reject connections on the basis of the Hold 395 Time. The calculated value indicates the maximum number of 396 seconds that may elapse between the receipt of successive 397 KEEPALIVE, and/or UPDATE messages by the sender. 399 BGP Identifier: 400 This 4-octet unsigned integer indicates the BGP Identifier of 401 the sender. A given BGP speaker sets the value of its BGP Iden- 402 tifier to an IP address assigned to that BGP speaker. The 403 value of the BGP Identifier is determined on startup and is the 404 same for every local interface and every BGP peer. 406 Optional Parameters Length: 408 This 1-octet unsigned integer indicates the total length of the 409 Optional Parameters field in octets. If the value of this field 410 is zero, no Optional Parameters are present. 412 Optional Parameters: 414 This field may contain a list of optional parameters, where 415 each parameter is encoded as a triplet. 418 RFC DRAFT October 1996 420 0 1 421 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 422 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-... 423 | Parm. Type | Parm. Length | Parameter Value (variable) 424 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-... 426 Parameter Type is a one octet field that unambiguously identi- 427 fies individual parameters. Parameter Length is a one octet 428 field that contains the length of the Parameter Value field in 429 octets. Parameter Value is a variable length field that is 430 interpreted according to the value of the Parameter Type field. 432 This document defines the following Optional Parameters: 434 a) Authentication Information (Parameter Type 1): 436 This optional parameter may be used to authenticate a BGP 437 peer. The Parameter Value field contains a 1-octet Authenti- 438 cation Code followed by a variable length Authentication 439 Data. 441 0 1 2 3 4 5 6 7 8 442 +-+-+-+-+-+-+-+-+ 443 | Auth. Code | 444 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 445 | | 446 | Authentication Data | 447 | | 448 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 450 Authentication Code: 452 This 1-octet unsigned integer indicates the authenti- 453 cation mechanism being used. Whenever an authentica- 454 tion mechanism is specified for use within BGP, three 455 things must be included in the specification: 456 - the value of the Authentication Code which indicates 457 use of the mechanism, 458 - the form and meaning of the Authentication Data, and 459 - the algorithm for computing values of Marker fields. 461 Note that a separate authentication mechanism may be 462 used in establishing the transport level connection. 464 RFC DRAFT October 1996 466 Authentication Data: 468 The form and meaning of this field is a variable- 469 length field depend on the Authentication Code. 471 The minimum length of the OPEN message is 29 octets (including 472 message header). 474 4.3 UPDATE Message Format 476 UPDATE messages are used to transfer routing information between BGP 477 peers. The information in the UPDATE packet can be used to construct 478 a graph describing the relationships of the various Autonomous Sys- 479 tems. By applying rules to be discussed, routing information loops 480 and some other anomalies may be detected and removed from inter-AS 481 routing. 483 An UPDATE message is used to advertise a single feasible route to a 484 peer, or to withdraw multiple unfeasible routes from service (see 485 3.1). An UPDATE message may simultaneously advertise a feasible route 486 and withdraw multiple unfeasible routes from service. The UPDATE 487 message always includes the fixed-size BGP header, and can optionally 488 include the other fields as shown below: 490 +-----------------------------------------------------+ 491 | Unfeasible Routes Length (2 octets) | 492 +-----------------------------------------------------+ 493 | Withdrawn Routes (variable) | 494 +-----------------------------------------------------+ 495 | Total Path Attribute Length (2 octets) | 496 +-----------------------------------------------------+ 497 | Path Attributes (variable) | 498 +-----------------------------------------------------+ 499 | Network Layer Reachability Information (variable) | 500 +-----------------------------------------------------+ 502 Unfeasible Routes Length: 504 This 2-octets unsigned integer indicates the total length of 505 the Withdrawn Routes field in octets. Its value must allow the 506 length of the Network Layer Reachability Information field to 507 be determined as specified below. 509 RFC DRAFT October 1996 511 A value of 0 indicates that no routes are being withdrawn from 512 service, and that the WITHDRAWN ROUTES field is not present in 513 this UPDATE message. 515 Withdrawn Routes: 517 This is a variable length field that contains a list of IP 518 address prefixes for the routes that are being withdrawn from 519 service. Each IP address prefix is encoded as a 2-tuple of the 520 form , whose fields are described below: 522 +---------------------------+ 523 | Length (1 octet) | 524 +---------------------------+ 525 | Prefix (variable) | 526 +---------------------------+ 528 The use and the meaning of these fields are as follows: 530 a) Length: 532 The Length field indicates the length in bits of the IP 533 address prefix. A length of zero indicates a prefix that 534 matches all IP addresses (with prefix, itself, of zero 535 octets). 537 b) Prefix: 539 The Prefix field contains IP address prefixes followed by 540 enough trailing bits to make the end of the field fall on an 541 octet boundary. Note that the value of trailing bits is 542 irrelevant. 544 Total Path Attribute Length: 546 This 2-octet unsigned integer indicates the total length of the 547 Path Attributes field in octets. Its value must allow the 548 length of the Network Layer Reachability field to be determined 549 as specified below. 551 A value of 0 indicates that no Network Layer Reachability 552 Information field is present in this UPDATE message. 554 Path Attributes: 556 A variable length sequence of path attributes is present in 558 RFC DRAFT October 1996 560 every UPDATE. Each path attribute is a triple of variable length. 563 Attribute Type is a two-octet field that consists of the 564 Attribute Flags octet followed by the Attribute Type Code 565 octet. 567 0 1 568 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 569 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 570 | Attr. Flags |Attr. Type Code| 571 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 573 The high-order bit (bit 0) of the Attribute Flags octet is the 574 Optional bit. It defines whether the attribute is optional (if 575 set to 1) or well-known (if set to 0). 577 The second high-order bit (bit 1) of the Attribute Flags octet 578 is the Transitive bit. It defines whether an optional 579 attribute is transitive (if set to 1) or non-transitive (if set 580 to 0). For well-known attributes, the Transitive bit must be 581 set to 1. (See Section 5 for a discussion of transitive 582 attributes.) 584 The third high-order bit (bit 2) of the Attribute Flags octet 585 is the Partial bit. It defines whether the information con- 586 tained in the optional transitive attribute is partial (if set 587 to 1) or complete (if set to 0). For well-known attributes and 588 for optional non-transitive attributes the Partial bit must be 589 set to 0. 591 The fourth high-order bit (bit 3) of the Attribute Flags octet 592 is the Extended Length bit. It defines whether the Attribute 593 Length is one octet (if set to 0) or two octets (if set to 1). 594 Extended Length may be used only if the length of the attribute 595 value is greater than 255 octets. 597 The lower-order four bits of the Attribute Flags octet are . 598 unused. They must be zero (and must be ignored when received). 600 The Attribute Type Code octet contains the Attribute Type Code. 601 Currently defined Attribute Type Codes are discussed in Section 602 5. 604 RFC DRAFT October 1996 606 If the Extended Length bit of the Attribute Flags octet is set 607 to 0, the third octet of the Path Attribute contains the length 608 of the attribute data in octets. 610 If the Extended Length bit of the Attribute Flags octet is set 611 to 1, then the third and the fourth octets of the path 612 attribute contain the length of the attribute data in octets. 614 The remaining octets of the Path Attribute represent the 615 attribute value and are interpreted according to the Attribute 616 Flags and the Attribute Type Code. The supported Attribute Type 617 Codes, their attribute values and uses are the following: 619 a) ORIGIN (Type Code 1): 621 ORIGIN is a well-known mandatory attribute that defines the 622 origin of the path information. The data octet can assume 623 the following values: 625 Value Meaning 627 0 IGP - Network Layer Reachability Information 628 is interior to the originating AS 630 1 EGP - Network Layer Reachability Information 631 learned via EGP 633 2 INCOMPLETE - Network Layer Reachability 634 Information learned by some other means 636 Its usage is defined in 5.1.1 638 b) AS_PATH (Type Code 2): 640 AS_PATH is a well-known mandatory attribute that is composed 641 of a sequence of AS path segments. Each AS path segment is 642 represented by a triple . 645 The path segment type is a 1-octet long field with the fol- 646 lowing values defined: 648 Value Segment Type 650 1 AS_SET: unordered set of ASs a route in the 651 UPDATE message has traversed 653 2 AS_SEQUENCE: ordered set of ASs a route in 655 RFC DRAFT October 1996 657 the UPDATE message has traversed 659 The path segment length is a 1-octet long field containing 660 the number of ASs in the path segment value field. 662 The path segment value field contains one or more AS num- 663 bers, each encoded as a 2-octets long field. 665 Usage of this attribute is defined in 5.1.2. 667 c) NEXT_HOP (Type Code 3): 669 This is a well-known mandatory attribute that defines the IP 670 address of the border router that should be used as the next 671 hop to the destinations listed in the Network Layer Reacha- 672 bility field of the UPDATE message. 674 Usage of this attribute is defined in 5.1.3. 676 d) MULTI_EXIT_DISC (Type Code 4): 678 This is an optional non-transitive attribute that is a four 679 octet non-negative integer. The value of this attribute may 680 be used by a BGP speaker's decision process to discriminate 681 among multiple exit points to a neighboring autonomous sys- 682 tem. 684 Its usage is defined in 5.1.4. 686 e) LOCAL_PREF (Type Code 5): 688 LOCAL_PREF is a well-known mandatory attribute that is a 689 four octet non-negative integer. It is used by a BGP speaker 690 to inform other internal peers of the originating speaker's 691 degree of preference for an advertised route. Usage of this 692 attribute is described in 5.1.5. 694 f) ATOMIC_AGGREGATE (Type Code 6) 696 ATOMIC_AGGREGATE is a well-known discretionary attribute of 697 length 0. It is used by a BGP speaker to inform other BGP 698 speakers that the local system selected a less specific 699 route without selecting a more specific route which is 700 included in it. Usage of this attribute is described in 701 5.1.6. 703 g) AGGREGATOR (Type Code 7) 705 RFC DRAFT October 1996 707 AGGREGATOR is an optional transitive attribute of length 6. 708 The attribute contains the last AS number that formed the 709 aggregate route (encoded as 2 octets), followed by the IP 710 address of the BGP speaker that formed the aggregate route 711 (encoded as 4 octets). Usage of this attribute is described 712 in 5.1.7 714 Network Layer Reachability Information: 716 This variable length field contains a list of IP address pre- 717 fixes. The length in octets of the Network Layer Reachability 718 Information is not encoded explicitly, but can be calculated 719 as: 721 UPDATE message Length - 23 - Total Path Attributes Length - 722 Unfeasible Routes Length 724 where UPDATE message Length is the value encoded in the fixed- 725 size BGP header, Total Path Attribute Length and Unfeasible 726 Routes Length are the values encoded in the variable part of 727 the UPDATE message, and 23 is a combined length of the fixed- 728 size BGP header, the Total Path Attribute Length field and the 729 Unfeasible Routes Length field. 731 Reachability information is encoded as one or more 2-tuples of 732 the form , whose fields are described below: 734 +---------------------------+ 735 | Length (1 octet) | 736 +---------------------------+ 737 | Prefix (variable) | 738 +---------------------------+ 740 The use and the meaning of these fields are as follows: 742 a) Length: 744 The Length field indicates the length in bits of the IP 745 address prefix. A length of zero indicates a prefix that 746 matches all IP addresses (with prefix, itself, of zero 747 octets). 749 b) Prefix: 751 The Prefix field contains IP address prefixes followed by 752 enough trailing bits to make the end of the field fall on an 754 RFC DRAFT October 1996 756 octet boundary. Note that the value of the trailing bits is 757 irrelevant. 759 The minimum length of the UPDATE message is 23 octets -- 19 octets 760 for the fixed header + 2 octets for the Unfeasible Routes Length + 2 761 octets for the Total Path Attribute Length (the value of Unfeasible 762 Routes Length is 0 and the value of Total Path Attribute Length is 763 0). 765 An UPDATE message can advertise at most one route, which may be 766 described by several path attributes. All path attributes contained 767 in a given UPDATE messages apply to the destinations carried in the 768 Network Layer Reachability Information field of the UPDATE message. 770 An UPDATE message can list multiple routes to be withdrawn from ser- 771 vice. Each such route is identified by its destination (expressed as 772 an IP prefix), which unambiguously identifies the route in the con- 773 text of the BGP speaker - BGP speaker connection to which it has been 774 previously been advertised. 776 An UPDATE message may advertise only routes to be withdrawn from ser- 777 vice, in which case it will not include path attributes or Network 778 Layer Reachability Information. Conversely, it may advertise only a 779 feasible route, in which case the WITHDRAWN ROUTES field need not be 780 present. 782 4.4 KEEPALIVE Message Format 784 BGP does not use any transport protocol-based keep-alive mechanism to 785 determine if peers are reachable. Instead, KEEPALIVE messages are 786 exchanged between peers often enough as not to cause the Hold Timer 787 to expire. A reasonable maximum time between KEEPALIVE messages 788 would be one third of the Hold Time interval. KEEPALIVE messages 789 MUST NOT be sent more frequently than one per second. An implementa- 790 tion MAY adjust the rate at which it sends KEEPALIVE messages as a 791 function of the Hold Time interval. 793 If the negotiated Hold Time interval is zero, then periodic KEEPALIVE 794 messages MUST NOT be sent. 796 KEEPALIVE message consists of only message header and has a length of 797 19 octets. 799 RFC DRAFT October 1996 801 4.5 NOTIFICATION Message Format 803 A NOTIFICATION message is sent when an error condition is detected. 804 The BGP connection is closed immediately after sending it. 806 In addition to the fixed-size BGP header, the NOTIFICATION message 807 contains the following fields: 809 0 1 2 3 810 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 811 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 812 | Error code | Error subcode | Data | 813 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + 814 | | 815 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 817 Error Code: 819 This 1-octet unsigned integer indicates the type of NOTIFICA- 820 TION. The following Error Codes have been defined: 822 Error Code Symbolic Name Reference 824 1 Message Header Error Section 6.1 826 2 OPEN Message Error Section 6.2 828 3 UPDATE Message Error Section 6.3 830 4 Hold Timer Expired Section 6.5 832 5 Finite State Machine Error Section 6.6 834 6 Cease Section 6.7 836 Error subcode: 838 This 1-octet unsigned integer provides more specific informa- 839 tion about the nature of the reported error. Each Error Code 840 may have one or more Error Subcodes associated with it. If no 841 appropriate Error Subcode is defined, then a zero (Unspecific) 842 value is used for the Error Subcode field. 844 RFC DRAFT October 1996 846 Message Header Error subcodes: 848 1 - Connection Not Synchronized. 849 2 - Bad Message Length. 850 3 - Bad Message Type. 852 OPEN Message Error subcodes: 854 1 - Unsupported Version Number. 855 2 - Bad Peer AS. 856 3 - Bad BGP Identifier. 857 4 - Unsupported Optional Parameter. 858 5 - Authentication Failure. 859 6 - Unacceptable Hold Time. 861 UPDATE Message Error subcodes: 863 1 - Malformed Attribute List. 864 2 - Unrecognized Well-known Attribute. 865 3 - Missing Well-known Attribute. 866 4 - Attribute Flags Error. 867 5 - Attribute Length Error. 868 6 - Invalid ORIGIN Attribute 869 7 - AS Routing Loop. 870 8 - Invalid NEXT_HOP Attribute. 871 9 - Optional Attribute Error. 872 10 - Invalid Network Field. 873 11 - Malformed AS_PATH. 875 Data: 877 This variable-length field is used to diagnose the reason for 878 the NOTIFICATION. The contents of the Data field depend upon 879 the Error Code and Error Subcode. See Section 6 below for more 880 details. 882 Note that the length of the Data field can be determined from 883 the message Length field by the formula: 885 Message Length = 21 + Data Length 887 The minimum length of the NOTIFICATION message is 21 octets (includ- 888 ing message header). 890 RFC DRAFT October 1996 892 5. Path Attributes 894 This section discusses the path attributes of the UPDATE message. 896 Path attributes fall into four separate categories: 898 1. Well-known mandatory. 899 2. Well-known discretionary. 900 3. Optional transitive. 901 4. Optional non-transitive. 903 Well-known attributes must be recognized by all BGP implementations. 904 Some of these attributes are mandatory and must be included in every 905 UPDATE message. Others are discretionary and may or may not be sent 906 in a particular UPDATE message. 908 All well-known attributes must be passed along (after proper updat- 909 ing, if necessary) to other BGP peers. 911 In addition to well-known attributes, each path may contain one or 912 more optional attributes. It is not required or expected that all 913 BGP implementations support all optional attributes. The handling of 914 an unrecognized optional attribute is determined by the setting of 915 the Transitive bit in the attribute flags octet. Paths with unrecog- 916 nized transitive optional attributes should be accepted. If a path 917 with unrecognized transitive optional attribute is accepted and 918 passed along to other BGP peers, then the unrecognized transitive 919 optional attribute of that path must be passed along with the path to 920 other BGP peers with the Partial bit in the Attribute Flags octet set 921 to 1. If a path with recognized transitive optional attribute is 922 accepted and passed along to other BGP peers and the Partial bit in 923 the Attribute Flags octet is set to 1 by some previous AS, it is not 924 set back to 0 by the current AS. Unrecognized non-transitive optional 925 attributes must be quietly ignored and not passed along to other BGP 926 peers. 928 New transitive optional attributes may be attached to the path by the 929 originator or by any other AS in the path. If they are not attached 930 by the originator, the Partial bit in the Attribute Flags octet is 931 set to 1. The rules for attaching new non-transitive optional 932 attributes will depend on the nature of the specific attribute. The 933 documentation of each new non-transitive optional attribute will be 934 expected to include such rules. (The description of the 935 MULTI_EXIT_DISC attribute gives an example.) All optional attributes 936 (both transitive and non-transitive) may be updated (if appropriate) 937 by ASs in the path. 939 RFC DRAFT October 1996 941 The sender of an UPDATE message should order path attributes within 942 the UPDATE message in ascending order of attribute type. The 943 receiver of an UPDATE message must be prepared to handle path 944 attributes within the UPDATE message that are out of order. 946 The same attribute cannot appear more than once within the Path 947 Attributes field of a particular UPDATE message. 949 The mandatory category refers to a field which must be present in 950 both IBGP and EBGP exchanges. Attributes classified as optional for 951 the purpose of the protocol extension mechanism may be purely discre- 952 tionary, or discretionary, required, or disallowed in certain con- 953 texts. 955 attribute EBGP IBGP 956 ORIGIN mandatory mandatory 957 AS_PATH mandatory mandatory 958 NEXT_HOP mandatory mandatory 959 MULTI_EXIT_DISC discretionary discretionary 960 LOCAL_PREF disallowed required 961 ATOMIC_AGGREGATE see section 5.1.6 and 9.1.4 962 AGGREGATOR discretionary discretionary 964 5.1 Path Attribute Usage 966 The usage of each BGP path attributes is described in the following 967 clauses. 969 5.1.1 ORIGIN 971 ORIGIN is a well-known mandatory attribute. The ORIGIN attribute 972 shall be generated by the autonomous system that originates the asso- 973 ciated routing information. It shall be included in the UPDATE mes- 974 sages of all BGP speakers that choose to propagate this information 975 to other BGP speakers. 977 5.1.2 AS_PATH 979 AS_PATH is a well-known mandatory attribute. This attribute 981 RFC DRAFT October 1996 983 identifies the autonomous systems through which routing information 984 carried in this UPDATE message has passed. The components of this 985 list can be AS_SETs or AS_SEQUENCEs. 987 When a BGP speaker propagates a route which it has learned from 988 another BGP speaker's UPDATE message, it shall modify the route's 989 AS_PATH attribute based on the location of the BGP speaker to which 990 the route will be sent: 992 a) When a given BGP speaker advertises the route to an internal 993 peer, the advertising speaker shall not modify the AS_PATH 994 attribute associated with the route. 996 b) When a given BGP speaker advertises the route to an external 997 peer, then the advertising speaker shall update the AS_PATH 998 attribute as follows: 1000 1) if the first path segment of the AS_PATH is of type 1001 AS_SEQUENCE, the local system shall prepend its own AS number 1002 as the last element of the sequence (put it in the leftmost 1003 position) 1005 2) if the first path segment of the AS_PATH is of type AS_SET, 1006 the local system shall prepend a new path segment of type 1007 AS_SEQUENCE to the AS_PATH, including its own AS number in that 1008 segment. 1010 When a BGP speaker originates a route then: 1012 a) the originating speaker shall include its own AS number in 1013 the AS_PATH attribute of all UPDATE messages sent to an exter- 1014 nal peer. (In this case, the AS number of the originating 1015 speaker's autonomous system will be the only entry in the 1016 AS_PATH attribute). 1018 b) the originating speaker shall include an empty AS_PATH 1019 attribute in all UPDATE messages sent to internal peers. (An 1020 empty AS_PATH attribute is one whose length field contains the 1021 value zero). 1023 5.1.3 NEXT_HOP 1025 The NEXT_HOP path attribute defines the IP address of the border 1026 router that should be used as the next hop to the destinations listed 1027 in the UPDATE message. When advertising a NEXT_HOP attribute to an 1029 RFC DRAFT October 1996 1031 external peer, a router may use one of its own interface addresses in 1032 the NEXT_HOP attribute provided the external peer to which the route 1033 is being advertised shares a common subnet with the NEXT_HOP address. 1034 This is known as a "first party" NEXT_HOP attribute. A BGP speaker 1035 can advertise to an external peer an interface of any internal peer 1036 router in the NEXT_HOP attribute provided the external peer to which 1037 the route is being advertised shares a common subnet with the 1038 NEXT_HOP address. This is known as a "third party" NEXT_HOP 1039 attribute. A BGP speaker can advertise any external peer router in 1040 the NEXT_HOP attribute provided that the IP address of this border 1041 router was learned from an external peer and the external peer to 1042 which the route is being advertised shares a common subnet with the 1043 NEXT_HOP address. This is a second form of "third party" NEXT_HOP 1044 attribute. 1046 Normally the NEXT_HOP attribute is chosen such that the shortest 1047 available path will be taken. A BGP speaker must be able to support 1048 disabling advertisement of third party NEXT_HOP attributes to handle 1049 imperfectly bridged media. 1051 A BGP speaker must never advertise an address of a peer to that peer 1052 as a NEXT_HOP, for a route that the speaker is originating. A BGP 1053 speaker must never install a route with itself as the next hop. 1055 When a BGP speaker advertises the route to an internal peer, the 1056 advertising speaker should not modify the NEXT_HOP attribute associ- 1057 ated with the route. When a BGP speaker receives the route via an 1058 internal link, it may forward packets to the NEXT_HOP address if the 1059 address contained in the attribute is on a common subnet with the 1060 local and remote BGP speakers. 1062 5.1.4 MULTI_EXIT_DISC 1064 The MULTI_EXIT_DISC attribute may be used on external (inter-AS) 1065 links to discriminate among multiple exit or entry points to the same 1066 neighboring AS. The value of the MULTI_EXIT_DISC attribute is a four 1067 octet unsigned number which is called a metric. All other factors 1068 being equal, the exit or entry point with lower metric should be pre- 1069 ferred. If received over external links, the MULTI_EXIT_DISC 1070 attribute MAY be propagated over internal links to other BGP speakers 1071 within the same AS. The MULTI_EXIT_DISC attribute received from a 1072 neighboring AS MUST NOT be propagated to other neighboring ASs. 1074 A BGP speaker MUST IMPLEMENT a mechanism based on local configuration 1075 which allows the MULTI_EXIT_DISC attribute to be removed from a 1076 route. This MAY be done either prior to or after determining the 1078 RFC DRAFT October 1996 1080 degree of preference of the route and performing route selection 1081 (decision process phases 1 and 2). 1083 An implementation MAY also (based on local configuration) alter the 1084 value of the MULTI_EXIT_DISC attribute received over an external 1085 link. If it does so, it shall do so prior to determining the degree 1086 of preference of the route and performing route selection (decision 1087 process phases 1 and 2). 1089 5.1.5 LOCAL_PREF 1091 LOCAL_PREF is a well-known mandatory attribute that SHALL be included 1092 in all UPDATE messages that a given BGP speaker sends to the other 1093 internal peers. A BGP speaker SHALL calculate the degree of prefer- 1094 ence for each external route and include the degree of preference 1095 when advertising a route to its internal peers. The higher degree of 1096 preference MUST be preferred. A BGP speaker shall use the degree of 1097 preference learned via LOCAL_PREF in its decision process (see sec- 1098 tion 9.1.1). 1100 A BGP speaker MUST NOT include this attribute in UPDATE messages that 1101 it sends to external peers. If it is contained in an UPDATE message 1102 that is received from an external peer, then this attribute MUST be 1103 ignored by the receiving speaker. 1105 5.1.6 ATOMIC_AGGREGATE 1107 ATOMIC_AGGREGATE is a well-known discretionary attribute. If a BGP 1108 speaker, when presented with a set of overlapping routes from one of 1109 its peers (see 9.1.4), selects the less specific route without 1110 selecting the more specific one, then the local system MUST attach 1111 the ATOMIC_AGGREGATE attribute to the route when propagating it to 1112 other BGP speakers (if that attribute is not already present in the 1113 received less specific route). A BGP speaker that receives a route 1114 with the ATOMIC_AGGREGATE attribute MUST NOT remove the attribute 1115 from the route when propagating it to other speakers. A BGP speaker 1116 that receives a route with the ATOMIC_AGGREGATE attribute MUST NOT 1117 make any NLRI of that route more specific (as defined in 9.1.4) when 1118 advertising this route to other BGP speakers. A BGP speaker that 1119 receives a route with the ATOMIC_AGGREGATE attribute needs to be cog- 1120 nizant of the fact that the actual path to destinations, as specified 1121 in the NLRI of the route, while having the loop-free property, may 1122 traverse ASs that are not listed in the AS_PATH attribute. 1124 RFC DRAFT October 1996 1126 5.1.7 AGGREGATOR 1128 AGGREGATOR is an optional transitive attribute which may be included 1129 in updates which are formed by aggregation (see Section 9.2.4.2). A 1130 BGP speaker which performs route aggregation may add the AGGREGATOR 1131 attribute which shall contain its own AS number and IP address. 1133 6. BGP Error Handling. 1135 This section describes actions to be taken when errors are detected 1136 while processing BGP messages. 1138 When any of the conditions described here are detected, a NOTIFICA- 1139 TION message with the indicated Error Code, Error Subcode, and Data 1140 fields is sent, and the BGP connection is closed. If no Error Sub- 1141 code is specified, then a zero must be used. 1143 The phrase "the BGP connection is closed" means that the transport 1144 protocol connection has been closed and that all resources for that 1145 BGP connection have been deallocated. Routing table entries associ- 1146 ated with the remote peer are marked as invalid. The fact that the 1147 routes have become invalid is passed to other BGP peers before the 1148 routes are deleted from the system. 1150 Unless specified explicitly, the Data field of the NOTIFICATION mes- 1151 sage that is sent to indicate an error is empty. 1153 6.1 Message Header error handling. 1155 All errors detected while processing the Message Header are indicated 1156 by sending the NOTIFICATION message with Error Code Message Header 1157 Error. The Error Subcode elaborates on the specific nature of the 1158 error. 1160 The expected value of the Marker field of the message header is all 1161 ones if the message type is OPEN. The expected value of the Marker 1162 field for all other types of BGP messages determined based on the 1163 presence of the Authentication Information Optional Parameter in the 1164 BGP OPEN message and the actual authentication mechanism (if the 1165 Authentication Information in the BGP OPEN message is present). If 1166 the Marker field of the message header is not the expected one, then 1167 a synchronization error has occurred and the Error Subcode is set to 1168 Connection Not Synchronized. 1170 RFC DRAFT October 1996 1172 If the Length field of the message header is less than 19 or greater 1173 than 4096, or if the Length field of an OPEN message is less than 1174 the minimum length of the OPEN message, or if the Length field of an 1175 UPDATE message is less than the minimum length of the UPDATE message, 1176 or if the Length field of a KEEPALIVE message is not equal to 19, or 1177 if the Length field of a NOTIFICATION message is less than the mini- 1178 mum length of the NOTIFICATION message, then the Error Subcode is set 1179 to Bad Message Length. The Data field contains the erroneous Length 1180 field. 1182 If the Type field of the message header is not recognized, then the 1183 Error Subcode is set to Bad Message Type. The Data field contains 1184 the erroneous Type field. 1186 6.2 OPEN message error handling. 1188 All errors detected while processing the OPEN message are indicated 1189 by sending the NOTIFICATION message with Error Code OPEN Message 1190 Error. The Error Subcode elaborates on the specific nature of the 1191 error. 1193 If the version number contained in the Version field of the received 1194 OPEN message is not supported, then the Error Subcode is set to 1195 Unsupported Version Number. The Data field is a 2-octet unsigned 1196 integer, which indicates the largest locally supported version number 1197 less than the version the remote BGP peer bid (as indicated in the 1198 received OPEN message). 1200 If the Autonomous System field of the OPEN message is unacceptable, 1201 then the Error Subcode is set to Bad Peer AS. The determination of 1202 acceptable Autonomous System numbers is outside the scope of this 1203 protocol. 1205 If the Hold Time field of the OPEN message is unacceptable, then the 1206 Error Subcode MUST be set to Unacceptable Hold Time. An implementa- 1207 tion MUST reject Hold Time values of one or two seconds. An imple- 1208 mentation MAY reject any proposed Hold Time. An implementation which 1209 accepts a Hold Time MUST use the negotiated value for the Hold Time. 1211 If the BGP Identifier field of the OPEN message is syntactically 1212 incorrect, then the Error Subcode is set to Bad BGP Identifier. Syn- 1213 tactic correctness means that the BGP Identifier field represents a 1214 valid IP host address. 1216 If one of the Optional Parameters in the OPEN message is not recog- 1217 nized, then the Error Subcode is set to Unsupported Optional 1219 RFC DRAFT October 1996 1221 Parameters. 1223 If the OPEN message carries Authentication Information (as an 1224 Optional Parameter), then the corresponding authentication procedure 1225 is invoked. If the authentication procedure (based on Authentication 1226 Code and Authentication Data) fails, then the Error Subcode is set to 1227 Authentication Failure. 1229 If the OPEN message carries any other Optional Parameter (other than 1230 Authentication Information), and the local system doesn't recognize 1231 the Parameter, the Parameter shall be ignored. 1233 6.3 UPDATE message error handling. 1235 All errors detected while processing the UPDATE message are indicated 1236 by sending the NOTIFICATION message with Error Code UPDATE Message 1237 Error. The error subcode elaborates on the specific nature of the 1238 error. 1240 Error checking of an UPDATE message begins by examining the path 1241 attributes. If the Unfeasible Routes Length or Total Attribute 1242 Length is too large (i.e., if Unfeasible Routes Length + Total 1243 Attribute Length + 23 exceeds the message Length), then the Error 1244 Subcode is set to Malformed Attribute List. 1246 If any recognized attribute has Attribute Flags that conflict with 1247 the Attribute Type Code, then the Error Subcode is set to Attribute 1248 Flags Error. The Data field contains the erroneous attribute (type, 1249 length and value). 1251 If any recognized attribute has Attribute Length that conflicts with 1252 the expected length (based on the attribute type code), then the 1253 Error Subcode is set to Attribute Length Error. The Data field con- 1254 tains the erroneous attribute (type, length and value). 1256 If any of the mandatory well-known attributes are not present, then 1257 the Error Subcode is set to Missing Well-known Attribute. The Data 1258 field contains the Attribute Type Code of the missing well-known 1259 attribute. 1261 If any of the mandatory well-known attributes are not recognized, 1262 then the Error Subcode is set to Unrecognized Well-known Attribute. 1263 The Data field contains the unrecognized attribute (type, length and 1264 value). 1266 RFC DRAFT October 1996 1268 If the ORIGIN attribute has an undefined value, then the Error Sub- 1269 code is set to Invalid Origin Attribute. The Data field contains the 1270 unrecognized attribute (type, length and value). 1272 If the NEXT_HOP attribute field is syntactically incorrect, then the 1273 Error Subcode is set to Invalid NEXT_HOP Attribute. The Data field 1274 contains the incorrect attribute (type, length and value). Syntactic 1275 correctness means that the NEXT_HOP attribute represents a valid IP 1276 host address. Semantic correctness applies only to the external BGP 1277 links. It means that the interface associated with the IP address, as 1278 specified in the NEXT_HOP attribute, shares a common subnet with the 1279 receiving BGP speaker and is not the IP address of the receiving BGP 1280 speaker. If the NEXT_HOP attribute is semantically incorrect, the 1281 error should be logged, and the the route should be ignored. In this 1282 case, no NOTIFICATION message should be sent. 1284 The AS_PATH attribute is checked for syntactic correctness. If the 1285 path is syntactically incorrect, then the Error Subcode is set to 1286 Malformed AS_PATH. 1288 The information carried by the AS_PATH attribute is checked for AS 1289 loops. AS loop detection is done by scanning the full AS path (as 1290 specified in the AS_PATH attribute), and checking that the autonomous 1291 system number of the local system does not appear in the AS path. If 1292 the autonomous system number appears in the AS path the route may be 1293 stored in the Adj-RIB-In, but unless the router is configured to 1294 accept routes with its own autonomous system in the AS path, the 1295 route shall not be passed to the BGP Decision Process. Operations of 1296 a router that is configured to accept routes with its own autonomous 1297 system number in the AS path are outside the scope of this document. 1299 If an optional attribute is recognized, then the value of this 1300 attribute is checked. If an error is detected, the attribute is dis- 1301 carded, and the Error Subcode is set to Optional Attribute Error. 1302 The Data field contains the attribute (type, length and value). 1304 If any attribute appears more than once in the UPDATE message, then 1305 the Error Subcode is set to Malformed Attribute List. 1307 The NLRI field in the UPDATE message is checked for syntactic valid- 1308 ity. If the field is syntactically incorrect, then the Error Subcode 1309 is set to Invalid Network Field. 1311 RFC DRAFT October 1996 1313 6.4 NOTIFICATION message error handling. 1315 If a peer sends a NOTIFICATION message, and there is an error in that 1316 message, there is unfortunately no means of reporting this error via 1317 a subsequent NOTIFICATION message. Any such error, such as an unrec- 1318 ognized Error Code or Error Subcode, should be noticed, logged 1319 locally, and brought to the attention of the administration of the 1320 peer. The means to do this, however, lies outside the scope of this 1321 document. 1323 6.5 Hold Timer Expired error handling. 1325 If a system does not receive successive KEEPALIVE and/or UPDATE 1326 and/or NOTIFICATION messages within the period specified in the Hold 1327 Time field of the OPEN message, then the NOTIFICATION message with 1328 Hold Timer Expired Error Code must be sent and the BGP connection 1329 closed. 1331 6.6 Finite State Machine error handling. 1333 Any error detected by the BGP Finite State Machine (e.g., receipt of 1334 an unexpected event) is indicated by sending the NOTIFICATION message 1335 with Error Code Finite State Machine Error. 1337 6.7 Cease. 1339 In absence of any fatal errors (that are indicated in this section), 1340 a BGP peer may choose at any given time to close its BGP connection 1341 by sending the NOTIFICATION message with Error Code Cease. However, 1342 the Cease NOTIFICATION message must not be used when a fatal error 1343 indicated by this section does exist. 1345 6.8 Connection collision detection. 1347 If a pair of BGP speakers try simultaneously to establish a TCP con- 1348 nection to each other, then two parallel connections between this 1349 pair of speakers might well be formed. We refer to this situation as 1350 connection collision. Clearly, one of these connections must be 1351 closed. 1353 RFC DRAFT October 1996 1355 Based on the value of the BGP Identifier a convention is established 1356 for detecting which BGP connection is to be preserved when a colli- 1357 sion does occur. The convention is to compare the BGP Identifiers of 1358 the peers involved in the collision and to retain only the connection 1359 initiated by the BGP speaker with the higher-valued BGP Identifier. 1361 Upon receipt of an OPEN message, the local system must examine all of 1362 its connections that are in the OpenConfirm state. A BGP speaker may 1363 also examine connections in an OpenSent state if it knows the BGP 1364 Identifier of the peer by means outside of the protocol. If among 1365 these connections there is a connection to a remote BGP speaker whose 1366 BGP Identifier equals the one in the OPEN message, then the local 1367 system performs the following collision resolution procedure: 1369 1. The BGP Identifier of the local system is compared to the BGP 1370 Identifier of the remote system (as specified in the OPEN mes- 1371 sage). 1373 2. If the value of the local BGP Identifier is less than the 1374 remote one, the local system closes BGP connection that already 1375 exists (the one that is already in the OpenConfirm state), and 1376 accepts BGP connection initiated by the remote system. 1378 3. Otherwise, the local system closes newly created BGP connection 1379 (the one associated with the newly received OPEN message), and 1380 continues to use the existing one (the one that is already in the 1381 OpenConfirm state). 1383 Comparing BGP Identifiers is done by treating them as (4-octet 1384 long) unsigned integers. 1386 A connection collision with an existing BGP connection that is in 1387 Established states causes unconditional closing of the newly cre- 1388 ated connection. Note that a connection collision cannot be 1389 detected with connections that are in Idle, or Connect, or Active 1390 states. 1392 Closing the BGP connection (that results from the collision reso- 1393 lution procedure) is accomplished by sending the NOTIFICATION mes- 1394 sage with the Error Code Cease. 1396 7. BGP Version Negotiation. 1398 BGP speakers may negotiate the version of the protocol by making mul- 1399 tiple attempts to open a BGP connection, starting with the highest 1401 RFC DRAFT October 1996 1403 version number each supports. If an open attempt fails with an Error 1404 Code OPEN Message Error, and an Error Subcode Unsupported Version 1405 Number, then the BGP speaker has available the version number it 1406 tried, the version number its peer tried, the version number passed 1407 by its peer in the NOTIFICATION message, and the version numbers that 1408 it supports. If the two peers do support one or more common ver- 1409 sions, then this will allow them to rapidly determine the highest 1410 common version. In order to support BGP version negotiation, future 1411 versions of BGP must retain the format of the OPEN and NOTIFICATION 1412 messages. 1414 8. BGP Finite State machine. 1416 This section specifies BGP operation in terms of a Finite State 1417 Machine (FSM). Following is a brief summary and overview of BGP 1418 operations by state as determined by this FSM. A condensed version 1419 of the BGP FSM is found in Appendix 1. 1421 Initially BGP is in the Idle state. 1423 Idle state: 1425 In this state BGP refuses all incoming BGP connections. No 1426 resources are allocated to the peer. In response to the Start 1427 event (initiated by either system or operator) the local system 1428 initializes all BGP resources, starts the ConnectRetry timer, 1429 initiates a transport connection to other BGP peer, while lis- 1430 tening for connection that may be initiated by the remote BGP 1431 peer, and changes its state to Connect. The exact value of the 1432 ConnectRetry timer is a local matter, but should be suffi- 1433 ciently large to allow TCP initialization. 1435 If a BGP speaker detects an error, it shuts down the connection 1436 and changes its state to Idle. Getting out of the Idle state 1437 requires generation of the Start event. If such an event is 1438 generated automatically, then persistent BGP errors may result 1439 in persistent flapping of the speaker. To avoid such a condi- 1440 tion it is recommended that Start events should not be gener- 1441 ated immediately for a peer that was previously transitioned to 1442 Idle due to an error. For a peer that was previously transi- 1443 tioned to Idle due to an error, the time between consecutive 1444 generation of Start events, if such events are generated auto- 1445 matically, shall exponentially increase. The value of the ini- 1446 tial timer shall be 60 seconds. The time shall be doubled for 1447 each consecutive retry. 1449 RFC DRAFT October 1996 1451 Any other event received in the Idle state is ignored. 1453 Connect state: 1455 In this state BGP is waiting for the transport protocol connec- 1456 tion to be completed. 1458 If the transport protocol connection succeeds, the local system 1459 clears the ConnectRetry timer, completes initialization, sends 1460 an OPEN message to its peer, and changes its state to OpenSent. 1462 If the transport protocol connect fails (e.g., retransmission 1463 timeout), the local system restarts the ConnectRetry timer, 1464 continues to listen for a connection that may be initiated by 1465 the remote BGP peer, and changes its state to Active state. 1467 In response to the ConnectRetry timer expired event, the local 1468 system restarts the ConnectRetry timer, initiates a transport 1469 connection to other BGP peer, continues to listen for a connec- 1470 tion that may be initiated by the remote BGP peer, and stays in 1471 the Connect state. 1473 Start event is ignored in the Active state. 1475 In response to any other event (initiated by either system or 1476 operator), the local system releases all BGP resources associ- 1477 ated with this connection and changes its state to Idle. 1479 Active state: 1481 In this state BGP is trying to acquire a peer by initiating a 1482 transport protocol connection. 1484 If the transport protocol connection succeeds, the local system 1485 clears the ConnectRetry timer, completes initialization, sends 1486 an OPEN message to its peer, sets its Hold Timer to a large 1487 value, and changes its state to OpenSent. A Hold Timer value 1488 of 4 minutes is suggested. 1490 In response to the ConnectRetry timer expired event, the local 1491 system restarts the ConnectRetry timer, initiates a transport 1492 connection to other BGP peer, continues to listen for a connec- 1493 tion that may be initiated by the remote BGP peer, and changes 1494 its state to Connect. 1496 If the local system detects that a remote peer is trying to 1497 establish BGP connection to it, and the IP address of the 1498 remote peer is not an expected one, the local system restarts 1500 RFC DRAFT October 1996 1502 the ConnectRetry timer, rejects the attempted connection, con- 1503 tinues to listen for a connection that may be initiated by the 1504 remote BGP peer, and stays in the Active state. 1506 Start event is ignored in the Active state. 1508 In response to any other event (initiated by either system or 1509 operator), the local system releases all BGP resources associ- 1510 ated with this connection and changes its state to Idle. 1512 OpenSent state: 1514 In this state BGP waits for an OPEN message from its peer. 1515 When an OPEN message is received, all fields are checked for 1516 correctness. If the BGP message header checking or OPEN mes- 1517 sage checking detects an error (see Section 6.2), or a connec- 1518 tion collision (see Section 6.8) the local system sends a NOTI- 1519 FICATION message and changes its state to Idle. 1521 If there are no errors in the OPEN message, BGP sends a 1522 KEEPALIVE message and sets a KeepAlive timer. The Hold Timer, 1523 which was originally set to a large value (see above), is 1524 replaced with the negotiated Hold Time value (see section 4.2). 1525 If the negotiated Hold Time value is zero, then the Hold Time 1526 timer and KeepAlive timers are not started. If the value of 1527 the Autonomous System field is the same as the local Autonomous 1528 System number, then the connection is an "internal" connection; 1529 otherwise, it is "external". (This will effect UPDATE process- 1530 ing as described below.) Finally, the state is changed to 1531 OpenConfirm. 1533 If a disconnect notification is received from the underlying 1534 transport protocol, the local system closes the BGP connection, 1535 restarts the ConnectRetry timer, while continue listening for 1536 connection that may be initiated by the remote BGP peer, and 1537 goes into the Active state. 1539 If the Hold Timer expires, the local system sends NOTIFICATION 1540 message with error code Hold Timer Expired and changes its 1541 state to Idle. 1543 In response to the Stop event (initiated by either system or 1544 operator) the local system sends NOTIFICATION message with 1545 Error Code Cease and changes its state to Idle. 1547 Start event is ignored in the OpenSent state. 1549 In response to any other event the local system sends 1551 RFC DRAFT October 1996 1553 NOTIFICATION message with Error Code Finite State Machine Error 1554 and changes its state to Idle. 1556 Whenever BGP changes its state from OpenSent to Idle, it closes 1557 the BGP (and transport-level) connection and releases all 1558 resources associated with that connection. 1560 OpenConfirm state: 1562 In this state BGP waits for a KEEPALIVE or NOTIFICATION mes- 1563 sage. 1565 If the local system receives a KEEPALIVE message, it changes 1566 its state to Established. 1568 If the Hold Timer expires before a KEEPALIVE message is 1569 received, the local system sends NOTIFICATION message with 1570 error code Hold Timer Expired and changes its state to Idle. 1572 If the local system receives a NOTIFICATION message, it changes 1573 its state to Idle. 1575 If the KeepAlive timer expires, the local system sends a 1576 KEEPALIVE message and restarts its KeepAlive timer. 1578 If a disconnect notification is received from the underlying 1579 transport protocol, the local system changes its state to Idle. 1581 In response to the Stop event (initiated by either system or 1582 operator) the local system sends NOTIFICATION message with 1583 Error Code Cease and changes its state to Idle. 1585 Start event is ignored in the OpenConfirm state. 1587 In response to any other event the local system sends NOTIFICA- 1588 TION message with Error Code Finite State Machine Error and 1589 changes its state to Idle. 1591 Whenever BGP changes its state from OpenConfirm to Idle, it 1592 closes the BGP (and transport-level) connection and releases 1593 all resources associated with that connection. 1595 Established state: 1597 In the Established state BGP can exchange UPDATE, NOTIFICATION, 1598 and KEEPALIVE messages with its peer. 1600 If the local system receives an UPDATE or KEEPALIVE message, it 1602 RFC DRAFT October 1996 1604 restarts its Hold Timer, if the negotiated Hold Time value is 1605 non-zero. 1607 If the local system receives a NOTIFICATION message, it changes 1608 its state to Idle. 1610 If the local system receives an UPDATE message and the UPDATE 1611 message error handling procedure (see Section 6.3) detects an 1612 error, the local system sends a NOTIFICATION message and 1613 changes its state to Idle. 1615 If a disconnect notification is received from the underlying 1616 transport protocol, the local system changes its state to Idle. 1618 If the Hold Timer expires, the local system sends a NOTIFICA- 1619 TION message with Error Code Hold Timer Expired and changes its 1620 state to Idle. 1622 If the KeepAlive timer expires, the local system sends a 1623 KEEPALIVE message and restarts its KeepAlive timer. 1625 Each time the local system sends a KEEPALIVE or UPDATE message, 1626 it restarts its KeepAlive timer, unless the negotiated Hold 1627 Time value is zero. 1629 In response to the Stop event (initiated by either system or 1630 operator), the local system sends a NOTIFICATION message with 1631 Error Code Cease and changes its state to Idle. 1633 Start event is ignored in the Established state. 1635 In response to any other event, the local system sends NOTIFI- 1636 CATION message with Error Code Finite State Machine Error and 1637 changes its state to Idle. 1639 Whenever BGP changes its state from Established to Idle, it 1640 closes the BGP (and transport-level) connection, releases all 1641 resources associated with that connection, and deletes all 1642 routes derived from that connection. 1644 9. UPDATE Message Handling 1646 An UPDATE message may be received only in the Established state. 1647 When an UPDATE message is received, each field is checked for valid- 1648 ity as specified in Section 6.3. 1650 RFC DRAFT October 1996 1652 If an optional non-transitive attribute is unrecognized, it is qui- 1653 etly ignored. If an optional transitive attribute is unrecognized, 1654 the Partial bit (the third high-order bit) in the attribute flags 1655 octet is set to 1, and the attribute is retained for propagation to 1656 other BGP speakers. 1658 If an optional attribute is recognized, and has a valid value, then, 1659 depending on the type of the optional attribute, it is processed 1660 locally, retained, and updated, if necessary, for possible propaga- 1661 tion to other BGP speakers. 1663 If the UPDATE message contains a non-empty WITHDRAWN ROUTES field, 1664 the previously advertised routes whose destinations (expressed as IP 1665 prefixes) contained in this field shall be removed from the Adj-RIB- 1666 In. This BGP speaker shall run its Decision Process since the previ- 1667 ously advertised route is not longer available for use. 1669 If the UPDATE message contains a feasible route, it shall be placed 1670 in the appropriate Adj-RIB-In, and the following additional actions 1671 shall be taken: 1673 i) If its Network Layer Reachability Information (NLRI) is identical 1674 to the one of a route currently stored in the Adj-RIB-In, then the 1675 new route shall replace the older route in the Adj-RIB-In, thus 1676 implicitly withdrawing the older route from service. The BGP speaker 1677 shall run its Decision Process since the older route is no longer 1678 available for use. 1680 ii) If the new route is an overlapping route that is included (see 1681 9.1.4) in an earlier route contained in the Adj-RIB-In, the BGP 1682 speaker shall run its Decision Process since the more specific route 1683 has implicitly made a portion of the less specific route unavailable 1684 for use. 1686 iii) If the new route has identical path attributes to an earlier 1687 route contained in the Adj-RIB-In, and is more specific (see 9.1.4) 1688 than the earlier route, no further actions are necessary. 1690 iv) If the new route has NLRI that is not present in any of the 1691 routes currently stored in the Adj-RIB-In, then the new route shall 1692 be placed in the Adj-RIB-In. The BGP speaker shall run its Decision 1693 Process. 1695 v) If the new route is an overlapping route that is less specific 1696 (see 9.1.4) than an earlier route contained in the Adj-RIB-In, the 1697 BGP speaker shall run its Decision Process on the set of destinations 1698 described only by the less specific route. 1700 RFC DRAFT October 1996 1702 9.1 Decision Process 1704 The Decision Process selects routes for subsequent advertisement by 1705 applying the policies in the local Policy Information Base (PIB) to 1706 the routes stored in its Adj-RIB-In. The output of the Decision Pro- 1707 cess is the set of routes that will be advertised to all peers; the 1708 selected routes will be stored in the local speaker's Adj-RIB-Out. 1710 The selection process is formalized by defining a function that takes 1711 the attribute of a given route as an argument and returns a non- 1712 negative integer denoting the degree of preference for the route. 1713 The function that calculates the degree of preference for a given 1714 route shall not use as its inputs any of the following: the existence 1715 of other routes, the non-existence of other routes, or the path 1716 attributes of other routes. Route selection then consists of individ- 1717 ual application of the degree of preference function to each feasible 1718 route, followed by the choice of the one with the highest degree of 1719 preference. 1721 The Decision Process operates on routes contained in each Adj-RIB-In, 1722 and is responsible for: 1724 - selection of routes to be advertised to internal peers 1726 - selection of routes to be advertised to external peers 1728 - route aggregation and route information reduction 1730 The Decision Process takes place in three distinct phases, each trig- 1731 gered by a different event: 1733 a) Phase 1 is responsible for calculating the degree of preference 1734 for each route received from an external peer, and for advertising 1735 to the other internal peers the routes that have the highest 1736 degree of preference for each distinct destination. 1738 b) Phase 2 is invoked on completion of phase 1. It is responsible 1739 for choosing the best route out of all those available for each 1740 distinct destination, and for installing each chosen route into 1741 the appropriate Loc-RIB. 1743 c) Phase 3 is invoked after the Loc-RIB has been modified. It is 1744 responsible for disseminating routes in the Loc-RIB to each exter- 1745 nal peer, according to the policies contained in the PIB. Route 1746 aggregation and information reduction can optionally be performed 1747 within this phase. 1749 RFC DRAFT October 1996 1751 9.1.1 Phase 1: Calculation of Degree of Preference 1753 The Phase 1 decision function shall be invoked whenever the local BGP 1754 speaker receives from an external peer an UPDATE message that adver- 1755 tises a new route, a replacement route, or a withdrawn route. 1757 The Phase 1 decision function is a separate process which completes 1758 when it has no further work to do. 1760 The Phase 1 decision function shall lock an Adj-RIB-In prior to oper- 1761 ating on any route contained within it, and shall unlock it after 1762 operating on all new or unfeasible routes contained within it. 1764 For each newly received or replacement feasible route, the local BGP 1765 speaker shall determine a degree of preference. If the route is 1766 learned from an internal peer, the value of the LOCAL_PREF attribute 1767 shall be taken as the degree of preference. If the route is learned 1768 from an external peer, then the degree of preference shall be com- 1769 puted based on preconfigured policy information and used as the 1770 LOCAL_PREF value in any IBGP readvertisement. The exact nature of 1771 this policy information and the computation involved is a local mat- 1772 ter. The local speaker shall then run the internal update process of 1773 9.2.1 to select and advertise the most preferable route. 1775 9.1.2 Phase 2: Route Selection 1777 The Phase 2 decision function shall be invoked on completion of Phase 1778 1. The Phase 2 function is a separate process which completes when 1779 it has no further work to do. The Phase 2 process shall consider all 1780 routes that are present in the Adj-RIBs-In, including those received 1781 from both internal and external peers. 1783 The Phase 2 decision function shall be blocked from running while the 1784 Phase 3 decision function is in process. The Phase 2 function shall 1785 lock all Adj-RIBs-In prior to commencing its function, and shall 1786 unlock them on completion. 1788 If the NEXT_HOP attribute of a BGP route depicts an address to which 1789 the local BGP speaker doesn't have a route in its Loc-RIB, the BGP 1790 route should be excluded from the Phase 2 decision function. 1792 It is critical that routers within an AS do not make conflicting 1793 decisions regarding route selection that would cause forwarding loops 1794 to occur. 1796 RFC DRAFT October 1996 1798 For each set of destinations for which a feasible route exists in the 1799 Adj-RIBs-In, the local BGP speaker shall identify the route that has: 1801 a) the highest degree of preference of any route to the same set 1802 of destinations, or 1804 b) is the only route to that destination, or 1806 c) is selected as a result of the Phase 2 tie breaking rules spec- 1807 ified in 9.1.2.1. 1809 The local speaker SHALL then install that route in the Loc-RIB, 1810 replacing any route to the same destination that is currently being 1811 held in the Loc-RIB. The local speaker MUST determine the immediate 1812 next hop to the address depicted by the NEXT_HOP attribute of the 1813 selected route by performing a lookup in the IGP and selecting one of 1814 the possible paths in the IGP. This immediate next hop MUST be used 1815 when installing the selected route in the Loc-RIB. If the route to 1816 the address depicted by the NEXT_HOP attribute changes such that the 1817 immediate next hop changes, route selection should be recalculated as 1818 specified above. 1820 Unfeasible routes shall be removed from the Loc-RIB, and correspond- 1821 ing unfeasible routes shall then be removed from the Adj-RIBs-In. 1823 9.1.2.1 Breaking Ties (Phase 2) 1825 In its Adj-RIBs-In a BGP speaker may have several routes to the same 1826 destination that have the same degree of preference. The local 1827 speaker can select only one of these routes for inclusion in the 1828 associated Loc-RIB. The local speaker considers all routes with the 1829 same degress of preference, both those received from internal peers, 1830 and those received from external peers. 1832 The following tie-breaking procedure assumes that for each candidate 1833 route all the BGP speakers within an autonomous system can ascertain 1834 the cost of a path (interior distance) to the address depicted by the 1835 NEXT_HOP attribute of the route. 1837 The tie-breaking algorithm begins by considering all equally prefer- 1838 able routes and then selects routes to be removed from consideration. 1839 The algorithm terminates as soon as only one route remains in consid- 1840 eration. The criteria must be applied in the order specified. 1842 Several of the criteria are described using pseudo-code. Note that 1844 RFC DRAFT October 1996 1846 the pseudo-code shown was chosen for clarity, not efficiency. It is 1847 not intended to specify any particular implementation. BGP implemen- 1848 tations MAY use any algorithm which produces the same results as 1849 those described here. 1851 a) Remove from consideration routes with less-preferred 1852 MULTI_EXIT_DISC attributes. MULTI_EXIT_DISC is only comparable 1853 between routes learned from the same neighboring AS. Routes which 1854 do not have the MULTI_EXIT_DISC attribute are considered to have 1855 the highest possible MULTI_EXIT_DISC value. 1857 This is also described in the following procedure: 1859 for m = all routes still under consideration 1860 for n = all routes still under consideration 1861 if (neighborAS(m) == neighborAS(n)) and (MED(n) < MED(m)) 1862 remove route m from consideration 1864 In the pseudo-code above, MED(n) is a function which returns the 1865 value of route n's MULTI_EXIT_DISC attribute. If route n has no 1866 MULTI_EXIT_DISC attribute, the function returns the highest possi- 1867 ble MULTI_EXIT_DISC value, i.e. 2^32-1. 1869 Similarly, neighborAS(n) is a function which returns the neighbor 1870 AS from which the route was received. 1872 b) Remove from consideration any routes with less-preferred inte- 1873 rior cost. The interior cost of a route is determined by calcu- 1874 lating the metric to the next hop for the route using the interior 1875 routing protocol(s). If the next hop for a route is reachable, 1876 but no cost can be determined, then this step should be should be 1877 skipped (equivalently, consider all routes to have equal costs). 1879 This is also described in the following procedure. 1881 for m = all routes still under consideration 1882 for n = all routes in still under consideration 1883 if (cost(n) is better than cost(m)) 1884 remove m from consideration 1886 In the pseudo-code above, cost(n) is a function which returns the 1887 cost of the path (interior distance) to the address given in the 1888 NEXT_HOP attribute of the route. 1890 c) If at least one of the candidate routes was received from an 1891 external peer in a neighboring autonomous system, remove from con- 1892 sideration all routes which were received from internal peers. 1894 RFC DRAFT October 1996 1896 d) Remove from consideration all routes other than the route that 1897 was advertised by the BGP speaker whose BGP Identifier has the 1898 lowest value. 1900 9.1.3 Phase 3: Route Dissemination 1902 The Phase 3 decision function shall be invoked on completion of Phase 1903 2, or when any of the following events occur: 1905 a) when routes in a Loc-RIB to local destinations have changed 1907 b) when locally generated routes learned by means outside of BGP 1908 have changed 1910 c) when a new BGP speaker - BGP speaker connection has been estab- 1911 lished 1913 The Phase 3 function is a separate process which completes when it 1914 has no further work to do. The Phase 3 Routing Decision function 1915 shall be blocked from running while the Phase 2 decision function is 1916 in process. 1918 All routes in the Loc-RIB shall be processed into a corresponding 1919 entry in the associated Adj-RIBs-Out. Route aggregation and informa- 1920 tion reduction techniques (see 9.2.4.1) may optionally be applied. 1922 For the benefit of future support of inter-AS multicast capabilities, 1923 a BGP speaker that participates in inter-AS multicast routing shall 1924 advertise a route it receives from one of its external peers and if 1925 it installs it in its Loc-RIB, it shall advertise it back to the peer 1926 from which the route was received. For a BGP speaker that does not 1927 participate in inter-AS multicast routing such an advertisement is 1928 optional. When doing such an advertisement, the NEXT_HOP attribute 1929 should be set to the address of the peer. An implementation may also 1930 optimize such an advertisement by truncating information in the 1931 AS_PATH attribute to include only its own AS number and that of the 1932 peer that advertised the route (such truncation requires the ORIGIN 1933 attribute to be set to INCOMPLETE). In addition an implementation is 1934 not required to pass optional or discretionary path attributes with 1935 such an advertisement. 1937 When the updating of the Adj-RIBs-Out and the Forwarding Information 1938 Base (FIB) is complete, the local BGP speaker shall run the external 1939 update process of 9.2.2. 1941 RFC DRAFT October 1996 1943 9.1.4 Overlapping Routes 1945 A BGP speaker may transmit routes with overlapping Network Layer 1946 Reachability Information (NLRI) to another BGP speaker. NLRI overlap 1947 occurs when a set of destinations are identified in non-matching mul- 1948 tiple routes. Since BGP encodes NLRI using IP prefixes, overlap will 1949 always exhibit subset relationships. A route describing a smaller 1950 set of destinations (a longer prefix) is said to be more specific 1951 than a route describing a larger set of destinations (a shorted pre- 1952 fix); similarly, a route describing a larger set of destinations (a 1953 shorter prefix) is said to be less specific than a route describing a 1954 smaller set of destinations (a longer prefix). 1956 The precedence relationship effectively decomposes less specific 1957 routes into two parts: 1959 - a set of destinations described only by the less specific 1960 route, and 1962 - a set of destinations described by the overlap of the less spe- 1963 cific and the more specific routes 1965 When overlapping routes are present in the same Adj-RIB-In, the more 1966 specific route shall take precedence, in order from more specific to 1967 least specific. 1969 The set of destinations described by the overlap represents a portion 1970 of the less specific route that is feasible, but is not currently in 1971 use. If a more specific route is later withdrawn, the set of desti- 1972 nations described by the overlap will still be reachable using the 1973 less specific route. 1975 If a BGP speaker receives overlapping routes, the Decision Process 1976 shall take into account the semantics of the overlapping routes. In 1977 particular, if a BGP speaker accepts the less specific route while 1978 rejecting the more specific route from the same peer, then the desti- 1979 nations represented by the overlap may not forward along the ASs 1980 listed in the AS_PATH attribute of that route. Therefore, a BGP 1981 speaker has the following choices: 1983 a) Install both the less and the more specific routes 1985 b) Install the more specific route only 1987 c) Install the non-overlapping part of the less specific 1988 route only (that implies de-aggregation) 1990 RFC DRAFT October 1996 1992 d) Aggregate the two routes and install the aggregated route 1994 e) Install the less specific route only 1996 f) Install neither route 1998 If a BGP speaker chooses e), then it MUST add ATOMIC_AGGREGATE 1999 attribute to the route. A route that carries ATOMIC_AGGREGATE 2000 attribute can not be de-aggregated. That is, the NLRI of this route 2001 can not be made more specific. Forwarding along such a route does 2002 not guarantee that IP packets will actually traverse only ASs listed 2003 in the AS_PATH attribute of the route. If a BGP speaker chooses a), 2004 it must not advertise the more general route without the more spe- 2005 cific route. 2007 9.2 Update-Send Process 2009 The Update-Send process is responsible for advertising UPDATE mes- 2010 sages to all peers. For example, it distributes the routes chosen by 2011 the Decision Process to other BGP speakers which may be located in 2012 either the same autonomous system or a neighboring autonomous system. 2013 Rules for information exchange between BGP speakers located in dif- 2014 ferent autonomous systems are given in 9.2.2; rules for information 2015 exchange between BGP speakers located in the same autonomous system 2016 are given in 9.2.1. 2018 Distribution of routing information between a set of BGP speakers, 2019 all of which are located in the same autonomous system, is referred 2020 to as internal distribution. 2022 9.2.1 Internal Updates 2024 The Internal update process is concerned with the distribution of 2025 routing information to internal peers. 2027 When a BGP speaker receives an UPDATE message from an internal peer, 2028 the receiving BGP speaker shall not re-distribute the routing infor- 2029 mation contained in that UPDATE message to other internal peers. 2031 When a BGP speaker receives a new route from an external peer, it 2032 shall advertise that route to all other internal peers by means of an 2033 UPDATE message if any of the following conditions occur: 2035 1) the degree of preference assigned to the newly received route 2037 RFC DRAFT October 1996 2039 by the local BGP speaker is higher than the degree of preference 2040 that the local speaker has assigned to other routes that have been 2041 received from external peers, or 2043 2) there are no other routes that have been received from external 2044 peers, or 2046 3) the newly received route is selected as a result of breaking a 2047 tie between several routes which have the highest degree of pref- 2048 erence, and the same destination (the tie-breaking procedure is 2049 specified in 9.2.1.1). 2051 When a BGP speaker receives an UPDATE message with a non-empty WITH- 2052 DRAWN ROUTES field, it shall remove from its Adj-RIB-In all routes 2053 whose destinations was carried in this field (as IP prefixes). The 2054 speaker shall take the following additional steps: 2056 1) if the corresponding feasible route had not been previously 2057 advertised, then no further action is necessary 2059 2) if the corresponding feasible route had been previously adver- 2060 tised, then: 2062 i) if a new route is selected for advertisement that has the 2063 same Network Layer Reachability Information as the unfeasible 2064 routes, then the local BGP speaker shall advertise the replace- 2065 ment route 2067 ii) if a replacement route is not available for advertisement, 2068 then the BGP speaker shall include the destinations of the 2069 unfeasible route (in form of IP prefixes) in the WITHDRAWN 2070 ROUTES field of an UPDATE message, and shall send this message 2071 to each peer to whom it had previously advertised the corre- 2072 sponding feasible route. 2074 All feasible routes which are advertised shall be placed in the 2075 appropriate Adj-RIBs-Out, and all unfeasible routes which are adver- 2076 tised shall be removed from the Adj-RIBs-Out. 2078 9.2.1.1 Breaking Ties (Internal Updates) 2080 If a local BGP speaker has connections to several external peers, 2081 there will be multiple Adj-RIBs-In associated with these peers. These 2082 Adj-RIBs-In might contain several equally preferable routes to the 2083 same destination, all of which were advertised by external peers. 2085 RFC DRAFT October 1996 2087 The local BGP speaker shall select one of these routes according to 2088 the following rules: 2090 a) If the candidate routes differ only in their NEXT_HOP and 2091 MULTI_EXIT_DISC attributes, and the local system is configured to 2092 take into account the MULTI_EXIT_DISC attribute, select the route 2093 that has the lowest value of the MULTI_EXIT_DISC attribute. A 2094 route with the MULTI_EXIT_DISC attribute shall be preferred to a 2095 route without the MULTI_EXIT_DISC attribute. 2097 b) If the local system can ascertain the cost of a path to the 2098 entity depicted by the NEXT_HOP attribute of the candidate route, 2099 select the route with the lowest cost. 2101 c) In all other cases, select the route that was advertised by the 2102 BGP speaker whose BGP Identifier has the lowest value. 2104 9.2.2 External Updates 2106 The external update process is concerned with the distribution of 2107 routing information to external peers. As part of Phase 3 route 2108 selection process, the BGP speaker has updated its Adj-RIBs-Out and 2109 its Forwarding Table. All newly installed routes and all newly unfea- 2110 sible routes for which there is no replacement route shall be adver- 2111 tised to external peers by means of UPDATE message. 2113 Any routes in the Loc-RIB marked as unfeasible shall be removed. 2114 Changes to the reachable destinations within its own autonomous sys- 2115 tem shall also be advertised in an UPDATE message. 2117 9.2.3 Controlling Routing Traffic Overhead 2119 The BGP protocol constrains the amount of routing traffic (that is, 2120 UPDATE messages) in order to limit both the link bandwidth needed to 2121 advertise UPDATE messages and the processing power needed by the 2122 Decision Process to digest the information contained in the UPDATE 2123 messages. 2125 9.2.3.1 Frequency of Route Advertisement 2127 The parameter MinRouteAdvertisementInterval determines the minimum 2129 RFC DRAFT October 1996 2131 amount of time that must elapse between advertisement of routes to a 2132 particular destination from a single BGP speaker. This rate limiting 2133 procedure applies on a per-destination basis, although the value of 2134 MinRouteAdvertisementInterval is set on a per BGP peer basis. 2136 Two UPDATE messages sent from a single BGP speaker that advertise 2137 feasible routes to some common set of destinations received from 2138 external peers must be separated by at least MinRouteAdvertisementIn- 2139 terval. Clearly, this can only be achieved precisely by keeping a 2140 separate timer for each common set of destinations. This would be 2141 unwarranted overhead. Any technique which ensures that the interval 2142 between two UPDATE messages sent from a single BGP speaker that 2143 advertise feasible routes to some common set of destinations received 2144 from external peers will be at least MinRouteAdvertisementInterval, 2145 and will also ensure a constant upper bound on the interval is 2146 acceptable. 2148 Since fast convergence is needed within an autonomous system, this 2149 procedure does not apply for routes receives from other internal 2150 peers. To avoid long-lived black holes, the procedure does not apply 2151 to the explicit withdrawal of unfeasible routes (that is, routes 2152 whose destinations (expressed as IP prefixes) are listed in the WITH- 2153 DRAWN ROUTES field of an UPDATE message). 2155 This procedure does not limit the rate of route selection, but only 2156 the rate of route advertisement. If new routes are selected multiple 2157 times while awaiting the expiration of MinRouteAdvertisementInterval, 2158 the last route selected shall be advertised at the end of MinRouteAd- 2159 vertisementInterval. 2161 9.2.3.2 Frequency of Route Origination 2163 The parameter MinASOriginationInterval determines the minimum amount 2164 of time that must elapse between successive advertisements of UPDATE 2165 messages that report changes within the advertising BGP speaker's own 2166 autonomous systems. 2168 9.2.3.3 Jitter 2170 To minimize the likelihood that the distribution of BGP messages by a 2171 given BGP speaker will contain peaks, jitter should be applied to the 2172 timers associated with MinASOriginationInterval, Keepalive, and Min- 2173 RouteAdvertisementInterval. A given BGP speaker shall apply the same 2174 jitter to each of these quantities regardless of the destinations to 2176 RFC DRAFT October 1996 2178 which the updates are being sent; that is, jitter will not be applied 2179 on a "per peer" basis. 2181 The amount of jitter to be introduced shall be determined by multi- 2182 plying the base value of the appropriate timer by a random factor 2183 which is uniformly distributed in the range from 0.75 to 1.0. 2185 9.2.4 Efficient Organization of Routing Information 2187 Having selected the routing information which it will advertise, a 2188 BGP speaker may avail itself of several methods to organize this 2189 information in an efficient manner. 2191 9.2.4.1 Information Reduction 2193 Information reduction may imply a reduction in granularity of policy 2194 control - after information is collapsed, the same policies will 2195 apply to all destinations and paths in the equivalence class. 2197 The Decision Process may optionally reduce the amount of information 2198 that it will place in the Adj-RIBs-Out by any of the following meth- 2199 ods: 2201 a) Network Layer Reachability Information (NLRI): 2203 Destination IP addresses can be represented as IP address pre- 2204 fixes. In cases where there is a correspondence between the 2205 address structure and the systems under control of an autonomous 2206 system administrator, it will be possible to reduce the size of 2207 the NLRI carried in the UPDATE messages. 2209 b) AS_PATHs: 2211 AS path information can be represented as ordered AS_SEQUENCEs or 2212 unordered AS_SETs. AS_SETs are used in the route aggregation algo- 2213 rithm described in 9.2.4.2. They reduce the size of the AS_PATH 2214 information by listing each AS number only once, regardless of how 2215 many times it may have appeared in multiple AS_PATHs that were 2216 aggregated. 2218 An AS_SET implies that the destinations listed in the NLRI can be 2219 reached through paths that traverse at least some of the con- 2220 stituent autonomous systems. AS_SETs provide sufficient informa- 2221 tion to avoid routing information looping; however their use may 2223 RFC DRAFT October 1996 2225 prune potentially feasible paths, since such paths are no longer 2226 listed individually as in the form of AS_SEQUENCEs. In practice 2227 this is not likely to be a problem, since once an IP packet 2228 arrives at the edge of a group of autonomous systems, the BGP 2229 speaker at that point is likely to have more detailed path infor- 2230 mation and can distinguish individual paths to destinations. 2232 9.2.4.2 Aggregating Routing Information 2234 Aggregation is the process of combining the characteristics of sev- 2235 eral different routes in such a way that a single route can be adver- 2236 tised. Aggregation can occur as part of the decision process to 2237 reduce the amount of routing information that will be placed in the 2238 Adj-RIBs-Out. 2240 Aggregation reduces the amount of information that a BGP speaker must 2241 store and exchange with other BGP speakers. Routes can be aggregated 2242 by applying the following procedure separately to path attributes of 2243 like type and to the Network Layer Reachability Information. 2245 Routes that have the following attributes shall not be aggregated 2246 unless the corresponding attributes of each route are identical: 2247 MULTI_EXIT_DISC, NEXT_HOP. 2249 Path attributes that have different type codes can not be aggregated 2250 together. Path of the same type code may be aggregated, according to 2251 the following rules: 2253 ORIGIN attribute: If at least one route among routes that are 2254 aggregated has ORIGIN with the value INCOMPLETE, then the aggre- 2255 gated route must have the ORIGIN attribute with the value INCOM- 2256 PLETE. Otherwise, if at least one route among routes that are 2257 aggregated has ORIGIN with the value EGP, then the aggregated 2258 route must have the origin attribute with the value EGP. In all 2259 other case the value of the ORIGIN attribute of the aggregated 2260 route is INTERNAL. 2262 AS_PATH attribute: If routes to be aggregated have identical 2263 AS_PATH attributes, then the aggregated route has the same AS_PATH 2264 attribute as each individual route. 2266 For the purpose of aggregating AS_PATH attributes we model each AS 2267 within the AS_PATH attribute as a tuple , where 2268 "type" identifies a type of the path segment the AS belongs to 2269 (e.g. AS_SEQUENCE, AS_SET), and "value" is the AS number. If the 2270 routes to be aggregated have different AS_PATH attributes, then 2272 RFC DRAFT October 1996 2274 the aggregated AS_PATH attribute shall satisfy all of the follow- 2275 ing conditions: 2277 - all tuples of the type AS_SEQUENCE in the aggregated AS_PATH 2278 shall appear in all of the AS_PATH in the initial set of routes 2279 to be aggregated. 2281 - all tuples of the type AS_SET in the aggregated AS_PATH shall 2282 appear in at least one of the AS_PATH in the initial set (they 2283 may appear as either AS_SET or AS_SEQUENCE types). 2285 - for any tuple X of the type AS_SEQUENCE in the aggregated 2286 AS_PATH which precedes tuple Y in the aggregated AS_PATH, X 2287 precedes Y in each AS_PATH in the initial set which contains Y, 2288 regardless of the type of Y. 2290 - No tuple with the same value shall appear more than once in 2291 the aggregated AS_PATH, regardless of the tuple's type. 2293 An implementation may choose any algorithm which conforms to these 2294 rules. At a minimum a conformant implementation shall be able to 2295 perform the following algorithm that meets all of the above condi- 2296 tions: 2298 - determine the longest leading sequence of tuples (as defined 2299 above) common to all the AS_PATH attributes of the routes to be 2300 aggregated. Make this sequence the leading sequence of the 2301 aggregated AS_PATH attribute. 2303 - set the type of the rest of the tuples from the AS_PATH 2304 attributes of the routes to be aggregated to AS_SET, and append 2305 them to the aggregated AS_PATH attribute. 2307 - if the aggregated AS_PATH has more than one tuple with the 2308 same value (regardless of tuple's type), eliminate all, but one 2309 such tuple by deleting tuples of the type AS_SET from the 2310 aggregated AS_PATH attribute. 2312 Appendix 6, section 6.8 presents another algorithm that satisfies 2313 the conditions and allows for more complex policy configurations. 2315 ATOMIC_AGGREGATE: If at least one of the routes to be aggregated 2316 has ATOMIC_AGGREGATE path attribute, then the aggregated route 2317 shall have this attribute as well. 2319 AGGREGATOR: All AGGREGATOR attributes of all routes to be aggre- 2320 gated should be ignored. 2322 RFC DRAFT October 1996 2324 9.3 Route Selection Criteria 2326 Generally speaking, additional rules for comparing routes among sev- 2327 eral alternatives are outside the scope of this document. There are 2328 two exceptions: 2330 - If the local AS appears in the AS path of the new route being 2331 considered, then that new route cannot be viewed as better than 2332 any other route. If such a route were ever used, a routing loop 2333 would result. 2335 - In order to achieve successful distributed operation, only 2336 routes with a likelihood of stability can be chosen. Thus, an AS 2337 must avoid using unstable routes, and it must not make rapid spon- 2338 taneous changes to its choice of route. Quantifying the terms 2339 "unstable" and "rapid" in the previous sentence will require expe- 2340 rience, but the principle is clear. 2342 9.4 Originating BGP routes 2344 A BGP speaker may originate BGP routes by injecting routing informa- 2345 tion acquired by some other means (e.g. via an IGP) into BGP. A BGP 2346 speaker that originates BGP routes shall assign the degree of prefer- 2347 ence to these routes by passing them through the Decision Process 2348 (see Section 9.1). These routes may also be distributed to other BGP 2349 speakers within the local AS as part of the Internal update process 2350 (see Section 9.2.1). The decision whether to distribute non-BGP 2351 acquired routes within an AS via BGP or not depends on the environ- 2352 ment within the AS (e.g. type of IGP) and should be controlled via 2353 configuration. 2355 Appendix 1. BGP FSM State Transitions and Actions. 2357 This Appendix discusses the transitions between states in the BGP FSM 2358 in response to BGP events. The following is the list of these states 2359 and events when the negotiated Hold Time value is non-zero. 2361 BGP States: 2363 1 - Idle 2364 2 - Connect 2365 3 - Active 2367 RFC DRAFT October 1996 2369 4 - OpenSent 2370 5 - OpenConfirm 2371 6 - Established 2373 BGP Events: 2375 1 - BGP Start 2376 2 - BGP Stop 2377 3 - BGP Transport connection open 2378 4 - BGP Transport connection closed 2379 5 - BGP Transport connection open failed 2380 6 - BGP Transport fatal error 2381 7 - ConnectRetry timer expired 2382 8 - Hold Timer expired 2383 9 - KeepAlive timer expired 2384 10 - Receive OPEN message 2385 11 - Receive KEEPALIVE message 2386 12 - Receive UPDATE messages 2387 13 - Receive NOTIFICATION message 2389 The following table describes the state transitions of the BGP FSM 2390 and the actions triggered by these transitions. 2392 Event Actions Message Sent Next State 2393 -------------------------------------------------------------------- 2394 Idle (1) 2395 1 Initialize resources none 2 2396 Start ConnectRetry timer 2397 Initiate a transport connection 2398 others none none 1 2400 Connect(2) 2401 1 none none 2 2402 3 Complete initialization OPEN 4 2403 Clear ConnectRetry timer 2404 5 Restart ConnectRetry timer none 3 2405 7 Restart ConnectRetry timer none 2 2406 Initiate a transport connection 2407 others Release resources none 1 2409 Active (3) 2410 1 none none 3 2411 3 Complete initialization OPEN 4 2413 RFC DRAFT October 1996 2415 Clear ConnectRetry timer 2416 5 Close connection 3 2417 Restart ConnectRetry timer 2418 7 Restart ConnectRetry timer none 2 2419 Initiate a transport connection 2420 others Release resources none 1 2422 OpenSent(4) 2423 1 none none 4 2424 4 Close transport connection none 3 2425 Restart ConnectRetry timer 2426 6 Release resources none 1 2427 10 Process OPEN is OK KEEPALIVE 5 2428 Process OPEN failed NOTIFICATION 1 2429 others Close transport connection NOTIFICATION 1 2430 Release resources 2432 OpenConfirm (5) 2433 1 none none 5 2434 4 Release resources none 1 2435 6 Release resources none 1 2436 9 Restart KeepAlive timer KEEPALIVE 5 2437 11 Complete initialization none 6 2438 Restart Hold Timer 2439 13 Close transport connection 1 2440 Release resources 2441 others Close transport connection NOTIFICATION 1 2442 Release resources 2444 Established (6) 2445 1 none none 6 2446 4 Release resources none 1 2447 6 Release resources none 1 2448 9 Restart KeepAlive timer KEEPALIVE 6 2449 11 Restart Hold Timer KEEPALIVE 6 2450 12 Process UPDATE is OK UPDATE 6 2451 Process UPDATE failed NOTIFICATION 1 2452 13 Close transport connection 1 2453 Release resources 2454 others Close transport connection NOTIFICATION 1 2455 Release resources 2456 --------------------------------------------------------------------- 2458 The following is a condensed version of the above state transition 2460 RFC DRAFT October 1996 2462 table. 2464 Events| Idle | Connect | Active | OpenSent | OpenConfirm | Estab 2465 | (1) | (2) | (3) | (4) | (5) | (6) 2466 |--------------------------------------------------------------- 2467 1 | 2 | 2 | 3 | 4 | 5 | 6 2468 | | | | | | 2469 2 | 1 | 1 | 1 | 1 | 1 | 1 2470 | | | | | | 2471 3 | 1 | 4 | 4 | 1 | 1 | 1 2472 | | | | | | 2473 4 | 1 | 1 | 1 | 3 | 1 | 1 2474 | | | | | | 2475 5 | 1 | 3 | 3 | 1 | 1 | 1 2476 | | | | | | 2477 6 | 1 | 1 | 1 | 1 | 1 | 1 2478 | | | | | | 2479 7 | 1 | 2 | 2 | 1 | 1 | 1 2480 | | | | | | 2481 8 | 1 | 1 | 1 | 1 | 1 | 1 2482 | | | | | | 2483 9 | 1 | 1 | 1 | 1 | 5 | 6 2484 | | | | | | 2485 10 | 1 | 1 | 1 | 1 or 5 | 1 | 1 2486 | | | | | | 2487 11 | 1 | 1 | 1 | 1 | 6 | 6 2488 | | | | | | 2489 12 | 1 | 1 | 1 | 1 | 1 | 1 or 6 2490 | | | | | | 2491 13 | 1 | 1 | 1 | 1 | 1 | 1 2492 | | | | | | 2493 --------------------------------------------------------------- 2495 Appendix 2. Comparison with RFC1267 2497 BGP-4 is capable of operating in an environment where a set of reach- 2498 able destinations may be expressed via a single IP prefix. The con- 2499 cept of network classes, or subnetting is foreign to BGP-4. To 2500 accommodate these capabilities BGP-4 changes semantics and encoding 2501 associated with the AS_PATH attribute. New text has been added to 2503 RFC DRAFT October 1996 2505 define semantics associated with IP prefixes. These abilities allow 2506 BGP-4 to support the proposed supernetting scheme [9]. 2508 To simplify configuration this version introduces a new attribute, 2509 LOCAL_PREF, that facilitates route selection procedures. 2511 The INTER_AS_METRIC attribute has been renamed to be MULTI_EXIT_DISC. 2512 A new attribute, ATOMIC_AGGREGATE, has been introduced to insure that 2513 certain aggregates are not de-aggregated. Another new attribute, 2514 AGGREGATOR, can be added to aggregate routes in order to advertise 2515 which AS and which BGP speaker within that AS caused the aggregation. 2517 To insure that Hold Timers are symmetric, the Hold Time is now nego- 2518 tiated on a per-connection basis. Hold Times of zero are now sup- 2519 ported. 2521 Appendix 3. Comparison with RFC 1163 2523 All of the changes listed in Appendix 2, plus the following. 2525 To detect and recover from BGP connection collision, a new field (BGP 2526 Identifier) has been added to the OPEN message. New text (Section 2527 6.8) has been added to specify the procedure for detecting and recov- 2528 ering from collision. 2530 The new document no longer restricts the border router that is passed 2531 in the NEXT_HOP path attribute to be part of the same Autonomous Sys- 2532 tem as the BGP Speaker. 2534 New document optimizes and simplifies the exchange of the information 2535 about previously reachable routes. 2537 Appendix 4. Comparison with RFC 1105 2539 All of the changes listed in Appendices 2 and 3, plus the following. 2541 Minor changes to the RFC1105 Finite State Machine were necessary to 2542 accommodate the TCP user interface provided by 4.3 BSD. 2544 The notion of Up/Down/Horizontal relations present in RFC1105 has 2545 been removed from the protocol. 2547 The changes in the message format from RFC1105 are as follows: 2549 1. The Hold Time field has been removed from the BGP header and 2551 RFC DRAFT October 1996 2553 added to the OPEN message. 2555 2. The version field has been removed from the BGP header and 2556 added to the OPEN message. 2558 3. The Link Type field has been removed from the OPEN message. 2560 4. The OPEN CONFIRM message has been eliminated and replaced with 2561 implicit confirmation provided by the KEEPALIVE message. 2563 5. The format of the UPDATE message has been changed signifi- 2564 cantly. New fields were added to the UPDATE message to support 2565 multiple path attributes. 2567 6. The Marker field has been expanded and its role broadened to 2568 support authentication. 2570 Note that quite often BGP, as specified in RFC 1105, is referred 2571 to as BGP-1, BGP, as specified in RFC 1163, is referred to as 2572 BGP-2, BGP, as specified in RFC1267 is referred to as BGP-3, and 2573 BGP, as specified in this document is referred to as BGP-4. 2575 Appendix 5. TCP options that may be used with BGP 2577 If a local system TCP user interface supports TCP PUSH function, then 2578 each BGP message should be transmitted with PUSH flag set. Setting 2579 PUSH flag forces BGP messages to be transmitted promptly to the 2580 receiver. 2582 If a local system TCP user interface supports setting precedence for 2583 TCP connection, then the BGP transport connection should be opened 2584 with precedence set to Internetwork Control (110) value (see also 2585 [6]). 2587 Appendix 6. Implementation Recommendations 2589 This section presents some implementation recommendations. 2591 6.1 Multiple Networks Per Message 2593 The BGP protocol allows for multiple address prefixes with the same 2595 RFC DRAFT October 1996 2597 AS path and next-hop gateway to be specified in one message. Making 2598 use of this capability is highly recommended. With one address prefix 2599 per message there is a substantial increase in overhead in the 2600 receiver. Not only does the system overhead increase due to the 2601 reception of multiple messages, but the overhead of scanning the 2602 routing table for updates to BGP peers and other routing protocols 2603 (and sending the associated messages) is incurred multiple times as 2604 well. One method of building messages containing many address pre- 2605 fixes per AS path and gateway from a routing table that is not orga- 2606 nized per AS path is to build many messages as the routing table is 2607 scanned. As each address prefix is processed, a message for the asso- 2608 ciated AS path and gateway is allocated, if it does not exist, and 2609 the new address prefix is added to it. If such a message exists, the 2610 new address prefix is just appended to it. If the message lacks the 2611 space to hold the new address prefix, it is transmitted, a new mes- 2612 sage is allocated, and the new address prefix is inserted into the 2613 new message. When the entire routing table has been scanned, all 2614 allocated messages are sent and their resources released. Maximum 2615 compression is achieved when all the destinations covered by the 2616 address prefixes share a gateway and common path attributes, making 2617 it possible to send many address prefixes in one 4096-byte message. 2619 When peering with a BGP implementation that does not compress multi- 2620 ple address prefixes into one message, it may be necessary to take 2621 steps to reduce the overhead from the flood of data received when a 2622 peer is acquired or a significant network topology change occurs. One 2623 method of doing this is to limit the rate of updates. This will elim- 2624 inate the redundant scanning of the routing table to provide flash 2625 updates for BGP peers and other routing protocols. A disadvantage of 2626 this approach is that it increases the propagation latency of routing 2627 information. By choosing a minimum flash update interval that is not 2628 much greater than the time it takes to process the multiple messages 2629 this latency should be minimized. A better method would be to read 2630 all received messages before sending updates. 2632 6.2 Processing Messages on a Stream Protocol 2634 BGP uses TCP as a transport mechanism. Due to the stream nature of 2635 TCP, all the data for received messages does not necessarily arrive 2636 at the same time. This can make it difficult to process the data as 2637 messages, especially on systems such as BSD Unix where it is not pos- 2638 sible to determine how much data has been received but not yet pro- 2639 cessed. 2641 One method that can be used in this situation is to first try to read 2642 just the message header. For the KEEPALIVE message type, this is a 2644 RFC DRAFT October 1996 2646 complete message; for other message types, the header should first be 2647 verified, in particular the total length. If all checks are success- 2648 ful, the specified length, minus the size of the message header is 2649 the amount of data left to read. An implementation that would "hang" 2650 the routing information process while trying to read from a peer 2651 could set up a message buffer (4096 bytes) per peer and fill it with 2652 data as available until a complete message has been received. 2654 6.3 Reducing route flapping 2656 To avoid excessive route flapping a BGP speaker which needs to with- 2657 draw a destination and send an update about a more specific or less 2658 specific route SHOULD combine them into the same UPDATE message. 2660 6.4 BGP Timers 2662 BGP employs five timers: ConnectRetry, Hold Time, KeepAlive, MinASO- 2663 riginationInterval, and MinRouteAdvertisementInterval The suggested 2664 value for the ConnectRetry timer is 120 seconds. The suggested value 2665 for the Hold Time is 90 seconds. The suggested value for the 2666 KeepAlive timer is 30 seconds. The suggested value for the MinASO- 2667 riginationInterval is 15 seconds. The suggested value for the Min- 2668 RouteAdvertisementInterval is 30 seconds. 2670 An implementation of BGP MUST allow these timers to be configurable. 2672 6.5 Path attribute ordering 2674 Implementations which combine update messages as described above in 2675 6.1 may prefer to see all path attributes presented in a known order. 2676 This permits them to quickly identify sets of attributes from differ- 2677 ent update messages which are semantically identical. To facilitate 2678 this, it is a useful optimization to order the path attributes 2679 according to type code. This optimization is entirely optional. 2681 6.6 AS_SET sorting 2683 Another useful optimization that can be done to simplify this situa- 2684 tion is to sort the AS numbers found in an AS_SET. This optimization 2685 is entirely optional. 2687 RFC DRAFT October 1996 2689 6.7 Control over version negotiation 2691 Since BGP-4 is capable of carrying aggregated routes which cannot be 2692 properly represented in BGP-3, an implementation which supports BGP-4 2693 and another BGP version should provide the capability to only speak 2694 BGP-4 on a per-peer basis. 2696 6.8 Complex AS_PATH aggregation 2698 An implementation which chooses to provide a path aggregation algo- 2699 rithm which retains significant amounts of path information may wish 2700 to use the following procedure: 2702 For the purpose of aggregating AS_PATH attributes of two routes, 2703 we model each AS as a tuple , where "type" identifies 2704 a type of the path segment the AS belongs to (e.g. AS_SEQUENCE, 2705 AS_SET), and "value" is the AS number. Two ASs are said to be the 2706 same if their corresponding tuples are the same. 2708 The algorithm to aggregate two AS_PATH attributes works as fol- 2709 lows: 2711 a) Identify the same ASs (as defined above) within each AS_PATH 2712 attribute that are in the same relative order within both 2713 AS_PATH attributes. Two ASs, X and Y, are said to be in the 2714 same order if either: 2715 - X precedes Y in both AS_PATH attributes, or - Y precedes X 2716 in both AS_PATH attributes. 2718 b) The aggregated AS_PATH attribute consists of ASs identified 2719 in (a) in exactly the same order as they appear in the AS_PATH 2720 attributes to be aggregated. If two consecutive ASs identified 2721 in (a) do not immediately follow each other in both of the 2722 AS_PATH attributes to be aggregated, then the intervening ASs 2723 (ASs that are between the two consecutive ASs that are the 2724 same) in both attributes are combined into an AS_SET path seg- 2725 ment that consists of the intervening ASs from both AS_PATH 2726 attributes; this segment is then placed in between the two con- 2727 secutive ASs identified in (a) of the aggregated attribute. If 2728 two consecutive ASs identified in (a) immediately follow each 2729 other in one attribute, but do not follow in another, then the 2730 intervening ASs of the latter are combined into an AS_SET path 2731 segment; this segment is then placed in between the two consec- 2732 utive ASs identified in (a) of the aggregated attribute. 2734 RFC DRAFT October 1996 2736 If as a result of the above procedure a given AS number appears 2737 more than once within the aggregated AS_PATH attribute, all, but 2738 the last instance (rightmost occurrence) of that AS number should 2739 be removed from the aggregated AS_PATH attribute. 2741 References 2743 [1] Mills, D., "Exterior Gateway Protocol Formal Specification", RFC 2744 904, BBN, April 1984. 2746 [2] Rekhter, Y., "EGP and Policy Based Routing in the New NSFNET 2747 Backbone", RFC 1092, T.J. Watson Research Center, February 1989. 2749 [3] Braun, H-W., "The NSFNET Routing Architecture", RFC 1093, 2750 MERIT/NSFNET Project, February 1989. 2752 [4] Postel, J., "Transmission Control Protocol - DARPA Internet Pro- 2753 gram Protocol Specification", RFC 793, DARPA, September 1981. 2755 [5] Rekhter, Y., and P. Gross, "Application of the Border Gateway 2756 Protocol in the Internet", T.J. Watson Research Center, IBM Corp., 2757 MCI, Internet Draft. 2759 [6] Postel, J., "Internet Protocol - DARPA Internet Program Protocol 2760 Specification", RFC 791, DARPA, September 1981. 2762 [7] "Information Processing Systems - Telecommunications and Informa- 2763 tion Exchange between Systems - Protocol for Exchange of Inter-domain 2764 Routeing Information among Intermediate Systems to Support Forwarding 2765 of ISO 8473 PDUs", ISO/IEC IS10747, 1993 2767 [8] Fuller, V., Li, T., Yu, J., and Varadhan, K., ""Classless Inter- 2768 Domain Routing (CIDR): an Address Assignment and Aggregation Strat- 2769 egy", RFC 1519, BARRNet, cisco, MERIT, OARnet, September 1993 2771 [9] Rekhter, Y., Li, T., "An Architecture for IP Address Allocation 2772 with CIDR", RFC 1518, T.J. Watson Research Center, cisco, September 2773 1993 2775 Security Considerations 2777 Security issues are not discussed in this document. 2779 RFC DRAFT October 1996 2781 Editors' Addresses 2783 Yakov Rekhter 2784 cisco Systems, Inc. 2785 170 W. Tasman Dr. 2786 San Jose, CA 95134 2787 email: yakov@cisco.com 2789 Tony Li 2790 Juniper Networks, Inc. 2791 3260 Jay St. 2792 Santa Clara, CA 95051 2793 (408) 327-1906 2794 email: tli@juniper.net