idnits 2.17.1 draft-ietf-idr-bgp4-06.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-19) 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 == The page length should not exceed 58 lines per page, but there was 58 longer pages, the longest (page 2) being 61 lines Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack an Abstract section. ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) ** The document seems to lack separate sections for Informative/Normative References. All references will be assumed normative when checking for downward references. ** There are 6 instances of too long lines in the document, the longest one being 5 characters in excess of 72. == There are 3 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 389: '...sage, a BGP speaker MUST calculate the...' RFC 2119 keyword, line 392: '... Hold Time MUST be either zero o...' RFC 2119 keyword, line 788: '... MUST NOT be sent more frequently th...' RFC 2119 keyword, line 789: '... implementation MAY adjust the rate a...' RFC 2119 keyword, line 793: '... messages MUST NOT be sent....' (28 more instances...) Miscellaneous warnings: ---------------------------------------------------------------------------- == Line 726 has weird spacing: '... Length are t...' == Line 1170 has weird spacing: '...is less than...' == Line 1657 has weird spacing: '...s whose desti...' == Line 2038 has weird spacing: '...nations of th...' == Line 2200 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 (June 1997) is 9805 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') -- Possible downref: Non-RFC (?) normative reference: ref. '4' -- 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: 17 errors (**), 0 flaws (~~), 9 warnings (==), 5 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 June 1997 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. 20 Distribution of this document is unlimited. 22 This document is an Internet Draft. Internet Drafts are working 23 documents of the Internet Engineering Task Force (IETF), its Areas, 24 and its Working Groups. Note that other groups may also distribute 25 working 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 December 1997 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 54 courtesy. 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 58 sections 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 John Stewart III, Paul Traina, and Curtis Villamizar for their 64 comments. 66 We would like to specially acknowledge numerous contributions by 67 Dennis Ferguson. 69 2. Introduction 71 The Border Gateway Protocol (BGP) is an inter-Autonomous System 72 routing protocol. It is built on experience gained with EGP as 73 defined in RFC 904 [1] and EGP usage in the NSFNET Backbone as 74 described in RFC 1092 [2] and RFC 1093 [3]. 76 The primary function of a BGP speaking system is to exchange network 77 reachability information with other BGP systems. This network 78 reachability information includes information on the list of 79 Autonomous Systems (ASs) that reachability information traverses. 80 This information is sufficient to construct a graph of AS 81 connectivity from which routing loops may be pruned and some policy 82 decisions at the AS level may be enforced. 84 BGP-4 provides a new set of mechanisms for supporting classless 85 interdomain routing. These mechanisms include support for 86 advertising an IP prefix and eliminates the concept of network 87 "class" within BGP. BGP-4 also introduces mechanisms which allow 88 aggregation of routes, including aggregation of AS paths. These 89 changes provide support for the proposed supernetting scheme [8, 9]. 91 To characterize the set of policy decisions that can be enforced 92 using BGP, one must focus on the rule that a BGP speaker advertise to 93 its peers (other BGP speakers which it communicates with) in 94 neighboring ASs only those routes that it itself uses. This rule 95 RFC DRAFT December 1997 97 reflects the "hop-by-hop" routing paradigm generally used throughout 98 the current Internet. Note that some policies cannot be supported by 99 the "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 103 neighboring AS. On the other hand, BGP can support any policy 104 conforming to the "hop-by-hop" routing paradigm. Since the current 105 Internet uses only the "hop-by-hop" routing paradigm and since BGP 106 can support any policy that conforms to that paradigm, BGP is highly 107 applicable 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 117 authentication mechanisms. The error notification mechanism used in 118 BGP assumes that the transport protocol supports a "graceful" close, 119 i.e., that all outstanding data will be delivered before the 120 connection is closed. 122 BGP uses TCP [4] as its transport protocol. TCP meets BGP's 123 transport requirements and is present in virtually all commercial 124 routers and hosts. In the following descriptions the phrase 125 "transport protocol connection" can be understood to refer to a TCP 126 connection. 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 132 exterior 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 138 single coherent interior routing plan and presents a consistent 139 picture 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 144 document [5]. This document is the first of a series of documents 145 RFC DRAFT December 1997 147 planned to explore various aspects of BGP application. Please send 148 comments to the BGP mailing list (bgp@ans.net). 150 3. Summary of Operation 152 Two systems form a transport protocol connection between one another. 153 They exchange messages to open and confirm the connection parameters. 154 The initial data flow is the entire BGP routing table. Incremental 155 updates are sent as the routing tables change. BGP does not require 156 periodic refresh of the entire BGP routing table. Therefore, a BGP 157 speaker must retain the current version of the entire BGP routing 158 tables of all of its peers for the duration of the connection. 159 KeepAlive messages are sent periodically to ensure the liveness of 160 the connection. Notification messages are sent in response to errors 161 or special conditions. If a connection encounters an error 162 condition, a notification message is sent and the connection is 163 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 170 applications 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 185 connections with each other. Alternately the interior routing 186 protocol can pass BGP information among routers within an AS, taking 187 care not to lose BGP attributes that will be needed by EBGP speakers 188 if transit connectivity is being provided. For the purpose of 189 discussion, it is assumed that BGP information is passed within an AS 190 using IBGP. Care must be taken to ensure that the interior routers 191 have all been updated with transit information before the EBGP 192 speakers announce to other ASs that transit service is being 193 provided. 195 RFC DRAFT December 1997 197 3.1 Routes: Advertisement and Storage 199 For purposes of this protocol a route is defined as a unit of 200 information that pairs a destination with the attributes of a path to 201 that destination: 203 - Routes are advertised between a pair of BGP speakers in UPDATE 204 messages: the destination is the systems whose IP addresses are 205 reported in the Network Layer Reachability Information (NLRI) 206 field, and the the path is the information reported in the path 207 attributes fields of the same UPDATE message. 209 - Routes are stored in the Routing Information Bases (RIBs): 210 namely, the Adj-RIBs-In, the Loc-RIB, and the Adj-RIBs-Out. Routes 211 that will be advertised to other BGP speakers must be present in 212 the Adj-RIB-Out; routes that will be used by the local BGP speaker 213 must be present in the Loc-RIB, and the next hop for each of these 214 routes must be present in the local BGP speaker's forwarding 215 information base; and routes that are received from other BGP 216 speakers are present in the Adj-RIBs-In. 218 If a BGP speaker chooses to advertise the route, it may add to or 219 modify the path attributes of the route before advertising it to a 220 peer. 222 BGP provides mechanisms by which a BGP speaker can inform its peer 223 that a previously advertised route is no longer available for use. 224 There are three methods by which a given BGP speaker can indicate 225 that a route has been withdrawn from service: 227 a) the IP prefix that expresses destinations for a previously 228 advertised route can be advertised in the WITHDRAWN ROUTES field 229 in the UPDATE message, thus marking the associated route as being 230 no longer available for use 232 b) a replacement route with the same Network Layer Reachability 233 Information can be advertised, or 235 c) the BGP speaker - BGP speaker connection can be closed, which 236 implicitly removes from service all routes which the pair of 237 speakers had advertised to each other. 239 RFC DRAFT December 1997 241 3.2 Routing Information Bases 243 The Routing Information Base (RIB) within a BGP speaker consists of 244 three distinct parts: 246 a) Adj-RIBs-In: The Adj-RIBs-In store routing information that has 247 been learned from inbound UPDATE messages. Their contents 248 represent routes that are available as an input to the Decision 249 Process. 251 b) Loc-RIB: The Loc-RIB contains the local routing information 252 that the BGP speaker has selected by applying its local policies 253 to the routing information contained in its Adj-RIBs-In. 255 c) Adj-RIBs-Out: The Adj-RIBs-Out store the information that the 256 local BGP speaker has selected for advertisement to its peers. The 257 routing information stored in the Adj-RIBs-Out will be carried in 258 the local BGP speaker's UPDATE messages and advertised to its 259 peers. 261 In summary, the Adj-RIBs-In contain unprocessed routing information 262 that has been advertised to the local BGP speaker by its peers; the 263 Loc-RIB contains the routes that have been selected by the local BGP 264 speaker's Decision Process; and the Adj-RIBs-Out organize the routes 265 for advertisement to specific peers by means of the local speaker's 266 UPDATE messages. 268 Although the conceptual model distinguishes between Adj-RIBs-In, 269 Loc-RIB, and Adj-RIBs-Out, this neither implies nor requires that an 270 implementation must maintain three separate copies of the routing 271 information. The choice of implementation (for example, 3 copies of 272 the information vs 1 copy with pointers) is not constrained by the 273 protocol. 275 4. Message Formats 277 This section describes message formats used by BGP. 279 Messages are sent over a reliable transport protocol connection. A 280 message is processed only after it is entirely received. The maximum 281 message size is 4096 octets. All implementations are required to 282 support this maximum message size. The smallest message that may be 283 sent consists of a BGP header without a data portion, or 19 octets. 285 RFC DRAFT December 1997 287 4.1 Message Header Format 289 Each message has a fixed-size header. There may or may not be a data 290 portion following the header, depending on the message type. The 291 layout of these fields is shown below: 293 0 1 2 3 294 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 295 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 296 | | 297 + + 298 | | 299 + + 300 | Marker | 301 + + 302 | | 303 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 304 | Length | Type | 305 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 307 Marker: 309 This 16-octet field contains a value that the receiver of the 310 message can predict. If the Type of the message is OPEN, or if 311 the OPEN message carries no Authentication Information (as an 312 Optional Parameter), then the Marker must be all ones. 313 Otherwise, the value of the marker can be predicted by some a 314 computation specified as part of the authentication mechanism 315 (which is specified as part of the Authentication Information) 316 used. The Marker can be used to detect loss of synchronization 317 between a pair of BGP peers, and to authenticate incoming BGP 318 messages. 320 Length: 322 This 2-octet unsigned integer indicates the total length of the 323 message, including the header, in octets. Thus, e.g., it 324 allows one to locate in the transport-level stream the (Marker 325 field of the) next message. The value of the Length field must 326 RFC DRAFT December 1997 328 always be at least 19 and no greater than 4096, and may be 329 further constrained, depending on the message type. No 330 "padding" of extra data after the message is allowed, so the 331 Length field must have the smallest value required given the 332 rest of the 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 347 message 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 350 messages 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 | | 371 RFC DRAFT December 1997 373 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 375 Version: 377 This 1-octet unsigned integer indicates the protocol version 378 number of the message. The current BGP version number is 4. 380 My Autonomous System: 382 This 2-octet unsigned integer indicates the Autonomous System 383 number of the sender. 385 Hold Time: 387 This 2-octet unsigned integer indicates the number of seconds 388 that the sender proposes for the value of the Hold Timer. Upon 389 receipt of an OPEN message, a BGP speaker MUST calculate the 390 value of the Hold Timer by using the smaller of its configured 391 Hold Time and the Hold Time received in the OPEN message. The 392 Hold Time MUST be either zero or at least three seconds. An 393 implementation may reject connections on the basis of the Hold 394 Time. The calculated value indicates the maximum number of 395 seconds that may elapse between the receipt of successive 396 KEEPALIVE, and/or UPDATE messages by the sender. 398 BGP Identifier: 399 This 4-octet unsigned integer indicates the BGP Identifier of 400 the sender. A given BGP speaker sets the value of its BGP 401 Identifier to an IP address assigned to that BGP speaker. The 402 value of the BGP Identifier is determined on startup and is the 403 same for every local interface and every BGP peer. 405 Optional Parameters Length: 407 This 1-octet unsigned integer indicates the total length of the 408 Optional Parameters field in octets. If the value of this field 409 is zero, no Optional Parameters are present. 411 Optional Parameters: 413 This field may contain a list of optional parameters, where 414 each parameter is encoded as a triplet. 417 RFC DRAFT December 1997 419 0 1 420 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 421 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-... 422 | Parm. Type | Parm. Length | Parameter Value (variable) 423 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-... 425 Parameter Type is a one octet field that unambiguously 426 identifies individual parameters. Parameter Length is a one 427 octet field that contains the length of the Parameter Value 428 field in octets. Parameter Value is a variable length field 429 that is interpreted according to the value of the Parameter 430 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 438 Authentication Code followed by a variable length 439 Authentication 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 453 authentication mechanism being used. Whenever an 454 authentication mechanism is specified for use within 455 BGP, three things must be included in the 456 specification: 457 - the value of the Authentication Code which indicates 458 use of the mechanism, 459 - the form and meaning of the Authentication Data, and 460 - the algorithm for computing values of Marker fields. 462 RFC DRAFT December 1997 464 Note that a separate authentication mechanism may be 465 used in establishing the transport level connection. 467 Authentication Data: 469 The form and meaning of this field is a variable- 470 length field depend on the Authentication Code. 472 The minimum length of the OPEN message is 29 octets (including 473 message header). 475 4.3 UPDATE Message Format 477 UPDATE messages are used to transfer routing information between BGP 478 peers. The information in the UPDATE packet can be used to construct 479 a graph describing the relationships of the various Autonomous 480 Systems. By applying rules to be discussed, routing information 481 loops and some other anomalies may be detected and removed from 482 inter-AS routing. 484 An UPDATE message is used to advertise a single feasible route to a 485 peer, or to withdraw multiple unfeasible routes from service (see 486 3.1). An UPDATE message may simultaneously advertise a feasible route 487 and withdraw multiple unfeasible routes from service. The UPDATE 488 message always includes the fixed-size BGP header, and can optionally 489 include the other fields as shown below: 491 +-----------------------------------------------------+ 492 | Unfeasible Routes Length (2 octets) | 493 +-----------------------------------------------------+ 494 | Withdrawn Routes (variable) | 495 +-----------------------------------------------------+ 496 | Total Path Attribute Length (2 octets) | 497 +-----------------------------------------------------+ 498 | Path Attributes (variable) | 499 +-----------------------------------------------------+ 500 | Network Layer Reachability Information (variable) | 501 +-----------------------------------------------------+ 503 Unfeasible Routes Length: 505 This 2-octets unsigned integer indicates the total length of 506 the Withdrawn Routes field in octets. Its value must allow the 507 RFC DRAFT December 1997 509 length of the Network Layer Reachability Information field to 510 be determined as specified below. 512 A value of 0 indicates that no routes are being withdrawn from 513 service, and that the WITHDRAWN ROUTES field is not present in 514 this UPDATE message. 516 Withdrawn Routes: 518 This is a variable length field that contains a list of IP 519 address prefixes for the routes that are being withdrawn from 520 service. Each IP address prefix is encoded as a 2-tuple of the 521 form , whose fields are described below: 523 +---------------------------+ 524 | Length (1 octet) | 525 +---------------------------+ 526 | Prefix (variable) | 527 +---------------------------+ 529 The use and the meaning of these fields are as follows: 531 a) Length: 533 The Length field indicates the length in bits of the IP 534 address prefix. A length of zero indicates a prefix that 535 matches all IP addresses (with prefix, itself, of zero 536 octets). 538 b) Prefix: 540 The Prefix field contains IP address prefixes followed by 541 enough trailing bits to make the end of the field fall on an 542 octet boundary. Note that the value of trailing bits is 543 irrelevant. 545 Total Path Attribute Length: 547 This 2-octet unsigned integer indicates the total length of the 548 Path Attributes field in octets. Its value must allow the 549 length of the Network Layer Reachability field to be determined 550 as specified below. 552 A value of 0 indicates that no Network Layer Reachability 553 Information field is present in this UPDATE message. 555 RFC DRAFT December 1997 557 Path Attributes: 559 A variable length sequence of path attributes is present in 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 586 contained in the optional transitive attribute is partial (if 587 set to 1) or complete (if set to 0). For well-known attributes 588 and for optional non-transitive attributes the Partial bit must 589 be 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. 602 RFC DRAFT December 1997 604 Currently defined Attribute Type Codes are discussed in Section 605 5. 607 If the Extended Length bit of the Attribute Flags octet is set 608 to 0, the third octet of the Path Attribute contains the length 609 of the attribute data in octets. 611 If the Extended Length bit of the Attribute Flags octet is set 612 to 1, then the third and the fourth octets of the path 613 attribute contain the length of the attribute data in octets. 615 The remaining octets of the Path Attribute represent the 616 attribute value and are interpreted according to the Attribute 617 Flags and the Attribute Type Code. The supported Attribute Type 618 Codes, their attribute values and uses are the following: 620 a) ORIGIN (Type Code 1): 622 ORIGIN is a well-known mandatory attribute that defines the 623 origin of the path information. The data octet can assume 624 the following values: 626 Value Meaning 628 0 IGP - Network Layer Reachability Information 629 is interior to the originating AS 631 1 EGP - Network Layer Reachability Information 632 learned via EGP 634 2 INCOMPLETE - Network Layer Reachability 635 Information learned by some other means 637 Its usage is defined in 5.1.1 639 b) AS_PATH (Type Code 2): 641 AS_PATH is a well-known mandatory attribute that is composed 642 of a sequence of AS path segments. Each AS path segment is 643 represented by a triple . 646 The path segment type is a 1-octet long field with the 647 following values defined: 649 Value Segment Type 651 1 AS_SET: unordered set of ASs a route in the 652 RFC DRAFT December 1997 654 UPDATE message has traversed 656 2 AS_SEQUENCE: ordered set of ASs a route in 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 663 numbers, 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 672 Reachability 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 682 system. 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 advertising 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 RFC DRAFT December 1997 703 5.1.6. 705 g) AGGREGATOR (Type Code 7) 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 717 prefixes. The length in octets of the Network Layer 718 Reachability Information is not encoded explicitly, but can be 719 calculated 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 RFC DRAFT December 1997 751 b) Prefix: 753 The Prefix field contains IP address prefixes followed by 754 enough trailing bits to make the end of the field fall on an 755 octet boundary. Note that the value of the trailing bits is 756 irrelevant. 758 The minimum length of the UPDATE message is 23 octets -- 19 octets 759 for the fixed header + 2 octets for the Unfeasible Routes Length + 2 760 octets for the Total Path Attribute Length (the value of Unfeasible 761 Routes Length is 0 and the value of Total Path Attribute Length is 762 0). 764 An UPDATE message can advertise at most one route, which may be 765 described by several path attributes. All path attributes contained 766 in a given UPDATE messages apply to the destinations carried in the 767 Network Layer Reachability Information field of the UPDATE message. 769 An UPDATE message can list multiple routes to be withdrawn from 770 service. Each such route is identified by its destination (expressed 771 as an IP prefix), which unambiguously identifies the route in the 772 context of the BGP speaker - BGP speaker connection to which it has 773 been previously been advertised. 775 An UPDATE message may advertise only routes to be withdrawn from 776 service, in which case it will not include path attributes or Network 777 Layer Reachability Information. Conversely, it may advertise only a 778 feasible route, in which case the WITHDRAWN ROUTES field need not be 779 present. 781 4.4 KEEPALIVE Message Format 783 BGP does not use any transport protocol-based keep-alive mechanism to 784 determine if peers are reachable. Instead, KEEPALIVE messages are 785 exchanged between peers often enough as not to cause the Hold Timer 786 to expire. A reasonable maximum time between KEEPALIVE messages 787 would be one third of the Hold Time interval. KEEPALIVE messages 788 MUST NOT be sent more frequently than one per second. An 789 implementation MAY adjust the rate at which it sends KEEPALIVE 790 messages as a function of the Hold Time interval. 792 If the negotiated Hold Time interval is zero, then periodic KEEPALIVE 793 messages MUST NOT be sent. 795 KEEPALIVE message consists of only message header and has a length of 796 19 octets. 798 RFC DRAFT December 1997 800 4.5 NOTIFICATION Message Format 802 A NOTIFICATION message is sent when an error condition is detected. 803 The BGP connection is closed immediately after sending it. 805 In addition to the fixed-size BGP header, the NOTIFICATION message 806 contains the following fields: 808 0 1 2 3 809 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 810 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 811 | Error code | Error subcode | Data | 812 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + 813 | | 814 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 816 Error Code: 818 This 1-octet unsigned integer indicates the type of 819 NOTIFICATION. The following Error Codes have been defined: 821 Error Code Symbolic Name Reference 823 1 Message Header Error Section 6.1 825 2 OPEN Message Error Section 6.2 827 3 UPDATE Message Error Section 6.3 829 4 Hold Timer Expired Section 6.5 831 5 Finite State Machine Error Section 6.6 833 6 Cease Section 6.7 835 Error subcode: 837 This 1-octet unsigned integer provides more specific 838 information about the nature of the reported error. Each Error 839 Code may have one or more Error Subcodes associated with it. 840 If no appropriate Error Subcode is defined, then a zero 841 (Unspecific) value is used for the Error Subcode field. 843 RFC DRAFT December 1997 845 Message Header Error subcodes: 847 1 - Connection Not Synchronized. 848 2 - Bad Message Length. 849 3 - Bad Message Type. 851 OPEN Message Error subcodes: 853 1 - Unsupported Version Number. 854 2 - Bad Peer AS. 855 3 - Bad BGP Identifier. 856 4 - Unsupported Optional Parameter. 857 5 - Authentication Failure. 858 6 - Unacceptable Hold Time. 860 UPDATE Message Error subcodes: 862 1 - Malformed Attribute List. 863 2 - Unrecognized Well-known Attribute. 864 3 - Missing Well-known Attribute. 865 4 - Attribute Flags Error. 866 5 - Attribute Length Error. 867 6 - Invalid ORIGIN Attribute 868 7 - AS Routing Loop. 869 8 - Invalid NEXT_HOP Attribute. 870 9 - Optional Attribute Error. 871 10 - Invalid Network Field. 872 11 - Malformed AS_PATH. 874 Data: 876 This variable-length field is used to diagnose the reason for 877 the NOTIFICATION. The contents of the Data field depend upon 878 the Error Code and Error Subcode. See Section 6 below for more 879 details. 881 Note that the length of the Data field can be determined from 882 the message Length field by the formula: 884 Message Length = 21 + Data Length 886 The minimum length of the NOTIFICATION message is 21 octets 887 (including message header). 889 RFC DRAFT December 1997 891 5. Path Attributes 893 This section discusses the path attributes of the UPDATE message. 895 Path attributes fall into four separate categories: 897 1. Well-known mandatory. 898 2. Well-known discretionary. 899 3. Optional transitive. 900 4. Optional non-transitive. 902 Well-known attributes must be recognized by all BGP implementations. 903 Some of these attributes are mandatory and must be included in every 904 UPDATE message that contains NLRI. Others are discretionary and may 905 or may not be sent in a particular UPDATE message. 907 All well-known attributes must be passed along (after proper 908 updating, if necessary) to other BGP peers. 910 In addition to well-known attributes, each path may contain one or 911 more optional attributes. It is not required or expected that all 912 BGP implementations support all optional attributes. The handling of 913 an unrecognized optional attribute is determined by the setting of 914 the Transitive bit in the attribute flags octet. Paths with 915 unrecognized transitive optional attributes should be accepted. If a 916 path with unrecognized transitive optional attribute is accepted and 917 passed along to other BGP peers, then the unrecognized transitive 918 optional attribute of that path must be passed along with the path to 919 other BGP peers with the Partial bit in the Attribute Flags octet set 920 to 1. If a path with recognized transitive optional attribute is 921 accepted and passed along to other BGP peers and the Partial bit in 922 the Attribute Flags octet is set to 1 by some previous AS, it is not 923 set back to 0 by the current AS. Unrecognized non-transitive optional 924 attributes must be quietly ignored and not passed along to other BGP 925 peers. 927 New transitive optional attributes may be attached to the path by the 928 originator or by any other AS in the path. If they are not attached 929 by the originator, the Partial bit in the Attribute Flags octet is 930 set to 1. The rules for attaching new non-transitive optional 931 attributes will depend on the nature of the specific attribute. The 932 documentation of each new non-transitive optional attribute will be 933 expected to include such rules. (The description of the 934 MULTI_EXIT_DISC attribute gives an example.) All optional attributes 935 (both transitive and non-transitive) may be updated (if appropriate) 936 by ASs in the path. 938 RFC DRAFT December 1997 940 The sender of an UPDATE message should order path attributes within 941 the UPDATE message in ascending order of attribute type. The 942 receiver of an UPDATE message must be prepared to handle path 943 attributes within the UPDATE message that are out of order. 945 The same attribute cannot appear more than once within the Path 946 Attributes field of a particular UPDATE message. 948 The mandatory category refers to an attribute which must be present 949 in both IBGP and EBGP exchanges if NLRI are contained in the UPDATE 950 message. Attributes classified as optional for the purpose of the 951 protocol extension mechanism may be purely discretionary, or 952 discretionary, required, or disallowed in certain contexts. 954 attribute EBGP IBGP 955 ORIGIN mandatory mandatory 956 AS_PATH mandatory mandatory 957 NEXT_HOP mandatory mandatory 958 MULTI_EXIT_DISC discretionary discretionary 959 LOCAL_PREF disallowed required 960 ATOMIC_AGGREGATE see section 5.1.6 and 9.1.4 961 AGGREGATOR discretionary discretionary 963 5.1 Path Attribute Usage 965 The usage of each BGP path attributes is described in the following 966 clauses. 968 5.1.1 ORIGIN 970 ORIGIN is a well-known mandatory attribute. The ORIGIN attribute 971 shall be generated by the autonomous system that originates the 972 associated routing information. It shall be included in the UPDATE 973 messages of all BGP speakers that choose to propagate this 974 information to other BGP speakers. 976 5.1.2 AS_PATH 978 AS_PATH is a well-known mandatory attribute. This attribute 979 RFC DRAFT December 1997 981 identifies the autonomous systems through which routing information 982 carried in this UPDATE message has passed. The components of this 983 list can be AS_SETs or AS_SEQUENCEs. 985 When a BGP speaker propagates a route which it has learned from 986 another BGP speaker's UPDATE message, it shall modify the route's 987 AS_PATH attribute based on the location of the BGP speaker to which 988 the route will be sent: 990 a) When a given BGP speaker advertises the route to an internal 991 peer, the advertising speaker shall not modify the AS_PATH 992 attribute associated with the route. 994 b) When a given BGP speaker advertises the route to an external 995 peer, then the advertising speaker shall update the AS_PATH 996 attribute as follows: 998 1) if the first path segment of the AS_PATH is of type 999 AS_SEQUENCE, the local system shall prepend its own AS number 1000 as the last element of the sequence (put it in the leftmost 1001 position) 1003 2) if the first path segment of the AS_PATH is of type AS_SET, 1004 the local system shall prepend a new path segment of type 1005 AS_SEQUENCE to the AS_PATH, including its own AS number in that 1006 segment. 1008 When a BGP speaker originates a route then: 1010 a) the originating speaker shall include its own AS number in 1011 the AS_PATH attribute of all UPDATE messages sent to an 1012 external peer. (In this case, the AS number of the originating 1013 speaker's autonomous system will be the only entry in the 1014 AS_PATH attribute). 1016 b) the originating speaker shall include an empty AS_PATH 1017 attribute in all UPDATE messages sent to internal peers. (An 1018 empty AS_PATH attribute is one whose length field contains the 1019 value zero). 1021 5.1.3 NEXT_HOP 1023 The NEXT_HOP path attribute defines the IP address of the border 1024 router that should be used as the next hop to the destinations listed 1025 in the UPDATE message. When advertising a NEXT_HOP attribute to an 1026 RFC DRAFT December 1997 1028 external peer, a router may use one of its own interface addresses in 1029 the NEXT_HOP attribute provided the external peer to which the route 1030 is being advertised shares a common subnet with the NEXT_HOP address. 1031 This is known as a "first party" NEXT_HOP attribute. A BGP speaker 1032 can advertise to an external peer an interface of any internal peer 1033 router in the NEXT_HOP attribute provided the external peer to which 1034 the route is being advertised shares a common subnet with the 1035 NEXT_HOP address. This is known as a "third party" NEXT_HOP 1036 attribute. A BGP speaker can advertise any external peer router in 1037 the NEXT_HOP attribute provided that the IP address of this border 1038 router was learned from an external peer and the external peer to 1039 which the route is being advertised shares a common subnet with the 1040 NEXT_HOP address. This is a second form of "third party" NEXT_HOP 1041 attribute. 1043 Normally the NEXT_HOP attribute is chosen such that the shortest 1044 available path will be taken. A BGP speaker must be able to support 1045 disabling advertisement of third party NEXT_HOP attributes to handle 1046 imperfectly bridged media. 1048 A BGP speaker must never advertise an address of a peer to that peer 1049 as a NEXT_HOP, for a route that the speaker is originating. A BGP 1050 speaker must never install a route with itself as the next hop. 1052 When a BGP speaker advertises the route to an internal peer, the 1053 advertising speaker should not modify the NEXT_HOP attribute 1054 associated with the route. When a BGP speaker receives the route via 1055 an internal link, it may forward packets to the NEXT_HOP address if 1056 the address contained in the attribute is on a common subnet with the 1057 local and remote BGP speakers. 1059 5.1.4 MULTI_EXIT_DISC 1061 The MULTI_EXIT_DISC attribute may be used on external (inter-AS) 1062 links to discriminate among multiple exit or entry points to the same 1063 neighboring AS. The value of the MULTI_EXIT_DISC attribute is a four 1064 octet unsigned number which is called a metric. All other factors 1065 being equal, the exit or entry point with lower metric should be 1066 preferred. If received over external links, the MULTI_EXIT_DISC 1067 attribute MAY be propagated over internal links to other BGP speakers 1068 within the same AS. The MULTI_EXIT_DISC attribute received from a 1069 neighboring AS MUST NOT be propagated to other neighboring ASs. 1071 A BGP speaker MUST IMPLEMENT a mechanism based on local configuration 1072 which allows the MULTI_EXIT_DISC attribute to be removed from a 1073 route. This MAY be done either prior to or after determining the 1074 RFC DRAFT December 1997 1076 degree of preference of the route and performing route selection 1077 (decision process phases 1 and 2). 1079 An implementation MAY also (based on local configuration) alter the 1080 value of the MULTI_EXIT_DISC attribute received over an external 1081 link. If it does so, it shall do so prior to determining the degree 1082 of preference of the route and performing route selection (decision 1083 process phases 1 and 2). 1085 5.1.5 LOCAL_PREF 1087 LOCAL_PREF is a well-known mandatory attribute that SHALL be included 1088 in all UPDATE messages that a given BGP speaker sends to the other 1089 internal peers. A BGP speaker SHALL calculate the degree of 1090 preference for each external route and include the degree of 1091 preference when advertising a route to its internal peers. The higher 1092 degree of preference MUST be preferred. A BGP speaker shall use the 1093 degree of preference learned via LOCAL_PREF in its decision process 1094 (see section 9.1.1). 1096 A BGP speaker MUST NOT include this attribute in UPDATE messages that 1097 it sends to external peers. If it is contained in an UPDATE message 1098 that is received from an external peer, then this attribute MUST be 1099 ignored by the receiving speaker. 1101 5.1.6 ATOMIC_AGGREGATE 1103 ATOMIC_AGGREGATE is a well-known discretionary attribute. If a BGP 1104 speaker, when presented with a set of overlapping routes from one of 1105 its peers (see 9.1.4), selects the less specific route without 1106 selecting the more specific one, then the local system MUST attach 1107 the ATOMIC_AGGREGATE attribute to the route when propagating it to 1108 other BGP speakers (if that attribute is not already present in the 1109 received less specific route). A BGP speaker that receives a route 1110 with the ATOMIC_AGGREGATE attribute MUST NOT remove the attribute 1111 from the route when propagating it to other speakers. A BGP speaker 1112 that receives a route with the ATOMIC_AGGREGATE attribute MUST NOT 1113 make any NLRI of that route more specific (as defined in 9.1.4) when 1114 advertising this route to other BGP speakers. A BGP speaker that 1115 receives a route with the ATOMIC_AGGREGATE attribute needs to be 1116 cognizant of the fact that the actual path to destinations, as 1117 specified in the NLRI of the route, while having the loop-free 1118 property, may traverse ASs that are not listed in the AS_PATH 1119 attribute. 1121 RFC DRAFT December 1997 1123 5.1.7 AGGREGATOR 1125 AGGREGATOR is an optional transitive attribute which may be included 1126 in updates which are formed by aggregation (see Section 9.2.4.2). A 1127 BGP speaker which performs route aggregation may add the AGGREGATOR 1128 attribute which shall contain its own AS number and IP address. 1130 6. BGP Error Handling. 1132 This section describes actions to be taken when errors are detected 1133 while processing BGP messages. 1135 When any of the conditions described here are detected, a 1136 NOTIFICATION message with the indicated Error Code, Error Subcode, 1137 and Data fields is sent, and the BGP connection is closed. If no 1138 Error Subcode is specified, then a zero must be used. 1140 The phrase "the BGP connection is closed" means that the transport 1141 protocol connection has been closed and that all resources for that 1142 BGP connection have been deallocated. Routing table entries 1143 associated with the remote peer are marked as invalid. The fact that 1144 the routes have become invalid is passed to other BGP peers before 1145 the routes are deleted from the system. 1147 Unless specified explicitly, the Data field of the NOTIFICATION 1148 message that is sent to indicate an error is empty. 1150 6.1 Message Header error handling. 1152 All errors detected while processing the Message Header are indicated 1153 by sending the NOTIFICATION message with Error Code Message Header 1154 Error. The Error Subcode elaborates on the specific nature of the 1155 error. 1157 The expected value of the Marker field of the message header is all 1158 ones if the message type is OPEN. The expected value of the Marker 1159 field for all other types of BGP messages determined based on the 1160 presence of the Authentication Information Optional Parameter in the 1161 BGP OPEN message and the actual authentication mechanism (if the 1162 Authentication Information in the BGP OPEN message is present). If 1163 the Marker field of the message header is not the expected one, then 1164 a synchronization error has occurred and the Error Subcode is set to 1165 Connection Not Synchronized. 1167 RFC DRAFT December 1997 1169 If the Length field of the message header is less than 19 or greater 1170 than 4096, or if the Length field of an OPEN message is less than 1171 the minimum length of the OPEN message, or if the Length field of an 1172 UPDATE message is less than the minimum length of the UPDATE message, 1173 or if the Length field of a KEEPALIVE message is not equal to 19, or 1174 if the Length field of a NOTIFICATION message is less than the 1175 minimum length of the NOTIFICATION message, then the Error Subcode is 1176 set to Bad Message Length. The Data field contains the erroneous 1177 Length field. 1179 If the Type field of the message header is not recognized, then the 1180 Error Subcode is set to Bad Message Type. The Data field contains 1181 the erroneous Type field. 1183 6.2 OPEN message error handling. 1185 All errors detected while processing the OPEN message are indicated 1186 by sending the NOTIFICATION message with Error Code OPEN Message 1187 Error. The Error Subcode elaborates on the specific nature of the 1188 error. 1190 If the version number contained in the Version field of the received 1191 OPEN message is not supported, then the Error Subcode is set to 1192 Unsupported Version Number. The Data field is a 2-octet unsigned 1193 integer, which indicates the largest locally supported version number 1194 less than the version the remote BGP peer bid (as indicated in the 1195 received OPEN message). 1197 If the Autonomous System field of the OPEN message is unacceptable, 1198 then the Error Subcode is set to Bad Peer AS. The determination of 1199 acceptable Autonomous System numbers is outside the scope of this 1200 protocol. 1202 If the Hold Time field of the OPEN message is unacceptable, then the 1203 Error Subcode MUST be set to Unacceptable Hold Time. An 1204 implementation MUST reject Hold Time values of one or two seconds. 1205 An implementation MAY reject any proposed Hold Time. An 1206 implementation which accepts a Hold Time MUST use the negotiated 1207 value for the Hold Time. 1209 If the BGP Identifier field of the OPEN message is syntactically 1210 incorrect, then the Error Subcode is set to Bad BGP Identifier. 1211 Syntactic correctness means that the BGP Identifier field represents 1212 a valid IP host address. 1214 If one of the Optional Parameters in the OPEN message is not 1215 RFC DRAFT December 1997 1217 recognized, then the Error Subcode is set to Unsupported Optional 1218 Parameters. 1220 If the OPEN message carries Authentication Information (as an 1221 Optional Parameter), then the corresponding authentication procedure 1222 is invoked. If the authentication procedure (based on Authentication 1223 Code and Authentication Data) fails, then the Error Subcode is set to 1224 Authentication Failure. 1226 6.3 UPDATE message error handling. 1228 All errors detected while processing the UPDATE message are indicated 1229 by sending the NOTIFICATION message with Error Code UPDATE Message 1230 Error. The error subcode elaborates on the specific nature of the 1231 error. 1233 Error checking of an UPDATE message begins by examining the path 1234 attributes. If the Unfeasible Routes Length or Total Attribute 1235 Length is too large (i.e., if Unfeasible Routes Length + Total 1236 Attribute Length + 23 exceeds the message Length), then the Error 1237 Subcode is set to Malformed Attribute List. 1239 If any recognized attribute has Attribute Flags that conflict with 1240 the Attribute Type Code, then the Error Subcode is set to Attribute 1241 Flags Error. The Data field contains the erroneous attribute (type, 1242 length and value). 1244 If any recognized attribute has Attribute Length that conflicts with 1245 the expected length (based on the attribute type code), then the 1246 Error Subcode is set to Attribute Length Error. The Data field 1247 contains the erroneous attribute (type, length and value). 1249 If any of the mandatory well-known attributes are not present, then 1250 the Error Subcode is set to Missing Well-known Attribute. The Data 1251 field contains the Attribute Type Code of the missing well-known 1252 attribute. 1254 If any of the mandatory well-known attributes are not recognized, 1255 then the Error Subcode is set to Unrecognized Well-known Attribute. 1256 The Data field contains the unrecognized attribute (type, length and 1257 value). 1259 If the ORIGIN attribute has an undefined value, then the Error 1260 Subcode is set to Invalid Origin Attribute. The Data field contains 1261 RFC DRAFT December 1997 1263 the unrecognized attribute (type, length and value). 1265 If the NEXT_HOP attribute field is syntactically incorrect, then the 1266 Error Subcode is set to Invalid NEXT_HOP Attribute. The Data field 1267 contains the incorrect attribute (type, length and value). Syntactic 1268 correctness means that the NEXT_HOP attribute represents a valid IP 1269 host address. Semantic correctness applies only to the external BGP 1270 links. It means that the interface associated with the IP address, as 1271 specified in the NEXT_HOP attribute, shares a common subnet with the 1272 receiving BGP speaker and is not the IP address of the receiving BGP 1273 speaker. If the NEXT_HOP attribute is semantically incorrect, the 1274 error should be logged, and the the route should be ignored. In this 1275 case, no NOTIFICATION message should be sent. 1277 The AS_PATH attribute is checked for syntactic correctness. If the 1278 path is syntactically incorrect, then the Error Subcode is set to 1279 Malformed AS_PATH. 1281 The information carried by the AS_PATH attribute is checked for AS 1282 loops. AS loop detection is done by scanning the full AS path (as 1283 specified in the AS_PATH attribute), and checking that the autonomous 1284 system number of the local system does not appear in the AS path. If 1285 the autonomous system number appears in the AS path the route may be 1286 stored in the Adj-RIB-In, but unless the router is configured to 1287 accept routes with its own autonomous system in the AS path, the 1288 route shall not be passed to the BGP Decision Process. Operations of 1289 a router that is configured to accept routes with its own autonomous 1290 system number in the AS path are outside the scope of this document. 1292 If an optional attribute is recognized, then the value of this 1293 attribute is checked. If an error is detected, the attribute is 1294 discarded, and the Error Subcode is set to Optional Attribute Error. 1295 The Data field contains the attribute (type, length and value). 1297 If any attribute appears more than once in the UPDATE message, then 1298 the Error Subcode is set to Malformed Attribute List. 1300 The NLRI field in the UPDATE message is checked for syntactic 1301 validity. If the field is syntactically incorrect, then the Error 1302 Subcode is set to Invalid Network Field. 1304 An UPDATE message that contains correct path attributes, but no NLRI 1305 shall be treated as a valid UPDATE message. 1307 RFC DRAFT December 1997 1309 6.4 NOTIFICATION message error handling. 1311 If a peer sends a NOTIFICATION message, and there is an error in that 1312 message, there is unfortunately no means of reporting this error via 1313 a subsequent NOTIFICATION message. Any such error, such as an 1314 unrecognized Error Code or Error Subcode, should be noticed, logged 1315 locally, and brought to the attention of the administration of the 1316 peer. The means to do this, however, lies outside the scope of this 1317 document. 1319 6.5 Hold Timer Expired error handling. 1321 If a system does not receive successive KEEPALIVE and/or UPDATE 1322 and/or NOTIFICATION messages within the period specified in the Hold 1323 Time field of the OPEN message, then the NOTIFICATION message with 1324 Hold Timer Expired Error Code must be sent and the BGP connection 1325 closed. 1327 6.6 Finite State Machine error handling. 1329 Any error detected by the BGP Finite State Machine (e.g., receipt of 1330 an unexpected event) is indicated by sending the NOTIFICATION message 1331 with Error Code Finite State Machine Error. 1333 6.7 Cease. 1335 In absence of any fatal errors (that are indicated in this section), 1336 a BGP peer may choose at any given time to close its BGP connection 1337 by sending the NOTIFICATION message with Error Code Cease. However, 1338 the Cease NOTIFICATION message must not be used when a fatal error 1339 indicated by this section does exist. 1341 6.8 Connection collision detection. 1343 If a pair of BGP speakers try simultaneously to establish a TCP 1344 connection to each other, then two parallel connections between this 1345 pair of speakers might well be formed. We refer to this situation as 1346 connection collision. Clearly, one of these connections must be 1347 closed. 1349 RFC DRAFT December 1997 1351 Based on the value of the BGP Identifier a convention is established 1352 for detecting which BGP connection is to be preserved when a 1353 collision does occur. The convention is to compare the BGP 1354 Identifiers of the peers involved in the collision and to retain only 1355 the connection initiated by the BGP speaker with the higher-valued 1356 BGP Identifier. 1358 Upon receipt of an OPEN message, the local system must examine all of 1359 its connections that are in the OpenConfirm state. A BGP speaker may 1360 also examine connections in an OpenSent state if it knows the BGP 1361 Identifier of the peer by means outside of the protocol. If among 1362 these connections there is a connection to a remote BGP speaker whose 1363 BGP Identifier equals the one in the OPEN message, then the local 1364 system performs the following collision resolution procedure: 1366 1. The BGP Identifier of the local system is compared to the BGP 1367 Identifier of the remote system (as specified in the OPEN 1368 message). 1370 2. If the value of the local BGP Identifier is less than the 1371 remote one, the local system closes BGP connection that already 1372 exists (the one that is already in the OpenConfirm state), and 1373 accepts BGP connection initiated by the remote system. 1375 3. Otherwise, the local system closes newly created BGP connection 1376 (the one associated with the newly received OPEN message), and 1377 continues to use the existing one (the one that is already in the 1378 OpenConfirm state). 1380 Comparing BGP Identifiers is done by treating them as (4-octet 1381 long) unsigned integers. 1383 A connection collision with an existing BGP connection that is in 1384 Established states causes unconditional closing of the newly 1385 created connection. Note that a connection collision cannot be 1386 detected with connections that are in Idle, or Connect, or Active 1387 states. 1389 Closing the BGP connection (that results from the collision 1390 resolution procedure) is accomplished by sending the NOTIFICATION 1391 message with the Error Code Cease. 1393 7. BGP Version Negotiation. 1395 BGP speakers may negotiate the version of the protocol by making 1396 RFC DRAFT December 1997 1398 multiple attempts to open a BGP connection, starting with the highest 1399 version number each supports. If an open attempt fails with an Error 1400 Code OPEN Message Error, and an Error Subcode Unsupported Version 1401 Number, then the BGP speaker has available the version number it 1402 tried, the version number its peer tried, the version number passed 1403 by its peer in the NOTIFICATION message, and the version numbers that 1404 it supports. If the two peers do support one or more common 1405 versions, then this will allow them to rapidly determine the highest 1406 common version. In order to support BGP version negotiation, future 1407 versions of BGP must retain the format of the OPEN and NOTIFICATION 1408 messages. 1410 8. BGP Finite State machine. 1412 This section specifies BGP operation in terms of a Finite State 1413 Machine (FSM). Following is a brief summary and overview of BGP 1414 operations by state as determined by this FSM. A condensed version 1415 of the BGP FSM is found in Appendix 1. 1417 Initially BGP is in the Idle state. 1419 Idle state: 1421 In this state BGP refuses all incoming BGP connections. No 1422 resources are allocated to the peer. In response to the Start 1423 event (initiated by either system or operator) the local system 1424 initializes all BGP resources, starts the ConnectRetry timer, 1425 initiates a transport connection to other BGP peer, while 1426 listening for connection that may be initiated by the remote 1427 BGP peer, and changes its state to Connect. The exact value of 1428 the ConnectRetry timer is a local matter, but should be 1429 sufficiently large to allow TCP initialization. 1431 If a BGP speaker detects an error, it shuts down the connection 1432 and changes its state to Idle. Getting out of the Idle state 1433 requires generation of the Start event. If such an event is 1434 generated automatically, then persistent BGP errors may result 1435 in persistent flapping of the speaker. To avoid such a 1436 condition it is recommended that Start events should not be 1437 generated immediately for a peer that was previously 1438 transitioned to Idle due to an error. For a peer that was 1439 previously transitioned to Idle due to an error, the time 1440 between consecutive generation of Start events, if such events 1441 are generated automatically, shall exponentially increase. The 1442 value of the initial timer shall be 60 seconds. The time shall 1443 be doubled for each consecutive retry. 1445 RFC DRAFT December 1997 1447 Any other event received in the Idle state is ignored. 1449 Connect state: 1451 In this state BGP is waiting for the transport protocol 1452 connection to be completed. 1454 If the transport protocol connection succeeds, the local system 1455 clears the ConnectRetry timer, completes initialization, sends 1456 an OPEN message to its peer, and changes its state to OpenSent. 1458 If the transport protocol connect fails (e.g., retransmission 1459 timeout), the local system restarts the ConnectRetry timer, 1460 continues to listen for a connection that may be initiated by 1461 the remote BGP peer, and changes its state to Active state. 1463 In response to the ConnectRetry timer expired event, the local 1464 system restarts the ConnectRetry timer, initiates a transport 1465 connection to other BGP peer, continues to listen for a 1466 connection that may be initiated by the remote BGP peer, and 1467 stays in the Connect state. 1469 Start event is ignored in the Active state. 1471 In response to any other event (initiated by either system or 1472 operator), the local system releases all BGP resources 1473 associated with this connection and changes its state to Idle. 1475 Active state: 1477 In this state BGP is trying to acquire a peer by initiating a 1478 transport protocol connection. 1480 If the transport protocol connection succeeds, the local system 1481 clears the ConnectRetry timer, completes initialization, sends 1482 an OPEN message to its peer, sets its Hold Timer to a large 1483 value, and changes its state to OpenSent. A Hold Timer value 1484 of 4 minutes is suggested. 1486 In response to the ConnectRetry timer expired event, the local 1487 system restarts the ConnectRetry timer, initiates a transport 1488 connection to other BGP peer, continues to listen for a 1489 connection that may be initiated by the remote BGP peer, and 1490 changes its state to Connect. 1492 If the local system detects that a remote peer is trying to 1493 establish BGP connection to it, and the IP address of the 1494 remote peer is not an expected one, the local system restarts 1495 RFC DRAFT December 1997 1497 the ConnectRetry timer, rejects the attempted connection, 1498 continues to listen for a connection that may be initiated by 1499 the remote BGP peer, and stays in the Active state. 1501 Start event is ignored in the Active state. 1503 In response to any other event (initiated by either system or 1504 operator), the local system releases all BGP resources 1505 associated with this connection and changes its state to Idle. 1507 OpenSent state: 1509 In this state BGP waits for an OPEN message from its peer. 1510 When an OPEN message is received, all fields are checked for 1511 correctness. If the BGP message header checking or OPEN 1512 message checking detects an error (see Section 6.2), or a 1513 connection collision (see Section 6.8) the local system sends a 1514 NOTIFICATION message and changes its state to Idle. 1516 If there are no errors in the OPEN message, BGP sends a 1517 KEEPALIVE message and sets a KeepAlive timer. The Hold Timer, 1518 which was originally set to a large value (see above), is 1519 replaced with the negotiated Hold Time value (see section 4.2). 1520 If the negotiated Hold Time value is zero, then the Hold Time 1521 timer and KeepAlive timers are not started. If the value of 1522 the Autonomous System field is the same as the local Autonomous 1523 System number, then the connection is an "internal" connection; 1524 otherwise, it is "external". (This will effect UPDATE 1525 processing as described below.) Finally, the state is changed 1526 to OpenConfirm. 1528 If a disconnect notification is received from the underlying 1529 transport protocol, the local system closes the BGP connection, 1530 restarts the ConnectRetry timer, while continue listening for 1531 connection that may be initiated by the remote BGP peer, and 1532 goes into the Active state. 1534 If the Hold Timer expires, the local system sends NOTIFICATION 1535 message with error code Hold Timer Expired and changes its 1536 state to Idle. 1538 In response to the Stop event (initiated by either system or 1539 operator) the local system sends NOTIFICATION message with 1540 Error Code Cease and changes its state to Idle. 1542 Start event is ignored in the OpenSent state. 1544 In response to any other event the local system sends 1545 RFC DRAFT December 1997 1547 NOTIFICATION message with Error Code Finite State Machine Error 1548 and changes its state to Idle. 1550 Whenever BGP changes its state from OpenSent to Idle, it closes 1551 the BGP (and transport-level) connection and releases all 1552 resources associated with that connection. 1554 OpenConfirm state: 1556 In this state BGP waits for a KEEPALIVE or NOTIFICATION 1557 message. 1559 If the local system receives a KEEPALIVE message, it changes 1560 its state to Established. 1562 If the Hold Timer expires before a KEEPALIVE message is 1563 received, the local system sends NOTIFICATION message with 1564 error code Hold Timer Expired and changes its state to Idle. 1566 If the local system receives a NOTIFICATION message, it changes 1567 its state to Idle. 1569 If the KeepAlive timer expires, the local system sends a 1570 KEEPALIVE message and restarts its KeepAlive timer. 1572 If a disconnect notification is received from the underlying 1573 transport protocol, the local system changes its state to Idle. 1575 In response to the Stop event (initiated by either system or 1576 operator) the local system sends NOTIFICATION message with 1577 Error Code Cease and changes its state to Idle. 1579 Start event is ignored in the OpenConfirm state. 1581 In response to any other event the local system sends 1582 NOTIFICATION message with Error Code Finite State Machine Error 1583 and changes its state to Idle. 1585 Whenever BGP changes its state from OpenConfirm to Idle, it 1586 closes the BGP (and transport-level) connection and releases 1587 all resources associated with that connection. 1589 Established state: 1591 In the Established state BGP can exchange UPDATE, NOTIFICATION, 1592 and KEEPALIVE messages with its peer. 1594 If the local system receives an UPDATE or KEEPALIVE message, it 1595 RFC DRAFT December 1997 1597 restarts its Hold Timer, if the negotiated Hold Time value is 1598 non-zero. 1600 If the local system receives a NOTIFICATION message, it changes 1601 its state to Idle. 1603 If the local system receives an UPDATE message and the UPDATE 1604 message error handling procedure (see Section 6.3) detects an 1605 error, the local system sends a NOTIFICATION message and 1606 changes its state to Idle. 1608 If a disconnect notification is received from the underlying 1609 transport protocol, the local system changes its state to Idle. 1611 If the Hold Timer expires, the local system sends a 1612 NOTIFICATION message with Error Code Hold Timer Expired and 1613 changes its state to Idle. 1615 If the KeepAlive timer expires, the local system sends a 1616 KEEPALIVE message and restarts its KeepAlive timer. 1618 Each time the local system sends a KEEPALIVE or UPDATE message, 1619 it restarts its KeepAlive timer, unless the negotiated Hold 1620 Time value is zero. 1622 In response to the Stop event (initiated by either system or 1623 operator), the local system sends a NOTIFICATION message with 1624 Error Code Cease and changes its state to Idle. 1626 Start event is ignored in the Established state. 1628 In response to any other event, the local system sends 1629 NOTIFICATION message with Error Code Finite State Machine Error 1630 and changes its state to Idle. 1632 Whenever BGP changes its state from Established to Idle, it 1633 closes the BGP (and transport-level) connection, releases all 1634 resources associated with that connection, and deletes all 1635 routes derived from that connection. 1637 9. UPDATE Message Handling 1639 An UPDATE message may be received only in the Established state. 1640 When an UPDATE message is received, each field is checked for 1641 validity as specified in Section 6.3. 1643 RFC DRAFT December 1997 1645 If an optional non-transitive attribute is unrecognized, it is 1646 quietly ignored. If an optional transitive attribute is 1647 unrecognized, the Partial bit (the third high-order bit) in the 1648 attribute flags octet is set to 1, and the attribute is retained for 1649 propagation to other BGP speakers. 1651 If an optional attribute is recognized, and has a valid value, then, 1652 depending on the type of the optional attribute, it is processed 1653 locally, retained, and updated, if necessary, for possible 1654 propagation to other BGP speakers. 1656 If the UPDATE message contains a non-empty WITHDRAWN ROUTES field, 1657 the previously advertised routes whose destinations (expressed as IP 1658 prefixes) contained in this field shall be removed from the Adj-RIB- 1659 In. This BGP speaker shall run its Decision Process since the 1660 previously advertised route is not longer available for use. 1662 If the UPDATE message contains a feasible route, it shall be placed 1663 in the appropriate Adj-RIB-In, and the following additional actions 1664 shall be taken: 1666 i) If its Network Layer Reachability Information (NLRI) is identical 1667 to the one of a route currently stored in the Adj-RIB-In, then the 1668 new route shall replace the older route in the Adj-RIB-In, thus 1669 implicitly withdrawing the older route from service. The BGP speaker 1670 shall run its Decision Process since the older route is no longer 1671 available for use. 1673 ii) If the new route is an overlapping route that is included (see 1674 9.1.4) in an earlier route contained in the Adj-RIB-In, the BGP 1675 speaker shall run its Decision Process since the more specific route 1676 has implicitly made a portion of the less specific route unavailable 1677 for use. 1679 iii) If the new route has identical path attributes to an earlier 1680 route contained in the Adj-RIB-In, and is more specific (see 9.1.4) 1681 than the earlier route, no further actions are necessary. 1683 iv) If the new route has NLRI that is not present in any of the 1684 routes currently stored in the Adj-RIB-In, then the new route shall 1685 be placed in the Adj-RIB-In. The BGP speaker shall run its Decision 1686 Process. 1688 v) If the new route is an overlapping route that is less specific 1689 (see 9.1.4) than an earlier route contained in the Adj-RIB-In, the 1690 BGP speaker shall run its Decision Process on the set of destinations 1691 described only by the less specific route. 1693 RFC DRAFT December 1997 1695 9.1 Decision Process 1697 The Decision Process selects routes for subsequent advertisement by 1698 applying the policies in the local Policy Information Base (PIB) to 1699 the routes stored in its Adj-RIB-In. The output of the Decision 1700 Process is the set of routes that will be advertised to all peers; 1701 the selected routes will be stored in the local speaker's Adj-RIB- 1702 Out. 1704 The selection process is formalized by defining a function that takes 1705 the attribute of a given route as an argument and returns a non- 1706 negative integer denoting the degree of preference for the route. 1707 The function that calculates the degree of preference for a given 1708 route shall not use as its inputs any of the following: the existence 1709 of other routes, the non-existence of other routes, or the path 1710 attributes of other routes. Route selection then consists of 1711 individual application of the degree of preference function to each 1712 feasible route, followed by the choice of the one with the highest 1713 degree of preference. 1715 The Decision Process operates on routes contained in each Adj-RIB-In, 1716 and is responsible for: 1718 - selection of routes to be advertised to internal peers 1720 - selection of routes to be advertised to external peers 1722 - route aggregation and route information reduction 1724 The Decision Process takes place in three distinct phases, each 1725 triggered by a different event: 1727 a) Phase 1 is responsible for calculating the degree of preference 1728 for each route received from an external peer, and for advertising 1729 to the other internal peers the routes that have the highest 1730 degree of preference for each distinct destination. 1732 b) Phase 2 is invoked on completion of phase 1. It is responsible 1733 for choosing the best route out of all those available for each 1734 distinct destination, and for installing each chosen route into 1735 the appropriate Loc-RIB. 1737 c) Phase 3 is invoked after the Loc-RIB has been modified. It is 1738 responsible for disseminating routes in the Loc-RIB to each 1739 external peer, according to the policies contained in the PIB. 1740 Route aggregation and information reduction can optionally be 1741 performed within this phase. 1743 RFC DRAFT December 1997 1745 9.1.1 Phase 1: Calculation of Degree of Preference 1747 The Phase 1 decision function shall be invoked whenever the local BGP 1748 speaker receives from a peer an UPDATE message that advertises a new 1749 route, a replacement route, or a withdrawn route. 1751 The Phase 1 decision function is a separate process which completes 1752 when it has no further work to do. 1754 The Phase 1 decision function shall lock an Adj-RIB-In prior to 1755 operating on any route contained within it, and shall unlock it after 1756 operating on all new or unfeasible routes contained within it. 1758 For each newly received or replacement feasible route, the local BGP 1759 speaker shall determine a degree of preference. If the route is 1760 learned from an internal peer, the value of the LOCAL_PREF attribute 1761 shall be taken as the degree of preference. If the route is learned 1762 from an external peer, then the degree of preference shall be 1763 computed based on preconfigured policy information and used as the 1764 LOCAL_PREF value in any IBGP readvertisement. The exact nature of 1765 this policy information and the computation involved is a local 1766 matter. The local speaker shall then run the internal update process 1767 of 9.2.1 to select and advertise the most preferable route. 1769 9.1.2 Phase 2: Route Selection 1771 The Phase 2 decision function shall be invoked on completion of Phase 1772 1. The Phase 2 function is a separate process which completes when 1773 it has no further work to do. The Phase 2 process shall consider all 1774 routes that are present in the Adj-RIBs-In, including those received 1775 from both internal and external peers. 1777 The Phase 2 decision function shall be blocked from running while the 1778 Phase 3 decision function is in process. The Phase 2 function shall 1779 lock all Adj-RIBs-In prior to commencing its function, and shall 1780 unlock them on completion. 1782 If the NEXT_HOP attribute of a BGP route depicts an address to which 1783 the local BGP speaker doesn't have a route in its Loc-RIB, the BGP 1784 route should be excluded from the Phase 2 decision function. 1786 It is critical that routers within an AS do not make conflicting 1787 decisions regarding route selection that would cause forwarding loops 1788 to occur. 1790 RFC DRAFT December 1997 1792 For each set of destinations for which a feasible route exists in the 1793 Adj-RIBs-In, the local BGP speaker shall identify the route that has: 1795 a) the highest degree of preference of any route to the same set 1796 of destinations, or 1798 b) is the only route to that destination, or 1800 c) is selected as a result of the Phase 2 tie breaking rules 1801 specified in 9.1.2.1. 1803 The local speaker SHALL then install that route in the Loc-RIB, 1804 replacing any route to the same destination that is currently being 1805 held in the Loc-RIB. The local speaker MUST determine the immediate 1806 next hop to the address depicted by the NEXT_HOP attribute of the 1807 selected route by performing a lookup in the IGP and selecting one of 1808 the possible paths in the IGP. This immediate next hop MUST be used 1809 when installing the selected route in the Loc-RIB. If the route to 1810 the address depicted by the NEXT_HOP attribute changes such that the 1811 immediate next hop changes, route selection should be recalculated as 1812 specified above. 1814 Unfeasible routes shall be removed from the Loc-RIB, and 1815 corresponding unfeasible routes shall then be removed from the Adj- 1816 RIBs-In. 1818 9.1.2.1 Breaking Ties (Phase 2) 1820 In its Adj-RIBs-In a BGP speaker may have several routes to the same 1821 destination that have the same degree of preference. The local 1822 speaker can select only one of these routes for inclusion in the 1823 associated Loc-RIB. The local speaker considers all routes with the 1824 same degrees of preference, both those received from internal peers, 1825 and those received from external peers. 1827 The following tie-breaking procedure assumes that for each candidate 1828 route all the BGP speakers within an autonomous system can ascertain 1829 the cost of a path (interior distance) to the address depicted by the 1830 NEXT_HOP attribute of the route. 1832 The tie-breaking algorithm begins by considering all equally 1833 preferable routes and then selects routes to be removed from 1834 consideration. The algorithm terminates as soon as only one route 1835 remains in consideration. The criteria must be applied in the order 1836 specified. 1838 RFC DRAFT December 1997 1840 Several of the criteria are described using pseudo-code. Note that 1841 the pseudo-code shown was chosen for clarity, not efficiency. It is 1842 not intended to specify any particular implementation. BGP 1843 implementations MAY use any algorithm which produces the same results 1844 as those described here. 1846 a) Remove from consideration routes with less-preferred 1847 MULTI_EXIT_DISC attributes. MULTI_EXIT_DISC is only comparable 1848 between routes learned from the same neighboring AS. Routes which 1849 do not have the MULTI_EXIT_DISC attribute are considered to have 1850 the highest possible MULTI_EXIT_DISC value. 1852 This is also described in the following procedure: 1854 for m = all routes still under consideration 1855 for n = all routes still under consideration 1856 if (neighborAS(m) == neighborAS(n)) and (MED(n) < MED(m)) 1857 remove route m from consideration 1859 In the pseudo-code above, MED(n) is a function which returns the 1860 value of route n's MULTI_EXIT_DISC attribute. If route n has no 1861 MULTI_EXIT_DISC attribute, the function returns the highest 1862 possible MULTI_EXIT_DISC value, i.e. 2^32-1. 1864 Similarly, neighborAS(n) is a function which returns the neighbor 1865 AS from which the route was received. 1867 b) Remove from consideration any routes with less-preferred 1868 interior cost. The interior cost of a route is determined by 1869 calculating the metric to the next hop for the route using the 1870 interior routing protocol(s). If the next hop for a route is 1871 reachable, but no cost can be determined, then this step should be 1872 should be skipped (equivalently, consider all routes to have equal 1873 costs). 1875 This is also described in the following procedure. 1877 for m = all routes still under consideration 1878 for n = all routes in still under consideration 1879 if (cost(n) is better than cost(m)) 1880 remove m from consideration 1882 In the pseudo-code above, cost(n) is a function which returns the 1883 cost of the path (interior distance) to the address given in the 1884 NEXT_HOP attribute of the route. 1886 c) If at least one of the candidate routes was received from an 1887 external peer in a neighboring autonomous system, remove from 1888 RFC DRAFT December 1997 1890 consideration all routes which were received from internal peers. 1892 d) Remove from consideration all routes other than the route that 1893 was advertised by the BGP speaker whose BGP Identifier has the 1894 lowest value. 1896 9.1.3 Phase 3: Route Dissemination 1898 The Phase 3 decision function shall be invoked on completion of Phase 1899 2, or when any of the following events occur: 1901 a) when routes in a Loc-RIB to local destinations have changed 1903 b) when locally generated routes learned by means outside of BGP 1904 have changed 1906 c) when a new BGP speaker - BGP speaker connection has been 1907 established 1909 The Phase 3 function is a separate process which completes when it 1910 has no further work to do. The Phase 3 Routing Decision function 1911 shall be blocked from running while the Phase 2 decision function is 1912 in process. 1914 All routes in the Loc-RIB shall be processed into a corresponding 1915 entry in the associated Adj-RIBs-Out. Route aggregation and 1916 information reduction techniques (see 9.2.4.1) may optionally be 1917 applied. 1919 For the benefit of future support of inter-AS multicast capabilities, 1920 a BGP speaker that participates in inter-AS multicast routing shall 1921 advertise a route it receives from one of its external peers and if 1922 it installs it in its Loc-RIB, it shall advertise it back to the peer 1923 from which the route was received. For a BGP speaker that does not 1924 participate in inter-AS multicast routing such an advertisement is 1925 optional. When doing such an advertisement, the NEXT_HOP attribute 1926 should be set to the address of the peer. An implementation may also 1927 optimize such an advertisement by truncating information in the 1928 AS_PATH attribute to include only its own AS number and that of the 1929 peer that advertised the route (such truncation requires the ORIGIN 1930 attribute to be set to INCOMPLETE). In addition an implementation is 1931 not required to pass optional or discretionary path attributes with 1932 such an advertisement. 1934 When the updating of the Adj-RIBs-Out and the Forwarding Information 1935 Base (FIB) is complete, the local BGP speaker shall run the external 1936 RFC DRAFT December 1997 1938 update process of 9.2.2. 1940 9.1.4 Overlapping Routes 1942 A BGP speaker may transmit routes with overlapping Network Layer 1943 Reachability Information (NLRI) to another BGP speaker. NLRI overlap 1944 occurs when a set of destinations are identified in non-matching 1945 multiple routes. Since BGP encodes NLRI using IP prefixes, overlap 1946 will always exhibit subset relationships. A route describing a 1947 smaller set of destinations (a longer prefix) is said to be more 1948 specific than a route describing a larger set of destinations (a 1949 shorted prefix); similarly, a route describing a larger set of 1950 destinations (a shorter prefix) is said to be less specific than a 1951 route describing a smaller set of destinations (a longer prefix). 1953 The precedence relationship effectively decomposes less specific 1954 routes into two parts: 1956 - a set of destinations described only by the less specific 1957 route, and 1959 - a set of destinations described by the overlap of the less 1960 specific and the more specific routes 1962 When overlapping routes are present in the same Adj-RIB-In, the more 1963 specific route shall take precedence, in order from more specific to 1964 least specific. 1966 The set of destinations described by the overlap represents a portion 1967 of the less specific route that is feasible, but is not currently in 1968 use. If a more specific route is later withdrawn, the set of 1969 destinations described by the overlap will still be reachable using 1970 the less specific route. 1972 If a BGP speaker receives overlapping routes, the Decision Process 1973 MUST consider both routes based on the configured acceptance policy. 1974 If both a less and a more specific route are accepted, then the 1975 Decision Process MUST either install both the less and the more 1976 specific routes or it MUST aggregate the two routes and install the 1977 aggregated route. 1979 If a BGP speaker chooses to aggregate, then it MUST add 1980 ATOMIC_AGGREGATE attribute to the route. A route that carries 1981 ATOMIC_AGGREGATE attribute can not be de-aggregated. That is, the 1982 NLRI of this route can not be made more specific. Forwarding along 1983 RFC DRAFT December 1997 1985 such a route does not guarantee that IP packets will actually 1986 traverse only ASs listed in the AS_PATH attribute of the route. If a 1987 BGP speaker chooses a), it must not advertise the more general route 1988 without the more specific route. 1990 9.2 Update-Send Process 1992 The Update-Send process is responsible for advertising UPDATE 1993 messages to all peers. For example, it distributes the routes chosen 1994 by the Decision Process to other BGP speakers which may be located in 1995 either the same autonomous system or a neighboring autonomous system. 1996 Rules for information exchange between BGP speakers located in 1997 different autonomous systems are given in 9.2.2; rules for 1998 information exchange between BGP speakers located in the same 1999 autonomous system are given in 9.2.1. 2001 Distribution of routing information between a set of BGP speakers, 2002 all of which are located in the same autonomous system, is referred 2003 to as internal distribution. 2005 9.2.1 Internal Updates 2007 The Internal update process is concerned with the distribution of 2008 routing information to internal peers. 2010 When a BGP speaker receives an UPDATE message from an internal peer, 2011 the receiving BGP speaker shall not re-distribute the routing 2012 information contained in that UPDATE message to other internal peers. 2014 When a BGP speaker receives a new route from an external peer, it 2015 MUST advertise that route to all other internal peers by means of an 2016 UPDATE message if this routes has been installed in its Loc-RIB 2017 according to the route selection rules in 9.1.2. 2019 When a BGP speaker receives an UPDATE message with a non-empty 2020 WITHDRAWN ROUTES field, it shall remove from its Adj-RIB-In all 2021 routes whose destinations was carried in this field (as IP prefixes). 2022 The speaker shall take the following additional steps: 2024 1) if the corresponding feasible route had not been previously 2025 advertised, then no further action is necessary 2027 2) if the corresponding feasible route had been previously 2028 advertised, then: 2030 RFC DRAFT December 1997 2032 i) if a new route is selected for advertisement that has the 2033 same Network Layer Reachability Information as the unfeasible 2034 routes, then the local BGP speaker shall advertise the 2035 replacement route 2037 ii) if a replacement route is not available for advertisement, 2038 then the BGP speaker shall include the destinations of the 2039 unfeasible route (in form of IP prefixes) in the WITHDRAWN 2040 ROUTES field of an UPDATE message, and shall send this message 2041 to each peer to whom it had previously advertised the 2042 corresponding feasible route. 2044 All feasible routes which are advertised shall be placed in the 2045 appropriate Adj-RIBs-Out, and all unfeasible routes which are 2046 advertised shall be removed from the Adj-RIBs-Out. 2048 9.2.1.1 Breaking Ties (Internal Updates) 2050 If a local BGP speaker has connections to several external peers, 2051 there will be multiple Adj-RIBs-In associated with these peers. These 2052 Adj-RIBs-In might contain several equally preferable routes to the 2053 same destination, all of which were advertised by external peers. 2054 The local BGP speaker shall select one of these routes according to 2055 the following rules: 2057 a) If the candidate routes differ only in their NEXT_HOP and 2058 MULTI_EXIT_DISC attributes, and the local system is configured to 2059 take into account the MULTI_EXIT_DISC attribute, select the route 2060 that has the lowest value of the MULTI_EXIT_DISC attribute. A 2061 route with the MULTI_EXIT_DISC attribute shall be preferred to a 2062 route without the MULTI_EXIT_DISC attribute. 2064 b) If the local system can ascertain the cost of a path to the 2065 entity depicted by the NEXT_HOP attribute of the candidate route, 2066 select the route with the lowest cost. 2068 c) In all other cases, select the route that was advertised by the 2069 BGP speaker whose BGP Identifier has the lowest value. 2071 9.2.2 External Updates 2073 The external update process is concerned with the distribution of 2074 RFC DRAFT December 1997 2076 routing information to external peers. As part of Phase 3 route 2077 selection process, the BGP speaker has updated its Adj-RIBs-Out and 2078 its Forwarding Table. All newly installed routes and all newly 2079 unfeasible routes for which there is no replacement route shall be 2080 advertised to external peers by means of UPDATE message. 2082 Any routes in the Loc-RIB marked as unfeasible shall be removed. 2083 Changes to the reachable destinations within its own autonomous 2084 system shall also be advertised in an UPDATE message. 2086 9.2.3 Controlling Routing Traffic Overhead 2088 The BGP protocol constrains the amount of routing traffic (that is, 2089 UPDATE messages) in order to limit both the link bandwidth needed to 2090 advertise UPDATE messages and the processing power needed by the 2091 Decision Process to digest the information contained in the UPDATE 2092 messages. 2094 9.2.3.1 Frequency of Route Advertisement 2096 The parameter MinRouteAdvertisementInterval determines the minimum 2097 amount of time that must elapse between advertisement of routes to a 2098 particular destination from a single BGP speaker. This rate limiting 2099 procedure applies on a per-destination basis, although the value of 2100 MinRouteAdvertisementInterval is set on a per BGP peer basis. 2102 Two UPDATE messages sent from a single BGP speaker that advertise 2103 feasible routes to some common set of destinations received from 2104 external peers must be separated by at least 2105 MinRouteAdvertisementInterval. Clearly, this can only be achieved 2106 precisely by keeping a separate timer for each common set of 2107 destinations. This would be unwarranted overhead. Any technique which 2108 ensures that the interval between two UPDATE messages sent from a 2109 single BGP speaker that advertise feasible routes to some common set 2110 of destinations received from external peers will be at least 2111 MinRouteAdvertisementInterval, and will also ensure a constant upper 2112 bound on the interval is acceptable. 2114 Since fast convergence is needed within an autonomous system, this 2115 procedure does not apply for routes receives from other internal 2116 peers. To avoid long-lived black holes, the procedure does not apply 2117 to the explicit withdrawal of unfeasible routes (that is, routes 2118 whose destinations (expressed as IP prefixes) are listed in the 2119 WITHDRAWN ROUTES field of an UPDATE message). 2121 RFC DRAFT December 1997 2123 This procedure does not limit the rate of route selection, but only 2124 the rate of route advertisement. If new routes are selected multiple 2125 times while awaiting the expiration of MinRouteAdvertisementInterval, 2126 the last route selected shall be advertised at the end of 2127 MinRouteAdvertisementInterval. 2129 9.2.3.2 Frequency of Route Origination 2131 The parameter MinASOriginationInterval determines the minimum amount 2132 of time that must elapse between successive advertisements of UPDATE 2133 messages that report changes within the advertising BGP speaker's own 2134 autonomous systems. 2136 9.2.3.3 Jitter 2138 To minimize the likelihood that the distribution of BGP messages by a 2139 given BGP speaker will contain peaks, jitter should be applied to the 2140 timers associated with MinASOriginationInterval, Keepalive, and 2141 MinRouteAdvertisementInterval. A given BGP speaker shall apply the 2142 same jitter to each of these quantities regardless of the 2143 destinations to which the updates are being sent; that is, jitter 2144 will not be applied on a "per peer" basis. 2146 The amount of jitter to be introduced shall be determined by 2147 multiplying the base value of the appropriate timer by a random 2148 factor which is uniformly distributed in the range from 0.75 to 1.0. 2150 9.2.4 Efficient Organization of Routing Information 2152 Having selected the routing information which it will advertise, a 2153 BGP speaker may avail itself of several methods to organize this 2154 information in an efficient manner. 2156 9.2.4.1 Information Reduction 2158 Information reduction may imply a reduction in granularity of policy 2159 control - after information is collapsed, the same policies will 2160 apply to all destinations and paths in the equivalence class. 2162 The Decision Process may optionally reduce the amount of information 2163 RFC DRAFT December 1997 2165 that it will place in the Adj-RIBs-Out by any of the following 2166 methods: 2168 a) Network Layer Reachability Information (NLRI): 2170 Destination IP addresses can be represented as IP address 2171 prefixes. In cases where there is a correspondence between the 2172 address structure and the systems under control of an autonomous 2173 system administrator, it will be possible to reduce the size of 2174 the NLRI carried in the UPDATE messages. 2176 b) AS_PATHs: 2178 AS path information can be represented as ordered AS_SEQUENCEs or 2179 unordered AS_SETs. AS_SETs are used in the route aggregation 2180 algorithm described in 9.2.4.2. They reduce the size of the 2181 AS_PATH information by listing each AS number only once, 2182 regardless of how many times it may have appeared in multiple 2183 AS_PATHs that were aggregated. 2185 An AS_SET implies that the destinations listed in the NLRI can be 2186 reached through paths that traverse at least some of the 2187 constituent autonomous systems. AS_SETs provide sufficient 2188 information to avoid routing information looping; however their 2189 use may prune potentially feasible paths, since such paths are no 2190 longer listed individually as in the form of AS_SEQUENCEs. In 2191 practice this is not likely to be a problem, since once an IP 2192 packet arrives at the edge of a group of autonomous systems, the 2193 BGP speaker at that point is likely to have more detailed path 2194 information and can distinguish individual paths to destinations. 2196 9.2.4.2 Aggregating Routing Information 2198 Aggregation is the process of combining the characteristics of 2199 several different routes in such a way that a single route can be 2200 advertised. Aggregation can occur as part of the decision process 2201 to reduce the amount of routing information that will be placed in 2202 the Adj-RIBs-Out. 2204 Aggregation reduces the amount of information that a BGP speaker must 2205 store and exchange with other BGP speakers. Routes can be aggregated 2206 by applying the following procedure separately to path attributes of 2207 like type and to the Network Layer Reachability Information. 2209 Routes that have the following attributes shall not be aggregated 2210 unless the corresponding attributes of each route are identical: 2212 RFC DRAFT December 1997 2214 MULTI_EXIT_DISC, NEXT_HOP. 2216 Path attributes that have different type codes can not be aggregated 2217 together. Path of the same type code may be aggregated, according to 2218 the following rules: 2220 ORIGIN attribute: If at least one route among routes that are 2221 aggregated has ORIGIN with the value INCOMPLETE, then the 2222 aggregated route must have the ORIGIN attribute with the value 2223 INCOMPLETE. Otherwise, if at least one route among routes that are 2224 aggregated has ORIGIN with the value EGP, then the aggregated 2225 route must have the origin attribute with the value EGP. In all 2226 other case the value of the ORIGIN attribute of the aggregated 2227 route is INTERNAL. 2229 AS_PATH attribute: If routes to be aggregated have identical 2230 AS_PATH attributes, then the aggregated route has the same AS_PATH 2231 attribute as each individual route. 2233 For the purpose of aggregating AS_PATH attributes we model each AS 2234 within the AS_PATH attribute as a tuple , where 2235 "type" identifies a type of the path segment the AS belongs to 2236 (e.g. AS_SEQUENCE, AS_SET), and "value" is the AS number. If the 2237 routes to be aggregated have different AS_PATH attributes, then 2238 the aggregated AS_PATH attribute shall satisfy all of the 2239 following conditions: 2241 - all tuples of the type AS_SEQUENCE in the aggregated AS_PATH 2242 shall appear in all of the AS_PATH in the initial set of routes 2243 to be aggregated. 2245 - all tuples of the type AS_SET in the aggregated AS_PATH shall 2246 appear in at least one of the AS_PATH in the initial set (they 2247 may appear as either AS_SET or AS_SEQUENCE types). 2249 - for any tuple X of the type AS_SEQUENCE in the aggregated 2250 AS_PATH which precedes tuple Y in the aggregated AS_PATH, X 2251 precedes Y in each AS_PATH in the initial set which contains Y, 2252 regardless of the type of Y. 2254 - No tuple with the same value shall appear more than once in 2255 the aggregated AS_PATH, regardless of the tuple's type. 2257 An implementation may choose any algorithm which conforms to these 2258 rules. At a minimum a conformant implementation shall be able to 2259 perform the following algorithm that meets all of the above 2260 conditions: 2262 RFC DRAFT December 1997 2264 - determine the longest leading sequence of tuples (as defined 2265 above) common to all the AS_PATH attributes of the routes to be 2266 aggregated. Make this sequence the leading sequence of the 2267 aggregated AS_PATH attribute. 2269 - set the type of the rest of the tuples from the AS_PATH 2270 attributes of the routes to be aggregated to AS_SET, and append 2271 them to the aggregated AS_PATH attribute. 2273 - if the aggregated AS_PATH has more than one tuple with the 2274 same value (regardless of tuple's type), eliminate all, but one 2275 such tuple by deleting tuples of the type AS_SET from the 2276 aggregated AS_PATH attribute. 2278 Appendix 6, section 6.8 presents another algorithm that satisfies 2279 the conditions and allows for more complex policy configurations. 2281 ATOMIC_AGGREGATE: If at least one of the routes to be aggregated 2282 has ATOMIC_AGGREGATE path attribute, then the aggregated route 2283 shall have this attribute as well. 2285 AGGREGATOR: All AGGREGATOR attributes of all routes to be 2286 aggregated should be ignored. 2288 9.3 Route Selection Criteria 2290 Generally speaking, additional rules for comparing routes among 2291 several alternatives are outside the scope of this document. There 2292 are two exceptions: 2294 - If the local AS appears in the AS path of the new route being 2295 considered, then that new route cannot be viewed as better than 2296 any other route. If such a route were ever used, a routing loop 2297 could result (see Section 6.3). 2299 - In order to achieve successful distributed operation, only 2300 routes with a likelihood of stability can be chosen. Thus, an AS 2301 must avoid using unstable routes, and it must not make rapid 2302 spontaneous changes to its choice of route. Quantifying the terms 2303 "unstable" and "rapid" in the previous sentence will require 2304 experience, but the principle is clear. 2306 RFC DRAFT December 1997 2308 9.4 Originating BGP routes 2310 A BGP speaker may originate BGP routes by injecting routing 2311 information acquired by some other means (e.g. via an IGP) into BGP. 2312 A BGP speaker that originates BGP routes shall assign the degree of 2313 preference to these routes by passing them through the Decision 2314 Process (see Section 9.1). These routes may also be distributed to 2315 other BGP speakers within the local AS as part of the Internal update 2316 process (see Section 9.2.1). The decision whether to distribute non- 2317 BGP acquired routes within an AS via BGP or not depends on the 2318 environment within the AS (e.g. type of IGP) and should be controlled 2319 via configuration. 2321 Appendix 1. BGP FSM State Transitions and Actions. 2323 This Appendix discusses the transitions between states in the BGP FSM 2324 in response to BGP events. The following is the list of these states 2325 and events when the negotiated Hold Time value is non-zero. 2327 BGP States: 2329 1 - Idle 2330 2 - Connect 2331 3 - Active 2332 4 - OpenSent 2333 5 - OpenConfirm 2334 6 - Established 2336 BGP Events: 2338 1 - BGP Start 2339 2 - BGP Stop 2340 3 - BGP Transport connection open 2341 4 - BGP Transport connection closed 2342 5 - BGP Transport connection open failed 2343 6 - BGP Transport fatal error 2344 7 - ConnectRetry timer expired 2345 8 - Hold Timer expired 2346 9 - KeepAlive timer expired 2347 10 - Receive OPEN message 2348 11 - Receive KEEPALIVE message 2349 12 - Receive UPDATE messages 2350 13 - Receive NOTIFICATION message 2351 RFC DRAFT December 1997 2353 The following table describes the state transitions of the BGP FSM 2354 and the actions triggered by these transitions. 2356 Event Actions Message Sent Next State 2357 -------------------------------------------------------------------- 2358 Idle (1) 2359 1 Initialize resources none 2 2360 Start ConnectRetry timer 2361 Initiate a transport connection 2362 others none none 1 2364 Connect(2) 2365 1 none none 2 2366 3 Complete initialization OPEN 4 2367 Clear ConnectRetry timer 2368 5 Restart ConnectRetry timer none 3 2369 7 Restart ConnectRetry timer none 2 2370 Initiate a transport connection 2371 others Release resources none 1 2373 Active (3) 2374 1 none none 3 2375 3 Complete initialization OPEN 4 2376 Clear ConnectRetry timer 2377 5 Close connection 3 2378 Restart ConnectRetry timer 2379 7 Restart ConnectRetry timer none 2 2380 Initiate a transport connection 2381 others Release resources none 1 2383 OpenSent(4) 2384 1 none none 4 2385 4 Close transport connection none 3 2386 Restart ConnectRetry timer 2387 6 Release resources none 1 2388 10 Process OPEN is OK KEEPALIVE 5 2389 Process OPEN failed NOTIFICATION 1 2390 others Close transport connection NOTIFICATION 1 2391 Release resources 2393 OpenConfirm (5) 2394 1 none none 5 2395 4 Release resources none 1 2396 6 Release resources none 1 2397 RFC DRAFT December 1997 2399 9 Restart KeepAlive timer KEEPALIVE 5 2400 11 Complete initialization none 6 2401 Restart Hold Timer 2402 13 Close transport connection 1 2403 Release resources 2404 others Close transport connection NOTIFICATION 1 2405 Release resources 2407 Established (6) 2408 1 none none 6 2409 4 Release resources none 1 2410 6 Release resources none 1 2411 9 Restart KeepAlive timer KEEPALIVE 6 2412 11 Restart Hold Timer KEEPALIVE 6 2413 12 Process UPDATE is OK UPDATE 6 2414 Process UPDATE failed NOTIFICATION 1 2415 13 Close transport connection 1 2416 Release resources 2417 others Close transport connection NOTIFICATION 1 2418 Release resources 2419 --------------------------------------------------------------------- 2421 The following is a condensed version of the above state transition 2422 table. 2424 Events| Idle | Connect | Active | OpenSent | OpenConfirm | Estab 2425 | (1) | (2) | (3) | (4) | (5) | (6) 2426 |--------------------------------------------------------------- 2427 1 | 2 | 2 | 3 | 4 | 5 | 6 2428 | | | | | | 2429 2 | 1 | 1 | 1 | 1 | 1 | 1 2430 | | | | | | 2431 3 | 1 | 4 | 4 | 1 | 1 | 1 2432 | | | | | | 2433 4 | 1 | 1 | 1 | 3 | 1 | 1 2434 | | | | | | 2435 5 | 1 | 3 | 3 | 1 | 1 | 1 2436 | | | | | | 2437 6 | 1 | 1 | 1 | 1 | 1 | 1 2438 | | | | | | 2439 RFC DRAFT December 1997 2441 7 | 1 | 2 | 2 | 1 | 1 | 1 2442 | | | | | | 2443 8 | 1 | 1 | 1 | 1 | 1 | 1 2444 | | | | | | 2445 9 | 1 | 1 | 1 | 1 | 5 | 6 2446 | | | | | | 2447 10 | 1 | 1 | 1 | 1 or 5 | 1 | 1 2448 | | | | | | 2449 11 | 1 | 1 | 1 | 1 | 6 | 6 2450 | | | | | | 2451 12 | 1 | 1 | 1 | 1 | 1 | 1 or 6 2452 | | | | | | 2453 13 | 1 | 1 | 1 | 1 | 1 | 1 2454 | | | | | | 2455 --------------------------------------------------------------- 2457 Appendix 2. Comparison with RFC1267 2459 BGP-4 is capable of operating in an environment where a set of 2460 reachable destinations may be expressed via a single IP prefix. The 2461 concept of network classes, or subnetting is foreign to BGP-4. To 2462 accommodate these capabilities BGP-4 changes semantics and encoding 2463 associated with the AS_PATH attribute. New text has been added to 2464 define semantics associated with IP prefixes. These abilities allow 2465 BGP-4 to support the proposed supernetting scheme [9]. 2467 To simplify configuration this version introduces a new attribute, 2468 LOCAL_PREF, that facilitates route selection procedures. 2470 The INTER_AS_METRIC attribute has been renamed to be MULTI_EXIT_DISC. 2471 A new attribute, ATOMIC_AGGREGATE, has been introduced to insure that 2472 certain aggregates are not de-aggregated. Another new attribute, 2473 AGGREGATOR, can be added to aggregate routes in order to advertise 2474 which AS and which BGP speaker within that AS caused the aggregation. 2476 To insure that Hold Timers are symmetric, the Hold Time is now 2477 negotiated on a per-connection basis. Hold Times of zero are now 2478 supported. 2480 Appendix 3. Comparison with RFC 1163 2482 All of the changes listed in Appendix 2, plus the following. 2484 RFC DRAFT December 1997 2486 To detect and recover from BGP connection collision, a new field (BGP 2487 Identifier) has been added to the OPEN message. New text (Section 2488 6.8) has been added to specify the procedure for detecting and 2489 recovering from collision. 2491 The new document no longer restricts the border router that is passed 2492 in the NEXT_HOP path attribute to be part of the same Autonomous 2493 System as the BGP Speaker. 2495 New document optimizes and simplifies the exchange of the information 2496 about previously reachable routes. 2498 Appendix 4. Comparison with RFC 1105 2500 All of the changes listed in Appendices 2 and 3, plus the following. 2502 Minor changes to the RFC1105 Finite State Machine were necessary to 2503 accommodate the TCP user interface provided by 4.3 BSD. 2505 The notion of Up/Down/Horizontal relations present in RFC1105 has 2506 been removed from the protocol. 2508 The changes in the message format from RFC1105 are as follows: 2510 1. The Hold Time field has been removed from the BGP header and 2511 added to the OPEN message. 2513 2. The version field has been removed from the BGP header and 2514 added to the OPEN message. 2516 3. The Link Type field has been removed from the OPEN message. 2518 4. The OPEN CONFIRM message has been eliminated and replaced with 2519 implicit confirmation provided by the KEEPALIVE message. 2521 5. The format of the UPDATE message has been changed 2522 significantly. New fields were added to the UPDATE message to 2523 support multiple path attributes. 2525 6. The Marker field has been expanded and its role broadened to 2526 support authentication. 2528 Note that quite often BGP, as specified in RFC 1105, is referred 2529 to as BGP-1, BGP, as specified in RFC 1163, is referred to as 2530 BGP-2, BGP, as specified in RFC1267 is referred to as BGP-3, and 2531 BGP, as specified in this document is referred to as BGP-4. 2533 RFC DRAFT December 1997 2535 Appendix 5. TCP options that may be used with BGP 2537 If a local system TCP user interface supports TCP PUSH function, then 2538 each BGP message should be transmitted with PUSH flag set. Setting 2539 PUSH flag forces BGP messages to be transmitted promptly to the 2540 receiver. 2542 If a local system TCP user interface supports setting precedence for 2543 TCP connection, then the BGP transport connection should be opened 2544 with precedence set to Internetwork Control (110) value (see also 2545 [6]). 2547 Appendix 6. Implementation Recommendations 2549 This section presents some implementation recommendations. 2551 6.1 Multiple Networks Per Message 2553 The BGP protocol allows for multiple address prefixes with the same 2554 AS path and next-hop gateway to be specified in one message. Making 2555 use of this capability is highly recommended. With one address prefix 2556 per message there is a substantial increase in overhead in the 2557 receiver. Not only does the system overhead increase due to the 2558 reception of multiple messages, but the overhead of scanning the 2559 routing table for updates to BGP peers and other routing protocols 2560 (and sending the associated messages) is incurred multiple times as 2561 well. One method of building messages containing many address 2562 prefixes per AS path and gateway from a routing table that is not 2563 organized per AS path is to build many messages as the routing table 2564 is scanned. As each address prefix is processed, a message for the 2565 associated AS path and gateway is allocated, if it does not exist, 2566 and the new address prefix is added to it. If such a message exists, 2567 the new address prefix is just appended to it. If the message lacks 2568 the space to hold the new address prefix, it is transmitted, a new 2569 message is allocated, and the new address prefix is inserted into the 2570 new message. When the entire routing table has been scanned, all 2571 allocated messages are sent and their resources released. Maximum 2572 compression is achieved when all the destinations covered by the 2573 address prefixes share a gateway and common path attributes, making 2574 it possible to send many address prefixes in one 4096-byte message. 2576 When peering with a BGP implementation that does not compress 2577 RFC DRAFT December 1997 2579 multiple address prefixes into one message, it may be necessary to 2580 take steps to reduce the overhead from the flood of data received 2581 when a peer is acquired or a significant network topology change 2582 occurs. One method of doing this is to limit the rate of updates. 2583 This will eliminate the redundant scanning of the routing table to 2584 provide flash updates for BGP peers and other routing protocols. A 2585 disadvantage of this approach is that it increases the propagation 2586 latency of routing information. By choosing a minimum flash update 2587 interval that is not much greater than the time it takes to process 2588 the multiple messages this latency should be minimized. A better 2589 method would be to read all received messages before sending updates. 2591 6.2 Processing Messages on a Stream Protocol 2593 BGP uses TCP as a transport mechanism. Due to the stream nature of 2594 TCP, all the data for received messages does not necessarily arrive 2595 at the same time. This can make it difficult to process the data as 2596 messages, especially on systems such as BSD Unix where it is not 2597 possible to determine how much data has been received but not yet 2598 processed. 2600 One method that can be used in this situation is to first try to read 2601 just the message header. For the KEEPALIVE message type, this is a 2602 complete message; for other message types, the header should first be 2603 verified, in particular the total length. If all checks are 2604 successful, the specified length, minus the size of the message 2605 header is the amount of data left to read. An implementation that 2606 would "hang" the routing information process while trying to read 2607 from a peer could set up a message buffer (4096 bytes) per peer and 2608 fill it with data as available until a complete message has been 2609 received. 2611 6.3 Reducing route flapping 2613 To avoid excessive route flapping a BGP speaker which needs to 2614 withdraw a destination and send an update about a more specific or 2615 less specific route SHOULD combine them into the same UPDATE message. 2617 6.4 BGP Timers 2619 BGP employs five timers: ConnectRetry, Hold Time, KeepAlive, 2620 MinASOriginationInterval, and MinRouteAdvertisementInterval The 2621 RFC DRAFT December 1997 2623 suggested value for the ConnectRetry timer is 120 seconds. The 2624 suggested value for the Hold Time is 90 seconds. The suggested value 2625 for the KeepAlive timer is 30 seconds. The suggested value for the 2626 MinASOriginationInterval is 15 seconds. The suggested value for the 2627 MinRouteAdvertisementInterval is 30 seconds. 2629 An implementation of BGP MUST allow these timers to be configurable. 2631 6.5 Path attribute ordering 2633 Implementations which combine update messages as described above in 2634 6.1 may prefer to see all path attributes presented in a known order. 2635 This permits them to quickly identify sets of attributes from 2636 different update messages which are semantically identical. To 2637 facilitate this, it is a useful optimization to order the path 2638 attributes according to type code. This optimization is entirely 2639 optional. 2641 6.6 AS_SET sorting 2643 Another useful optimization that can be done to simplify this 2644 situation is to sort the AS numbers found in an AS_SET. This 2645 optimization is entirely optional. 2647 6.7 Control over version negotiation 2649 Since BGP-4 is capable of carrying aggregated routes which cannot be 2650 properly represented in BGP-3, an implementation which supports BGP-4 2651 and another BGP version should provide the capability to only speak 2652 BGP-4 on a per-peer basis. 2654 6.8 Complex AS_PATH aggregation 2656 An implementation which chooses to provide a path aggregation 2657 algorithm which retains significant amounts of path information may 2658 wish to use the following procedure: 2660 For the purpose of aggregating AS_PATH attributes of two routes, 2661 we model each AS as a tuple , where "type" identifies 2662 a type of the path segment the AS belongs to (e.g. AS_SEQUENCE, 2663 RFC DRAFT December 1997 2665 AS_SET), and "value" is the AS number. Two ASs are said to be the 2666 same if their corresponding tuples are the same. 2668 The algorithm to aggregate two AS_PATH attributes works as 2669 follows: 2671 a) Identify the same ASs (as defined above) within each AS_PATH 2672 attribute that are in the same relative order within both 2673 AS_PATH attributes. Two ASs, X and Y, are said to be in the 2674 same order if either: 2675 - X precedes Y in both AS_PATH attributes, or - Y precedes X 2676 in both AS_PATH attributes. 2678 b) The aggregated AS_PATH attribute consists of ASs identified 2679 in (a) in exactly the same order as they appear in the AS_PATH 2680 attributes to be aggregated. If two consecutive ASs identified 2681 in (a) do not immediately follow each other in both of the 2682 AS_PATH attributes to be aggregated, then the intervening ASs 2683 (ASs that are between the two consecutive ASs that are the 2684 same) in both attributes are combined into an AS_SET path 2685 segment that consists of the intervening ASs from both AS_PATH 2686 attributes; this segment is then placed in between the two 2687 consecutive ASs identified in (a) of the aggregated attribute. 2688 If two consecutive ASs identified in (a) immediately follow 2689 each other in one attribute, but do not follow in another, then 2690 the intervening ASs of the latter are combined into an AS_SET 2691 path segment; this segment is then placed in between the two 2692 consecutive ASs identified in (a) of the aggregated attribute. 2694 If as a result of the above procedure a given AS number appears 2695 more than once within the aggregated AS_PATH attribute, all, but 2696 the last instance (rightmost occurrence) of that AS number should 2697 be removed from the aggregated AS_PATH attribute. 2699 References 2701 [1] Mills, D., "Exterior Gateway Protocol Formal Specification", RFC 2702 904, BBN, April 1984. 2704 [2] Rekhter, Y., "EGP and Policy Based Routing in the New NSFNET 2705 Backbone", RFC 1092, T.J. Watson Research Center, February 1989. 2707 [3] Braun, H-W., "The NSFNET Routing Architecture", RFC 1093, 2708 MERIT/NSFNET Project, February 1989. 2710 [4] Postel, J., "Transmission Control Protocol - DARPA Internet 2711 RFC DRAFT December 1997 2713 Program Protocol Specification", RFC 793, DARPA, September 1981. 2715 [5] Rekhter, Y., and P. Gross, "Application of the Border Gateway 2716 Protocol in the Internet", T.J. Watson Research Center, IBM Corp., 2717 MCI, Internet Draft. 2719 [6] Postel, J., "Internet Protocol - DARPA Internet Program Protocol 2720 Specification", RFC 791, DARPA, September 1981. 2722 [7] "Information Processing Systems - Telecommunications and 2723 Information Exchange between Systems - Protocol for Exchange of 2724 Inter-domain Routeing Information among Intermediate Systems to 2725 Support Forwarding of ISO 8473 PDUs", ISO/IEC IS10747, 1993 2727 [8] Fuller, V., Li, T., Yu, J., and Varadhan, K., ""Classless Inter- 2728 Domain Routing (CIDR): an Address Assignment and Aggregation 2729 Strategy", RFC 1519, BARRNet, cisco, MERIT, OARnet, September 1993 2731 [9] Rekhter, Y., Li, T., "An Architecture for IP Address Allocation 2732 with CIDR", RFC 1518, T.J. Watson Research Center, cisco, September 2733 1993 2735 Security Considerations 2737 Security issues are not discussed in this document. 2739 Editors' Addresses 2741 Yakov Rekhter 2742 cisco Systems, Inc. 2743 170 W. Tasman Dr. 2744 San Jose, CA 95134 2745 email: yakov@cisco.com 2747 Tony Li 2748 Juniper Networks, Inc. 2749 3260 Jay St. 2750 Santa Clara, CA 95051 2751 (408) 327-1906 2752 email: tli@juniper.net