idnits 2.17.1 draft-ietf-idr-bgp4-07.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-24) 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 1169 has weird spacing: '...is less than...' == Line 1656 has weird spacing: '...s whose desti...' == Line 2035 has weird spacing: '...nations of th...' == Line 2197 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 (Februrary 1998) is 9627 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. '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 (==), 4 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group Y. Rekhter 3 INTERNET DRAFT cisco Systems 4 T. Li 5 Juniper Networks 6 Editors 7 Februrary 1998 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 February 1998 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 February 1998 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 February 1998 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 February 1998 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 February 1998 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 February 1998 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 February 1998 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 February 1998 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 February 1998 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 February 1998 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 February 1998 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 February 1998 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 February 1998 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 February 1998 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 February 1998 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 February 1998 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 February 1998 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 February 1998 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 8 - Invalid NEXT_HOP Attribute. 869 9 - Optional Attribute Error. 870 10 - Invalid Network Field. 871 11 - Malformed AS_PATH. 873 Data: 875 This variable-length field is used to diagnose the reason for 876 the NOTIFICATION. The contents of the Data field depend upon 877 the Error Code and Error Subcode. See Section 6 below for more 878 details. 880 Note that the length of the Data field can be determined from 881 the message Length field by the formula: 883 Message Length = 21 + Data Length 885 The minimum length of the NOTIFICATION message is 21 octets 886 (including message header). 888 RFC DRAFT February 1998 890 5. Path Attributes 892 This section discusses the path attributes of the UPDATE message. 894 Path attributes fall into four separate categories: 896 1. Well-known mandatory. 897 2. Well-known discretionary. 898 3. Optional transitive. 899 4. Optional non-transitive. 901 Well-known attributes must be recognized by all BGP implementations. 902 Some of these attributes are mandatory and must be included in every 903 UPDATE message that contains NLRI. Others are discretionary and may 904 or may not be sent in a particular UPDATE message. 906 All well-known attributes must be passed along (after proper 907 updating, if necessary) to other BGP peers. 909 In addition to well-known attributes, each path may contain one or 910 more optional attributes. It is not required or expected that all 911 BGP implementations support all optional attributes. The handling of 912 an unrecognized optional attribute is determined by the setting of 913 the Transitive bit in the attribute flags octet. Paths with 914 unrecognized transitive optional attributes should be accepted. If a 915 path with unrecognized transitive optional attribute is accepted and 916 passed along to other BGP peers, then the unrecognized transitive 917 optional attribute of that path must be passed along with the path to 918 other BGP peers with the Partial bit in the Attribute Flags octet set 919 to 1. If a path with recognized transitive optional attribute is 920 accepted and passed along to other BGP peers and the Partial bit in 921 the Attribute Flags octet is set to 1 by some previous AS, it is not 922 set back to 0 by the current AS. Unrecognized non-transitive optional 923 attributes must be quietly ignored and not passed along to other BGP 924 peers. 926 New transitive optional attributes may be attached to the path by the 927 originator or by any other AS in the path. If they are not attached 928 by the originator, the Partial bit in the Attribute Flags octet is 929 set to 1. The rules for attaching new non-transitive optional 930 attributes will depend on the nature of the specific attribute. The 931 documentation of each new non-transitive optional attribute will be 932 expected to include such rules. (The description of the 933 MULTI_EXIT_DISC attribute gives an example.) All optional attributes 934 (both transitive and non-transitive) may be updated (if appropriate) 935 by ASs in the path. 937 RFC DRAFT February 1998 939 The sender of an UPDATE message should order path attributes within 940 the UPDATE message in ascending order of attribute type. The 941 receiver of an UPDATE message must be prepared to handle path 942 attributes within the UPDATE message that are out of order. 944 The same attribute cannot appear more than once within the Path 945 Attributes field of a particular UPDATE message. 947 The mandatory category refers to an attribute which must be present 948 in both IBGP and EBGP exchanges if NLRI are contained in the UPDATE 949 message. Attributes classified as optional for the purpose of the 950 protocol extension mechanism may be purely discretionary, or 951 discretionary, required, or disallowed in certain contexts. 953 attribute EBGP IBGP 954 ORIGIN mandatory mandatory 955 AS_PATH mandatory mandatory 956 NEXT_HOP mandatory mandatory 957 MULTI_EXIT_DISC discretionary discretionary 958 LOCAL_PREF disallowed required 959 ATOMIC_AGGREGATE see section 5.1.6 and 9.1.4 960 AGGREGATOR discretionary discretionary 962 5.1 Path Attribute Usage 964 The usage of each BGP path attributes is described in the following 965 clauses. 967 5.1.1 ORIGIN 969 ORIGIN is a well-known mandatory attribute. The ORIGIN attribute 970 shall be generated by the autonomous system that originates the 971 associated routing information. It shall be included in the UPDATE 972 messages of all BGP speakers that choose to propagate this 973 information to other BGP speakers. 975 5.1.2 AS_PATH 977 AS_PATH is a well-known mandatory attribute. This attribute 978 RFC DRAFT February 1998 980 identifies the autonomous systems through which routing information 981 carried in this UPDATE message has passed. The components of this 982 list can be AS_SETs or AS_SEQUENCEs. 984 When a BGP speaker propagates a route which it has learned from 985 another BGP speaker's UPDATE message, it shall modify the route's 986 AS_PATH attribute based on the location of the BGP speaker to which 987 the route will be sent: 989 a) When a given BGP speaker advertises the route to an internal 990 peer, the advertising speaker shall not modify the AS_PATH 991 attribute associated with the route. 993 b) When a given BGP speaker advertises the route to an external 994 peer, then the advertising speaker shall update the AS_PATH 995 attribute as follows: 997 1) if the first path segment of the AS_PATH is of type 998 AS_SEQUENCE, the local system shall prepend its own AS number 999 as the last element of the sequence (put it in the leftmost 1000 position) 1002 2) if the first path segment of the AS_PATH is of type AS_SET, 1003 the local system shall prepend a new path segment of type 1004 AS_SEQUENCE to the AS_PATH, including its own AS number in that 1005 segment. 1007 When a BGP speaker originates a route then: 1009 a) the originating speaker shall include its own AS number in 1010 the AS_PATH attribute of all UPDATE messages sent to an 1011 external peer. (In this case, the AS number of the originating 1012 speaker's autonomous system will be the only entry in the 1013 AS_PATH attribute). 1015 b) the originating speaker shall include an empty AS_PATH 1016 attribute in all UPDATE messages sent to internal peers. (An 1017 empty AS_PATH attribute is one whose length field contains the 1018 value zero). 1020 5.1.3 NEXT_HOP 1022 The NEXT_HOP path attribute defines the IP address of the border 1023 router that should be used as the next hop to the destinations listed 1024 in the UPDATE message. When advertising a NEXT_HOP attribute to an 1025 RFC DRAFT February 1998 1027 external peer, a router may use one of its own interface addresses in 1028 the NEXT_HOP attribute provided the external peer to which the route 1029 is being advertised shares a common subnet with the NEXT_HOP address. 1030 This is known as a "first party" NEXT_HOP attribute. A BGP speaker 1031 can advertise to an external peer an interface of any internal peer 1032 router in the NEXT_HOP attribute provided the external peer to which 1033 the route is being advertised shares a common subnet with the 1034 NEXT_HOP address. This is known as a "third party" NEXT_HOP 1035 attribute. A BGP speaker can advertise any external peer router in 1036 the NEXT_HOP attribute provided that the IP address of this border 1037 router was learned from an external peer and the external peer to 1038 which the route is being advertised shares a common subnet with the 1039 NEXT_HOP address. This is a second form of "third party" NEXT_HOP 1040 attribute. 1042 Normally the NEXT_HOP attribute is chosen such that the shortest 1043 available path will be taken. A BGP speaker must be able to support 1044 disabling advertisement of third party NEXT_HOP attributes to handle 1045 imperfectly bridged media. 1047 A BGP speaker must never advertise an address of a peer to that peer 1048 as a NEXT_HOP, for a route that the speaker is originating. A BGP 1049 speaker must never install a route with itself as the next hop. 1051 When a BGP speaker advertises the route to an internal peer, the 1052 advertising speaker should not modify the NEXT_HOP attribute 1053 associated with the route. When a BGP speaker receives the route via 1054 an internal link, it may forward packets to the NEXT_HOP address if 1055 the address contained in the attribute is on a common subnet with the 1056 local and remote BGP speakers. 1058 5.1.4 MULTI_EXIT_DISC 1060 The MULTI_EXIT_DISC attribute may be used on external (inter-AS) 1061 links to discriminate among multiple exit or entry points to the same 1062 neighboring AS. The value of the MULTI_EXIT_DISC attribute is a four 1063 octet unsigned number which is called a metric. All other factors 1064 being equal, the exit or entry point with lower metric should be 1065 preferred. If received over external links, the MULTI_EXIT_DISC 1066 attribute MAY be propagated over internal links to other BGP speakers 1067 within the same AS. The MULTI_EXIT_DISC attribute received from a 1068 neighboring AS MUST NOT be propagated to other neighboring ASs. 1070 A BGP speaker MUST IMPLEMENT a mechanism based on local configuration 1071 which allows the MULTI_EXIT_DISC attribute to be removed from a 1072 route. This MAY be done either prior to or after determining the 1073 RFC DRAFT February 1998 1075 degree of preference of the route and performing route selection 1076 (decision process phases 1 and 2). 1078 An implementation MAY also (based on local configuration) alter the 1079 value of the MULTI_EXIT_DISC attribute received over an external 1080 link. If it does so, it shall do so prior to determining the degree 1081 of preference of the route and performing route selection (decision 1082 process phases 1 and 2). 1084 5.1.5 LOCAL_PREF 1086 LOCAL_PREF is a well-known mandatory attribute that SHALL be included 1087 in all UPDATE messages that a given BGP speaker sends to the other 1088 internal peers. A BGP speaker SHALL calculate the degree of 1089 preference for each external route and include the degree of 1090 preference when advertising a route to its internal peers. The higher 1091 degree of preference MUST be preferred. A BGP speaker shall use the 1092 degree of preference learned via LOCAL_PREF in its decision process 1093 (see section 9.1.1). 1095 A BGP speaker MUST NOT include this attribute in UPDATE messages that 1096 it sends to external peers. If it is contained in an UPDATE message 1097 that is received from an external peer, then this attribute MUST be 1098 ignored by the receiving speaker. 1100 5.1.6 ATOMIC_AGGREGATE 1102 ATOMIC_AGGREGATE is a well-known discretionary attribute. If a BGP 1103 speaker, when presented with a set of overlapping routes from one of 1104 its peers (see 9.1.4), selects the less specific route without 1105 selecting the more specific one, then the local system MUST attach 1106 the ATOMIC_AGGREGATE attribute to the route when propagating it to 1107 other BGP speakers (if that attribute is not already present in the 1108 received less specific route). A BGP speaker that receives a route 1109 with the ATOMIC_AGGREGATE attribute MUST NOT remove the attribute 1110 from the route when propagating it to other speakers. A BGP speaker 1111 that receives a route with the ATOMIC_AGGREGATE attribute MUST NOT 1112 make any NLRI of that route more specific (as defined in 9.1.4) when 1113 advertising this route to other BGP speakers. A BGP speaker that 1114 receives a route with the ATOMIC_AGGREGATE attribute needs to be 1115 cognizant of the fact that the actual path to destinations, as 1116 specified in the NLRI of the route, while having the loop-free 1117 property, may traverse ASs that are not listed in the AS_PATH 1118 attribute. 1120 RFC DRAFT February 1998 1122 5.1.7 AGGREGATOR 1124 AGGREGATOR is an optional transitive attribute which may be included 1125 in updates which are formed by aggregation (see Section 9.2.4.2). A 1126 BGP speaker which performs route aggregation may add the AGGREGATOR 1127 attribute which shall contain its own AS number and IP address. 1129 6. BGP Error Handling. 1131 This section describes actions to be taken when errors are detected 1132 while processing BGP messages. 1134 When any of the conditions described here are detected, a 1135 NOTIFICATION message with the indicated Error Code, Error Subcode, 1136 and Data fields is sent, and the BGP connection is closed. If no 1137 Error Subcode is specified, then a zero must be used. 1139 The phrase "the BGP connection is closed" means that the transport 1140 protocol connection has been closed and that all resources for that 1141 BGP connection have been deallocated. Routing table entries 1142 associated with the remote peer are marked as invalid. The fact that 1143 the routes have become invalid is passed to other BGP peers before 1144 the routes are deleted from the system. 1146 Unless specified explicitly, the Data field of the NOTIFICATION 1147 message that is sent to indicate an error is empty. 1149 6.1 Message Header error handling. 1151 All errors detected while processing the Message Header are indicated 1152 by sending the NOTIFICATION message with Error Code Message Header 1153 Error. The Error Subcode elaborates on the specific nature of the 1154 error. 1156 The expected value of the Marker field of the message header is all 1157 ones if the message type is OPEN. The expected value of the Marker 1158 field for all other types of BGP messages determined based on the 1159 presence of the Authentication Information Optional Parameter in the 1160 BGP OPEN message and the actual authentication mechanism (if the 1161 Authentication Information in the BGP OPEN message is present). If 1162 the Marker field of the message header is not the expected one, then 1163 a synchronization error has occurred and the Error Subcode is set to 1164 Connection Not Synchronized. 1166 RFC DRAFT February 1998 1168 If the Length field of the message header is less than 19 or greater 1169 than 4096, or if the Length field of an OPEN message is less than 1170 the minimum length of the OPEN message, or if the Length field of an 1171 UPDATE message is less than the minimum length of the UPDATE message, 1172 or if the Length field of a KEEPALIVE message is not equal to 19, or 1173 if the Length field of a NOTIFICATION message is less than the 1174 minimum length of the NOTIFICATION message, then the Error Subcode is 1175 set to Bad Message Length. The Data field contains the erroneous 1176 Length field. 1178 If the Type field of the message header is not recognized, then the 1179 Error Subcode is set to Bad Message Type. The Data field contains 1180 the erroneous Type field. 1182 6.2 OPEN message error handling. 1184 All errors detected while processing the OPEN message are indicated 1185 by sending the NOTIFICATION message with Error Code OPEN Message 1186 Error. The Error Subcode elaborates on the specific nature of the 1187 error. 1189 If the version number contained in the Version field of the received 1190 OPEN message is not supported, then the Error Subcode is set to 1191 Unsupported Version Number. The Data field is a 2-octet unsigned 1192 integer, which indicates the largest locally supported version number 1193 less than the version the remote BGP peer bid (as indicated in the 1194 received OPEN message). 1196 If the Autonomous System field of the OPEN message is unacceptable, 1197 then the Error Subcode is set to Bad Peer AS. The determination of 1198 acceptable Autonomous System numbers is outside the scope of this 1199 protocol. 1201 If the Hold Time field of the OPEN message is unacceptable, then the 1202 Error Subcode MUST be set to Unacceptable Hold Time. An 1203 implementation MUST reject Hold Time values of one or two seconds. 1204 An implementation MAY reject any proposed Hold Time. An 1205 implementation which accepts a Hold Time MUST use the negotiated 1206 value for the Hold Time. 1208 If the BGP Identifier field of the OPEN message is syntactically 1209 incorrect, then the Error Subcode is set to Bad BGP Identifier. 1210 Syntactic correctness means that the BGP Identifier field represents 1211 a valid IP host address. 1213 If one of the Optional Parameters in the OPEN message is not 1214 RFC DRAFT February 1998 1216 recognized, then the Error Subcode is set to Unsupported Optional 1217 Parameters. 1219 If the OPEN message carries Authentication Information (as an 1220 Optional Parameter), then the corresponding authentication procedure 1221 is invoked. If the authentication procedure (based on Authentication 1222 Code and Authentication Data) fails, then the Error Subcode is set to 1223 Authentication Failure. 1225 6.3 UPDATE message error handling. 1227 All errors detected while processing the UPDATE message are indicated 1228 by sending the NOTIFICATION message with Error Code UPDATE Message 1229 Error. The error subcode elaborates on the specific nature of the 1230 error. 1232 Error checking of an UPDATE message begins by examining the path 1233 attributes. If the Unfeasible Routes Length or Total Attribute 1234 Length is too large (i.e., if Unfeasible Routes Length + Total 1235 Attribute Length + 23 exceeds the message Length), then the Error 1236 Subcode is set to Malformed Attribute List. 1238 If any recognized attribute has Attribute Flags that conflict with 1239 the Attribute Type Code, then the Error Subcode is set to Attribute 1240 Flags Error. The Data field contains the erroneous attribute (type, 1241 length and value). 1243 If any recognized attribute has Attribute Length that conflicts with 1244 the expected length (based on the attribute type code), then the 1245 Error Subcode is set to Attribute Length Error. The Data field 1246 contains the erroneous attribute (type, length and value). 1248 If any of the mandatory well-known attributes are not present, then 1249 the Error Subcode is set to Missing Well-known Attribute. The Data 1250 field contains the Attribute Type Code of the missing well-known 1251 attribute. 1253 If any of the mandatory well-known attributes are not recognized, 1254 then the Error Subcode is set to Unrecognized Well-known Attribute. 1255 The Data field contains the unrecognized attribute (type, length and 1256 value). 1258 If the ORIGIN attribute has an undefined value, then the Error 1259 Subcode is set to Invalid Origin Attribute. The Data field contains 1260 RFC DRAFT February 1998 1262 the unrecognized attribute (type, length and value). 1264 If the NEXT_HOP attribute field is syntactically incorrect, then the 1265 Error Subcode is set to Invalid NEXT_HOP Attribute. The Data field 1266 contains the incorrect attribute (type, length and value). Syntactic 1267 correctness means that the NEXT_HOP attribute represents a valid IP 1268 host address. Semantic correctness applies only to the external BGP 1269 links. It means that the interface associated with the IP address, as 1270 specified in the NEXT_HOP attribute, shares a common subnet with the 1271 receiving BGP speaker and is not the IP address of the receiving BGP 1272 speaker. If the NEXT_HOP attribute is semantically incorrect, the 1273 error should be logged, and the the route should be ignored. In this 1274 case, no NOTIFICATION message should be sent. 1276 The AS_PATH attribute is checked for syntactic correctness. If the 1277 path is syntactically incorrect, then the Error Subcode is set to 1278 Malformed AS_PATH. 1280 The information carried by the AS_PATH attribute is checked for AS 1281 loops. AS loop detection is done by scanning the full AS path (as 1282 specified in the AS_PATH attribute), and checking that the autonomous 1283 system number of the local system does not appear in the AS path. If 1284 the autonomous system number appears in the AS path the route may be 1285 stored in the Adj-RIB-In, but unless the router is configured to 1286 accept routes with its own autonomous system in the AS path, the 1287 route shall not be passed to the BGP Decision Process. Operations of 1288 a router that is configured to accept routes with its own autonomous 1289 system number in the AS path are outside the scope of this document. 1291 If an optional attribute is recognized, then the value of this 1292 attribute is checked. If an error is detected, the attribute is 1293 discarded, and the Error Subcode is set to Optional Attribute Error. 1294 The Data field contains the attribute (type, length and value). 1296 If any attribute appears more than once in the UPDATE message, then 1297 the Error Subcode is set to Malformed Attribute List. 1299 The NLRI field in the UPDATE message is checked for syntactic 1300 validity. If the field is syntactically incorrect, then the Error 1301 Subcode is set to Invalid Network Field. 1303 An UPDATE message that contains correct path attributes, but no NLRI, 1304 shall be treated as a valid UPDATE message. 1306 RFC DRAFT February 1998 1308 6.4 NOTIFICATION message error handling. 1310 If a peer sends a NOTIFICATION message, and there is an error in that 1311 message, there is unfortunately no means of reporting this error via 1312 a subsequent NOTIFICATION message. Any such error, such as an 1313 unrecognized Error Code or Error Subcode, should be noticed, logged 1314 locally, and brought to the attention of the administration of the 1315 peer. The means to do this, however, lies outside the scope of this 1316 document. 1318 6.5 Hold Timer Expired error handling. 1320 If a system does not receive successive KEEPALIVE and/or UPDATE 1321 and/or NOTIFICATION messages within the period specified in the Hold 1322 Time field of the OPEN message, then the NOTIFICATION message with 1323 Hold Timer Expired Error Code must be sent and the BGP connection 1324 closed. 1326 6.6 Finite State Machine error handling. 1328 Any error detected by the BGP Finite State Machine (e.g., receipt of 1329 an unexpected event) is indicated by sending the NOTIFICATION message 1330 with Error Code Finite State Machine Error. 1332 6.7 Cease. 1334 In absence of any fatal errors (that are indicated in this section), 1335 a BGP peer may choose at any given time to close its BGP connection 1336 by sending the NOTIFICATION message with Error Code Cease. However, 1337 the Cease NOTIFICATION message must not be used when a fatal error 1338 indicated by this section does exist. 1340 6.8 Connection collision detection. 1342 If a pair of BGP speakers try simultaneously to establish a TCP 1343 connection to each other, then two parallel connections between this 1344 pair of speakers might well be formed. We refer to this situation as 1345 connection collision. Clearly, one of these connections must be 1346 closed. 1348 RFC DRAFT February 1998 1350 Based on the value of the BGP Identifier a convention is established 1351 for detecting which BGP connection is to be preserved when a 1352 collision does occur. The convention is to compare the BGP 1353 Identifiers of the peers involved in the collision and to retain only 1354 the connection initiated by the BGP speaker with the higher-valued 1355 BGP Identifier. 1357 Upon receipt of an OPEN message, the local system must examine all of 1358 its connections that are in the OpenConfirm state. A BGP speaker may 1359 also examine connections in an OpenSent state if it knows the BGP 1360 Identifier of the peer by means outside of the protocol. If among 1361 these connections there is a connection to a remote BGP speaker whose 1362 BGP Identifier equals the one in the OPEN message, then the local 1363 system performs the following collision resolution procedure: 1365 1. The BGP Identifier of the local system is compared to the BGP 1366 Identifier of the remote system (as specified in the OPEN 1367 message). 1369 2. If the value of the local BGP Identifier is less than the 1370 remote one, the local system closes BGP connection that already 1371 exists (the one that is already in the OpenConfirm state), and 1372 accepts BGP connection initiated by the remote system. 1374 3. Otherwise, the local system closes newly created BGP connection 1375 (the one associated with the newly received OPEN message), and 1376 continues to use the existing one (the one that is already in the 1377 OpenConfirm state). 1379 Comparing BGP Identifiers is done by treating them as (4-octet 1380 long) unsigned integers. 1382 A connection collision with an existing BGP connection that is in 1383 Established states causes unconditional closing of the newly 1384 created connection. Note that a connection collision cannot be 1385 detected with connections that are in Idle, or Connect, or Active 1386 states. 1388 Closing the BGP connection (that results from the collision 1389 resolution procedure) is accomplished by sending the NOTIFICATION 1390 message with the Error Code Cease. 1392 7. BGP Version Negotiation. 1394 BGP speakers may negotiate the version of the protocol by making 1395 RFC DRAFT February 1998 1397 multiple attempts to open a BGP connection, starting with the highest 1398 version number each supports. If an open attempt fails with an Error 1399 Code OPEN Message Error, and an Error Subcode Unsupported Version 1400 Number, then the BGP speaker has available the version number it 1401 tried, the version number its peer tried, the version number passed 1402 by its peer in the NOTIFICATION message, and the version numbers that 1403 it supports. If the two peers do support one or more common 1404 versions, then this will allow them to rapidly determine the highest 1405 common version. In order to support BGP version negotiation, future 1406 versions of BGP must retain the format of the OPEN and NOTIFICATION 1407 messages. 1409 8. BGP Finite State machine. 1411 This section specifies BGP operation in terms of a Finite State 1412 Machine (FSM). Following is a brief summary and overview of BGP 1413 operations by state as determined by this FSM. A condensed version 1414 of the BGP FSM is found in Appendix 1. 1416 Initially BGP is in the Idle state. 1418 Idle state: 1420 In this state BGP refuses all incoming BGP connections. No 1421 resources are allocated to the peer. In response to the Start 1422 event (initiated by either system or operator) the local system 1423 initializes all BGP resources, starts the ConnectRetry timer, 1424 initiates a transport connection to other BGP peer, while 1425 listening for connection that may be initiated by the remote 1426 BGP peer, and changes its state to Connect. The exact value of 1427 the ConnectRetry timer is a local matter, but should be 1428 sufficiently large to allow TCP initialization. 1430 If a BGP speaker detects an error, it shuts down the connection 1431 and changes its state to Idle. Getting out of the Idle state 1432 requires generation of the Start event. If such an event is 1433 generated automatically, then persistent BGP errors may result 1434 in persistent flapping of the speaker. To avoid such a 1435 condition it is recommended that Start events should not be 1436 generated immediately for a peer that was previously 1437 transitioned to Idle due to an error. For a peer that was 1438 previously transitioned to Idle due to an error, the time 1439 between consecutive generation of Start events, if such events 1440 are generated automatically, shall exponentially increase. The 1441 value of the initial timer shall be 60 seconds. The time shall 1442 be doubled for each consecutive retry. 1444 RFC DRAFT February 1998 1446 Any other event received in the Idle state is ignored. 1448 Connect state: 1450 In this state BGP is waiting for the transport protocol 1451 connection to be completed. 1453 If the transport protocol connection succeeds, the local system 1454 clears the ConnectRetry timer, completes initialization, sends 1455 an OPEN message to its peer, and changes its state to OpenSent. 1457 If the transport protocol connect fails (e.g., retransmission 1458 timeout), the local system restarts the ConnectRetry timer, 1459 continues to listen for a connection that may be initiated by 1460 the remote BGP peer, and changes its state to Active state. 1462 In response to the ConnectRetry timer expired event, the local 1463 system restarts the ConnectRetry timer, initiates a transport 1464 connection to other BGP peer, continues to listen for a 1465 connection that may be initiated by the remote BGP peer, and 1466 stays in the Connect state. 1468 Start event is ignored in the Connect state. 1470 In response to any other event (initiated by either system or 1471 operator), the local system releases all BGP resources 1472 associated with this connection and changes its state to Idle. 1474 Active state: 1476 In this state BGP is trying to acquire a peer by initiating a 1477 transport protocol connection. 1479 If the transport protocol connection succeeds, the local system 1480 clears the ConnectRetry timer, completes initialization, sends 1481 an OPEN message to its peer, sets its Hold Timer to a large 1482 value, and changes its state to OpenSent. A Hold Timer value 1483 of 4 minutes is suggested. 1485 In response to the ConnectRetry timer expired event, the local 1486 system restarts the ConnectRetry timer, initiates a transport 1487 connection to other BGP peer, continues to listen for a 1488 connection that may be initiated by the remote BGP peer, and 1489 changes its state to Connect. 1491 If the local system detects that a remote peer is trying to 1492 establish BGP connection to it, and the IP address of the 1493 remote peer is not an expected one, the local system restarts 1494 RFC DRAFT February 1998 1496 the ConnectRetry timer, rejects the attempted connection, 1497 continues to listen for a connection that may be initiated by 1498 the remote BGP peer, and stays in the Active state. 1500 Start event is ignored in the Active state. 1502 In response to any other event (initiated by either system or 1503 operator), the local system releases all BGP resources 1504 associated with this connection and changes its state to Idle. 1506 OpenSent state: 1508 In this state BGP waits for an OPEN message from its peer. 1509 When an OPEN message is received, all fields are checked for 1510 correctness. If the BGP message header checking or OPEN 1511 message checking detects an error (see Section 6.2), or a 1512 connection collision (see Section 6.8) the local system sends a 1513 NOTIFICATION message and changes its state to Idle. 1515 If there are no errors in the OPEN message, BGP sends a 1516 KEEPALIVE message and sets a KeepAlive timer. The Hold Timer, 1517 which was originally set to a large value (see above), is 1518 replaced with the negotiated Hold Time value (see section 4.2). 1519 If the negotiated Hold Time value is zero, then the Hold Time 1520 timer and KeepAlive timers are not started. If the value of 1521 the Autonomous System field is the same as the local Autonomous 1522 System number, then the connection is an "internal" connection; 1523 otherwise, it is "external". (This will effect UPDATE 1524 processing as described below.) Finally, the state is changed 1525 to OpenConfirm. 1527 If a disconnect notification is received from the underlying 1528 transport protocol, the local system closes the BGP connection, 1529 restarts the ConnectRetry timer, while continue listening for 1530 connection that may be initiated by the remote BGP peer, and 1531 goes into the Active state. 1533 If the Hold Timer expires, the local system sends NOTIFICATION 1534 message with error code Hold Timer Expired and changes its 1535 state to Idle. 1537 In response to the Stop event (initiated by either system or 1538 operator) the local system sends NOTIFICATION message with 1539 Error Code Cease and changes its state to Idle. 1541 Start event is ignored in the OpenSent state. 1543 In response to any other event the local system sends 1544 RFC DRAFT February 1998 1546 NOTIFICATION message with Error Code Finite State Machine Error 1547 and changes its state to Idle. 1549 Whenever BGP changes its state from OpenSent to Idle, it closes 1550 the BGP (and transport-level) connection and releases all 1551 resources associated with that connection. 1553 OpenConfirm state: 1555 In this state BGP waits for a KEEPALIVE or NOTIFICATION 1556 message. 1558 If the local system receives a KEEPALIVE message, it changes 1559 its state to Established. 1561 If the Hold Timer expires before a KEEPALIVE message is 1562 received, the local system sends NOTIFICATION message with 1563 error code Hold Timer Expired and changes its state to Idle. 1565 If the local system receives a NOTIFICATION message, it changes 1566 its state to Idle. 1568 If the KeepAlive timer expires, the local system sends a 1569 KEEPALIVE message and restarts its KeepAlive timer. 1571 If a disconnect notification is received from the underlying 1572 transport protocol, the local system changes its state to Idle. 1574 In response to the Stop event (initiated by either system or 1575 operator) the local system sends NOTIFICATION message with 1576 Error Code Cease and changes its state to Idle. 1578 Start event is ignored in the OpenConfirm state. 1580 In response to any other event the local system sends 1581 NOTIFICATION message with Error Code Finite State Machine Error 1582 and changes its state to Idle. 1584 Whenever BGP changes its state from OpenConfirm to Idle, it 1585 closes the BGP (and transport-level) connection and releases 1586 all resources associated with that connection. 1588 Established state: 1590 In the Established state BGP can exchange UPDATE, NOTIFICATION, 1591 and KEEPALIVE messages with its peer. 1593 If the local system receives an UPDATE or KEEPALIVE message, it 1594 RFC DRAFT February 1998 1596 restarts its Hold Timer, if the negotiated Hold Time value is 1597 non-zero. 1599 If the local system receives a NOTIFICATION message, it changes 1600 its state to Idle. 1602 If the local system receives an UPDATE message and the UPDATE 1603 message error handling procedure (see Section 6.3) detects an 1604 error, the local system sends a NOTIFICATION message and 1605 changes its state to Idle. 1607 If a disconnect notification is received from the underlying 1608 transport protocol, the local system changes its state to Idle. 1610 If the Hold Timer expires, the local system sends a 1611 NOTIFICATION message with Error Code Hold Timer Expired and 1612 changes its state to Idle. 1614 If the KeepAlive timer expires, the local system sends a 1615 KEEPALIVE message and restarts its KeepAlive timer. 1617 Each time the local system sends a KEEPALIVE or UPDATE message, 1618 it restarts its KeepAlive timer, unless the negotiated Hold 1619 Time value is zero. 1621 In response to the Stop event (initiated by either system or 1622 operator), the local system sends a NOTIFICATION message with 1623 Error Code Cease and changes its state to Idle. 1625 Start event is ignored in the Established state. 1627 In response to any other event, the local system sends 1628 NOTIFICATION message with Error Code Finite State Machine Error 1629 and changes its state to Idle. 1631 Whenever BGP changes its state from Established to Idle, it 1632 closes the BGP (and transport-level) connection, releases all 1633 resources associated with that connection, and deletes all 1634 routes derived from that connection. 1636 9. UPDATE Message Handling 1638 An UPDATE message may be received only in the Established state. 1639 When an UPDATE message is received, each field is checked for 1640 validity as specified in Section 6.3. 1642 RFC DRAFT February 1998 1644 If an optional non-transitive attribute is unrecognized, it is 1645 quietly ignored. If an optional transitive attribute is 1646 unrecognized, the Partial bit (the third high-order bit) in the 1647 attribute flags octet is set to 1, and the attribute is retained for 1648 propagation to other BGP speakers. 1650 If an optional attribute is recognized, and has a valid value, then, 1651 depending on the type of the optional attribute, it is processed 1652 locally, retained, and updated, if necessary, for possible 1653 propagation to other BGP speakers. 1655 If the UPDATE message contains a non-empty WITHDRAWN ROUTES field, 1656 the previously advertised routes whose destinations (expressed as IP 1657 prefixes) contained in this field shall be removed from the Adj-RIB- 1658 In. This BGP speaker shall run its Decision Process since the 1659 previously advertised route is not longer available for use. 1661 If the UPDATE message contains a feasible route, it shall be placed 1662 in the appropriate Adj-RIB-In, and the following additional actions 1663 shall be taken: 1665 i) If its Network Layer Reachability Information (NLRI) is identical 1666 to the one of a route currently stored in the Adj-RIB-In, then the 1667 new route shall replace the older route in the Adj-RIB-In, thus 1668 implicitly withdrawing the older route from service. The BGP speaker 1669 shall run its Decision Process since the older route is no longer 1670 available for use. 1672 ii) If the new route is an overlapping route that is included (see 1673 9.1.4) in an earlier route contained in the Adj-RIB-In, the BGP 1674 speaker shall run its Decision Process since the more specific route 1675 has implicitly made a portion of the less specific route unavailable 1676 for use. 1678 iii) If the new route has identical path attributes to an earlier 1679 route contained in the Adj-RIB-In, and is more specific (see 9.1.4) 1680 than the earlier route, no further actions are necessary. 1682 iv) If the new route has NLRI that is not present in any of the 1683 routes currently stored in the Adj-RIB-In, then the new route shall 1684 be placed in the Adj-RIB-In. The BGP speaker shall run its Decision 1685 Process. 1687 v) If the new route is an overlapping route that is less specific 1688 (see 9.1.4) than an earlier route contained in the Adj-RIB-In, the 1689 BGP speaker shall run its Decision Process on the set of destinations 1690 described only by the less specific route. 1692 RFC DRAFT February 1998 1694 9.1 Decision Process 1696 The Decision Process selects routes for subsequent advertisement by 1697 applying the policies in the local Policy Information Base (PIB) to 1698 the routes stored in its Adj-RIB-In. The output of the Decision 1699 Process is the set of routes that will be advertised to all peers; 1700 the selected routes will be stored in the local speaker's Adj-RIB- 1701 Out. 1703 The selection process is formalized by defining a function that takes 1704 the attribute of a given route as an argument and returns a non- 1705 negative integer denoting the degree of preference for the route. 1706 The function that calculates the degree of preference for a given 1707 route shall not use as its inputs any of the following: the existence 1708 of other routes, the non-existence of other routes, or the path 1709 attributes of other routes. Route selection then consists of 1710 individual application of the degree of preference function to each 1711 feasible route, followed by the choice of the one with the highest 1712 degree of preference. 1714 The Decision Process operates on routes contained in each Adj-RIB-In, 1715 and is responsible for: 1717 - selection of routes to be advertised to internal peers 1719 - selection of routes to be advertised to external peers 1721 - route aggregation and route information reduction 1723 The Decision Process takes place in three distinct phases, each 1724 triggered by a different event: 1726 a) Phase 1 is responsible for calculating the degree of preference 1727 for each route received from an external peer, and for advertising 1728 to the other internal peers the routes that have the highest 1729 degree of preference for each distinct destination. 1731 b) Phase 2 is invoked on completion of phase 1. It is responsible 1732 for choosing the best route out of all those available for each 1733 distinct destination, and for installing each chosen route into 1734 the appropriate Loc-RIB. 1736 c) Phase 3 is invoked after the Loc-RIB has been modified. It is 1737 responsible for disseminating routes in the Loc-RIB to each 1738 external peer, according to the policies contained in the PIB. 1739 Route aggregation and information reduction can optionally be 1740 performed within this phase. 1742 RFC DRAFT February 1998 1744 9.1.1 Phase 1: Calculation of Degree of Preference 1746 The Phase 1 decision function shall be invoked whenever the local BGP 1747 speaker receives from a peer an UPDATE message that advertises a new 1748 route, a replacement route, or a withdrawn route. 1750 The Phase 1 decision function is a separate process which completes 1751 when it has no further work to do. 1753 The Phase 1 decision function shall lock an Adj-RIB-In prior to 1754 operating on any route contained within it, and shall unlock it after 1755 operating on all new or unfeasible routes contained within it. 1757 For each newly received or replacement feasible route, the local BGP 1758 speaker shall determine a degree of preference. If the route is 1759 learned from an internal peer, the value of the LOCAL_PREF attribute 1760 shall be taken as the degree of preference. If the route is learned 1761 from an external peer, then the degree of preference shall be 1762 computed based on preconfigured policy information and used as the 1763 LOCAL_PREF value in any IBGP readvertisement. The exact nature of 1764 this policy information and the computation involved is a local 1765 matter. The local speaker shall then run the internal update process 1766 of 9.2.1 to select and advertise the most preferable route. 1768 9.1.2 Phase 2: Route Selection 1770 The Phase 2 decision function shall be invoked on completion of Phase 1771 1. The Phase 2 function is a separate process which completes when 1772 it has no further work to do. The Phase 2 process shall consider all 1773 routes that are present in the Adj-RIBs-In, including those received 1774 from both internal and external peers. 1776 The Phase 2 decision function shall be blocked from running while the 1777 Phase 3 decision function is in process. The Phase 2 function shall 1778 lock all Adj-RIBs-In prior to commencing its function, and shall 1779 unlock them on completion. 1781 If the NEXT_HOP attribute of a BGP route depicts an address to which 1782 the local BGP speaker doesn't have a route in its Loc-RIB, the BGP 1783 route should be excluded from the Phase 2 decision function. 1785 It is critical that routers within an AS do not make conflicting 1786 decisions regarding route selection that would cause forwarding loops 1787 to occur. 1789 RFC DRAFT February 1998 1791 For each set of destinations for which a feasible route exists in the 1792 Adj-RIBs-In, the local BGP speaker shall identify the route that has: 1794 a) the highest degree of preference of any route to the same set 1795 of destinations, or 1797 b) is the only route to that destination, or 1799 c) is selected as a result of the Phase 2 tie breaking rules 1800 specified in 9.1.2.1. 1802 The local speaker SHALL then install that route in the Loc-RIB, 1803 replacing any route to the same destination that is currently being 1804 held in the Loc-RIB. The local speaker MUST determine the immediate 1805 next hop to the address depicted by the NEXT_HOP attribute of the 1806 selected route by performing a lookup in the IGP and selecting one of 1807 the possible paths in the IGP. This immediate next hop MUST be used 1808 when installing the selected route in the Loc-RIB. If the route to 1809 the address depicted by the NEXT_HOP attribute changes such that the 1810 immediate next hop changes, route selection should be recalculated as 1811 specified above. 1813 Unfeasible routes shall be removed from the Loc-RIB, and 1814 corresponding unfeasible routes shall then be removed from the Adj- 1815 RIBs-In. 1817 9.1.2.1 Breaking Ties (Phase 2) 1819 In its Adj-RIBs-In a BGP speaker may have several routes to the same 1820 destination that have the same degree of preference. The local 1821 speaker can select only one of these routes for inclusion in the 1822 associated Loc-RIB. The local speaker considers all routes with the 1823 same degrees of preference, both those received from internal peers, 1824 and those received from external peers. 1826 The following tie-breaking procedure assumes that for each candidate 1827 route all the BGP speakers within an autonomous system can ascertain 1828 the cost of a path (interior distance) to the address depicted by the 1829 NEXT_HOP attribute of the route. 1831 The tie-breaking algorithm begins by considering all equally 1832 preferable routes and then selects routes to be removed from 1833 consideration. The algorithm terminates as soon as only one route 1834 remains in consideration. The criteria must be applied in the order 1835 specified. 1837 RFC DRAFT February 1998 1839 Several of the criteria are described using pseudo-code. Note that 1840 the pseudo-code shown was chosen for clarity, not efficiency. It is 1841 not intended to specify any particular implementation. BGP 1842 implementations MAY use any algorithm which produces the same results 1843 as those described here. 1845 a) Remove from consideration routes with less-preferred 1846 MULTI_EXIT_DISC attributes. MULTI_EXIT_DISC is only comparable 1847 between routes learned from the same neighboring AS. Routes which 1848 do not have the MULTI_EXIT_DISC attribute are considered to have 1849 the highest possible MULTI_EXIT_DISC value. 1851 This is also described in the following procedure: 1853 for m = all routes still under consideration 1854 for n = all routes still under consideration 1855 if (neighborAS(m) == neighborAS(n)) and (MED(n) < MED(m)) 1856 remove route m from consideration 1858 In the pseudo-code above, MED(n) is a function which returns the 1859 value of route n's MULTI_EXIT_DISC attribute. If route n has no 1860 MULTI_EXIT_DISC attribute, the function returns the highest 1861 possible MULTI_EXIT_DISC value, i.e. 2^32-1. 1863 Similarly, neighborAS(n) is a function which returns the neighbor 1864 AS from which the route was received. 1866 b) Remove from consideration any routes with less-preferred 1867 interior cost. The interior cost of a route is determined by 1868 calculating the metric to the next hop for the route using the 1869 interior routing protocol(s). If the next hop for a route is 1870 reachable, but no cost can be determined, then this step should be 1871 should be skipped (equivalently, consider all routes to have equal 1872 costs). 1874 This is also described in the following procedure. 1876 for m = all routes still under consideration 1877 for n = all routes in still under consideration 1878 if (cost(n) is better than cost(m)) 1879 remove m from consideration 1881 In the pseudo-code above, cost(n) is a function which returns the 1882 cost of the path (interior distance) to the address given in the 1883 NEXT_HOP attribute of the route. 1885 c) If at least one of the candidate routes was received from an 1886 external peer in a neighboring autonomous system, remove from 1887 RFC DRAFT February 1998 1889 consideration all routes which were received from internal peers. 1891 d) Remove from consideration all routes other than the route that 1892 was advertised by the BGP speaker whose BGP Identifier has the 1893 lowest value. 1895 9.1.3 Phase 3: Route Dissemination 1897 The Phase 3 decision function shall be invoked on completion of Phase 1898 2, or when any of the following events occur: 1900 a) when routes in a Loc-RIB to local destinations have changed 1902 b) when locally generated routes learned by means outside of BGP 1903 have changed 1905 c) when a new BGP speaker - BGP speaker connection has been 1906 established 1908 The Phase 3 function is a separate process which completes when it 1909 has no further work to do. The Phase 3 Routing Decision function 1910 shall be blocked from running while the Phase 2 decision function is 1911 in process. 1913 All routes in the Loc-RIB shall be processed into a corresponding 1914 entry in the associated Adj-RIBs-Out. Route aggregation and 1915 information reduction techniques (see 9.2.4.1) may optionally be 1916 applied. 1918 For the benefit of future support of inter-AS multicast capabilities, 1919 a BGP speaker that participates in inter-AS multicast routing shall 1920 advertise a route it receives from one of its external peers and if 1921 it installs it in its Loc-RIB, it shall advertise it back to the peer 1922 from which the route was received. For a BGP speaker that does not 1923 participate in inter-AS multicast routing such an advertisement is 1924 optional. When doing such an advertisement, the NEXT_HOP attribute 1925 should be set to the address of the peer. An implementation may also 1926 optimize such an advertisement by truncating information in the 1927 AS_PATH attribute to include only its own AS number and that of the 1928 peer that advertised the route (such truncation requires the ORIGIN 1929 attribute to be set to INCOMPLETE). In addition an implementation is 1930 not required to pass optional or discretionary path attributes with 1931 such an advertisement. 1933 When the updating of the Adj-RIBs-Out and the Forwarding Information 1934 Base (FIB) is complete, the local BGP speaker shall run the external 1935 RFC DRAFT February 1998 1937 update process of 9.2.2. 1939 9.1.4 Overlapping Routes 1941 A BGP speaker may transmit routes with overlapping Network Layer 1942 Reachability Information (NLRI) to another BGP speaker. NLRI overlap 1943 occurs when a set of destinations are identified in non-matching 1944 multiple routes. Since BGP encodes NLRI using IP prefixes, overlap 1945 will always exhibit subset relationships. A route describing a 1946 smaller set of destinations (a longer prefix) is said to be more 1947 specific than a route describing a larger set of destinations (a 1948 shorted prefix); similarly, a route describing a larger set of 1949 destinations (a shorter prefix) is said to be less specific than a 1950 route describing a smaller set of destinations (a longer prefix). 1952 The precedence relationship effectively decomposes less specific 1953 routes into two parts: 1955 - a set of destinations described only by the less specific 1956 route, and 1958 - a set of destinations described by the overlap of the less 1959 specific and the more specific routes 1961 When overlapping routes are present in the same Adj-RIB-In, the more 1962 specific route shall take precedence, in order from more specific to 1963 least specific. 1965 The set of destinations described by the overlap represents a portion 1966 of the less specific route that is feasible, but is not currently in 1967 use. If a more specific route is later withdrawn, the set of 1968 destinations described by the overlap will still be reachable using 1969 the less specific route. 1971 If a BGP speaker receives overlapping routes, the Decision Process 1972 MUST consider both routes based on the configured acceptance policy. 1973 If both a less and a more specific route are accepted, then the 1974 Decision Process MUST either install both the less and the more 1975 specific routes or it MUST aggregate the two routes and install the 1976 aggregated route. 1978 If a BGP speaker chooses to aggregate, then it MUST add 1979 ATOMIC_AGGREGATE attribute to the route. A route that carries 1980 ATOMIC_AGGREGATE attribute can not be de-aggregated. That is, the 1981 NLRI of this route can not be made more specific. Forwarding along 1982 RFC DRAFT February 1998 1984 such a route does not guarantee that IP packets will actually 1985 traverse only ASs listed in the AS_PATH attribute of the route. 1987 9.2 Update-Send Process 1989 The Update-Send process is responsible for advertising UPDATE 1990 messages to all peers. For example, it distributes the routes chosen 1991 by the Decision Process to other BGP speakers which may be located in 1992 either the same autonomous system or a neighboring autonomous system. 1993 Rules for information exchange between BGP speakers located in 1994 different autonomous systems are given in 9.2.2; rules for 1995 information exchange between BGP speakers located in the same 1996 autonomous system are given in 9.2.1. 1998 Distribution of routing information between a set of BGP speakers, 1999 all of which are located in the same autonomous system, is referred 2000 to as internal distribution. 2002 9.2.1 Internal Updates 2004 The Internal update process is concerned with the distribution of 2005 routing information to internal peers. 2007 When a BGP speaker receives an UPDATE message from an internal peer, 2008 the receiving BGP speaker shall not re-distribute the routing 2009 information contained in that UPDATE message to other internal peers. 2011 When a BGP speaker receives a new route from an external peer, it 2012 MUST advertise that route to all other internal peers by means of an 2013 UPDATE message if this routes has been installed in its Loc-RIB 2014 according to the route selection rules in 9.1.2. 2016 When a BGP speaker receives an UPDATE message with a non-empty 2017 WITHDRAWN ROUTES field, it shall remove from its Adj-RIB-In all 2018 routes whose destinations was carried in this field (as IP prefixes). 2019 The speaker shall take the following additional steps: 2021 1) if the corresponding feasible route had not been previously 2022 advertised, then no further action is necessary 2024 2) if the corresponding feasible route had been previously 2025 advertised, then: 2027 i) if a new route is selected for advertisement that has the 2028 RFC DRAFT February 1998 2030 same Network Layer Reachability Information as the unfeasible 2031 routes, then the local BGP speaker shall advertise the 2032 replacement route 2034 ii) if a replacement route is not available for advertisement, 2035 then the BGP speaker shall include the destinations of the 2036 unfeasible route (in form of IP prefixes) in the WITHDRAWN 2037 ROUTES field of an UPDATE message, and shall send this message 2038 to each peer to whom it had previously advertised the 2039 corresponding feasible route. 2041 All feasible routes which are advertised shall be placed in the 2042 appropriate Adj-RIBs-Out, and all unfeasible routes which are 2043 advertised shall be removed from the Adj-RIBs-Out. 2045 9.2.1.1 Breaking Ties (Internal Updates) 2047 If a local BGP speaker has connections to several external peers, 2048 there will be multiple Adj-RIBs-In associated with these peers. These 2049 Adj-RIBs-In might contain several equally preferable routes to the 2050 same destination, all of which were advertised by external peers. 2051 The local BGP speaker shall select one of these routes according to 2052 the following rules: 2054 a) If the candidate routes differ only in their NEXT_HOP and 2055 MULTI_EXIT_DISC attributes, and the local system is configured to 2056 take into account the MULTI_EXIT_DISC attribute, select the route 2057 that has the lowest value of the MULTI_EXIT_DISC attribute. A 2058 route with the MULTI_EXIT_DISC attribute shall be preferred to a 2059 route without the MULTI_EXIT_DISC attribute. 2061 b) If the local system can ascertain the cost of a path to the 2062 entity depicted by the NEXT_HOP attribute of the candidate route, 2063 select the route with the lowest cost. 2065 c) In all other cases, select the route that was advertised by the 2066 BGP speaker whose BGP Identifier has the lowest value. 2068 9.2.2 External Updates 2070 The external update process is concerned with the distribution of 2071 routing information to external peers. As part of Phase 3 route 2072 RFC DRAFT February 1998 2074 selection process, the BGP speaker has updated its Adj-RIBs-Out and 2075 its Forwarding Table. All newly installed routes and all newly 2076 unfeasible routes for which there is no replacement route shall be 2077 advertised to external peers by means of UPDATE message. 2079 Any routes in the Loc-RIB marked as unfeasible shall be removed. 2080 Changes to the reachable destinations within its own autonomous 2081 system shall also be advertised in an UPDATE message. 2083 9.2.3 Controlling Routing Traffic Overhead 2085 The BGP protocol constrains the amount of routing traffic (that is, 2086 UPDATE messages) in order to limit both the link bandwidth needed to 2087 advertise UPDATE messages and the processing power needed by the 2088 Decision Process to digest the information contained in the UPDATE 2089 messages. 2091 9.2.3.1 Frequency of Route Advertisement 2093 The parameter MinRouteAdvertisementInterval determines the minimum 2094 amount of time that must elapse between advertisement of routes to a 2095 particular destination from a single BGP speaker. This rate limiting 2096 procedure applies on a per-destination basis, although the value of 2097 MinRouteAdvertisementInterval is set on a per BGP peer basis. 2099 Two UPDATE messages sent from a single BGP speaker that advertise 2100 feasible routes to some common set of destinations received from 2101 external peers must be separated by at least 2102 MinRouteAdvertisementInterval. Clearly, this can only be achieved 2103 precisely by keeping a separate timer for each common set of 2104 destinations. This would be unwarranted overhead. Any technique which 2105 ensures that the interval between two UPDATE messages sent from a 2106 single BGP speaker that advertise feasible routes to some common set 2107 of destinations received from external peers will be at least 2108 MinRouteAdvertisementInterval, and will also ensure a constant upper 2109 bound on the interval is acceptable. 2111 Since fast convergence is needed within an autonomous system, this 2112 procedure does not apply for routes received from other internal 2113 peers. To avoid long-lived black holes, the procedure does not apply 2114 to the explicit withdrawal of unfeasible routes (that is, routes 2115 whose destinations (expressed as IP prefixes) are listed in the 2116 WITHDRAWN ROUTES field of an UPDATE message). 2118 RFC DRAFT February 1998 2120 This procedure does not limit the rate of route selection, but only 2121 the rate of route advertisement. If new routes are selected multiple 2122 times while awaiting the expiration of MinRouteAdvertisementInterval, 2123 the last route selected shall be advertised at the end of 2124 MinRouteAdvertisementInterval. 2126 9.2.3.2 Frequency of Route Origination 2128 The parameter MinASOriginationInterval determines the minimum amount 2129 of time that must elapse between successive advertisements of UPDATE 2130 messages that report changes within the advertising BGP speaker's own 2131 autonomous systems. 2133 9.2.3.3 Jitter 2135 To minimize the likelihood that the distribution of BGP messages by a 2136 given BGP speaker will contain peaks, jitter should be applied to the 2137 timers associated with MinASOriginationInterval, Keepalive, and 2138 MinRouteAdvertisementInterval. A given BGP speaker shall apply the 2139 same jitter to each of these quantities regardless of the 2140 destinations to which the updates are being sent; that is, jitter 2141 will not be applied on a "per peer" basis. 2143 The amount of jitter to be introduced shall be determined by 2144 multiplying the base value of the appropriate timer by a random 2145 factor which is uniformly distributed in the range from 0.75 to 1.0. 2147 9.2.4 Efficient Organization of Routing Information 2149 Having selected the routing information which it will advertise, a 2150 BGP speaker may avail itself of several methods to organize this 2151 information in an efficient manner. 2153 9.2.4.1 Information Reduction 2155 Information reduction may imply a reduction in granularity of policy 2156 control - after information is collapsed, the same policies will 2157 apply to all destinations and paths in the equivalence class. 2159 The Decision Process may optionally reduce the amount of information 2160 RFC DRAFT February 1998 2162 that it will place in the Adj-RIBs-Out by any of the following 2163 methods: 2165 a) Network Layer Reachability Information (NLRI): 2167 Destination IP addresses can be represented as IP address 2168 prefixes. In cases where there is a correspondence between the 2169 address structure and the systems under control of an autonomous 2170 system administrator, it will be possible to reduce the size of 2171 the NLRI carried in the UPDATE messages. 2173 b) AS_PATHs: 2175 AS path information can be represented as ordered AS_SEQUENCEs or 2176 unordered AS_SETs. AS_SETs are used in the route aggregation 2177 algorithm described in 9.2.4.2. They reduce the size of the 2178 AS_PATH information by listing each AS number only once, 2179 regardless of how many times it may have appeared in multiple 2180 AS_PATHs that were aggregated. 2182 An AS_SET implies that the destinations listed in the NLRI can be 2183 reached through paths that traverse at least some of the 2184 constituent autonomous systems. AS_SETs provide sufficient 2185 information to avoid routing information looping; however their 2186 use may prune potentially feasible paths, since such paths are no 2187 longer listed individually as in the form of AS_SEQUENCEs. In 2188 practice this is not likely to be a problem, since once an IP 2189 packet arrives at the edge of a group of autonomous systems, the 2190 BGP speaker at that point is likely to have more detailed path 2191 information and can distinguish individual paths to destinations. 2193 9.2.4.2 Aggregating Routing Information 2195 Aggregation is the process of combining the characteristics of 2196 several different routes in such a way that a single route can be 2197 advertised. Aggregation can occur as part of the decision process 2198 to reduce the amount of routing information that will be placed in 2199 the Adj-RIBs-Out. 2201 Aggregation reduces the amount of information that a BGP speaker must 2202 store and exchange with other BGP speakers. Routes can be aggregated 2203 by applying the following procedure separately to path attributes of 2204 like type and to the Network Layer Reachability Information. 2206 Routes that have the following attributes shall not be aggregated 2207 unless the corresponding attributes of each route are identical: 2209 RFC DRAFT February 1998 2211 MULTI_EXIT_DISC, NEXT_HOP. 2213 Path attributes that have different type codes can not be aggregated 2214 together. Path of the same type code may be aggregated, according to 2215 the following rules: 2217 ORIGIN attribute: If at least one route among routes that are 2218 aggregated has ORIGIN with the value INCOMPLETE, then the 2219 aggregated route must have the ORIGIN attribute with the value 2220 INCOMPLETE. Otherwise, if at least one route among routes that are 2221 aggregated has ORIGIN with the value EGP, then the aggregated 2222 route must have the origin attribute with the value EGP. In all 2223 other case the value of the ORIGIN attribute of the aggregated 2224 route is INTERNAL. 2226 AS_PATH attribute: If routes to be aggregated have identical 2227 AS_PATH attributes, then the aggregated route has the same AS_PATH 2228 attribute as each individual route. 2230 For the purpose of aggregating AS_PATH attributes we model each AS 2231 within the AS_PATH attribute as a tuple , where 2232 "type" identifies a type of the path segment the AS belongs to 2233 (e.g. AS_SEQUENCE, AS_SET), and "value" is the AS number. If the 2234 routes to be aggregated have different AS_PATH attributes, then 2235 the aggregated AS_PATH attribute shall satisfy all of the 2236 following conditions: 2238 - all tuples of the type AS_SEQUENCE in the aggregated AS_PATH 2239 shall appear in all of the AS_PATH in the initial set of routes 2240 to be aggregated. 2242 - all tuples of the type AS_SET in the aggregated AS_PATH shall 2243 appear in at least one of the AS_PATH in the initial set (they 2244 may appear as either AS_SET or AS_SEQUENCE types). 2246 - for any tuple X of the type AS_SEQUENCE in the aggregated 2247 AS_PATH which precedes tuple Y in the aggregated AS_PATH, X 2248 precedes Y in each AS_PATH in the initial set which contains Y, 2249 regardless of the type of Y. 2251 - No tuple with the same value shall appear more than once in 2252 the aggregated AS_PATH, regardless of the tuple's type. 2254 An implementation may choose any algorithm which conforms to these 2255 rules. At a minimum a conformant implementation shall be able to 2256 perform the following algorithm that meets all of the above 2257 conditions: 2259 RFC DRAFT February 1998 2261 - determine the longest leading sequence of tuples (as defined 2262 above) common to all the AS_PATH attributes of the routes to be 2263 aggregated. Make this sequence the leading sequence of the 2264 aggregated AS_PATH attribute. 2266 - set the type of the rest of the tuples from the AS_PATH 2267 attributes of the routes to be aggregated to AS_SET, and append 2268 them to the aggregated AS_PATH attribute. 2270 - if the aggregated AS_PATH has more than one tuple with the 2271 same value (regardless of tuple's type), eliminate all, but one 2272 such tuple by deleting tuples of the type AS_SET from the 2273 aggregated AS_PATH attribute. 2275 Appendix 6, section 6.8 presents another algorithm that satisfies 2276 the conditions and allows for more complex policy configurations. 2278 ATOMIC_AGGREGATE: If at least one of the routes to be aggregated 2279 has ATOMIC_AGGREGATE path attribute, then the aggregated route 2280 shall have this attribute as well. 2282 AGGREGATOR: All AGGREGATOR attributes of all routes to be 2283 aggregated should be ignored. 2285 9.3 Route Selection Criteria 2287 Generally speaking, additional rules for comparing routes among 2288 several alternatives are outside the scope of this document. There 2289 are two exceptions: 2291 - If the local AS appears in the AS path of the new route being 2292 considered, then that new route cannot be viewed as better than 2293 any other route. If such a route were ever used, a routing loop 2294 could result (see Section 6.3). 2296 - In order to achieve successful distributed operation, only 2297 routes with a likelihood of stability can be chosen. Thus, an AS 2298 must avoid using unstable routes, and it must not make rapid 2299 spontaneous changes to its choice of route. Quantifying the terms 2300 "unstable" and "rapid" in the previous sentence will require 2301 experience, but the principle is clear. 2303 RFC DRAFT February 1998 2305 9.4 Originating BGP routes 2307 A BGP speaker may originate BGP routes by injecting routing 2308 information acquired by some other means (e.g. via an IGP) into BGP. 2309 A BGP speaker that originates BGP routes shall assign the degree of 2310 preference to these routes by passing them through the Decision 2311 Process (see Section 9.1). These routes may also be distributed to 2312 other BGP speakers within the local AS as part of the Internal update 2313 process (see Section 9.2.1). The decision whether to distribute non- 2314 BGP acquired routes within an AS via BGP or not depends on the 2315 environment within the AS (e.g. type of IGP) and should be controlled 2316 via configuration. 2318 Appendix 1. BGP FSM State Transitions and Actions. 2320 This Appendix discusses the transitions between states in the BGP FSM 2321 in response to BGP events. The following is the list of these states 2322 and events when the negotiated Hold Time value is non-zero. 2324 BGP States: 2326 1 - Idle 2327 2 - Connect 2328 3 - Active 2329 4 - OpenSent 2330 5 - OpenConfirm 2331 6 - Established 2333 BGP Events: 2335 1 - BGP Start 2336 2 - BGP Stop 2337 3 - BGP Transport connection open 2338 4 - BGP Transport connection closed 2339 5 - BGP Transport connection open failed 2340 6 - BGP Transport fatal error 2341 7 - ConnectRetry timer expired 2342 8 - Hold Timer expired 2343 9 - KeepAlive timer expired 2344 10 - Receive OPEN message 2345 11 - Receive KEEPALIVE message 2346 12 - Receive UPDATE messages 2347 13 - Receive NOTIFICATION message 2348 RFC DRAFT February 1998 2350 The following table describes the state transitions of the BGP FSM 2351 and the actions triggered by these transitions. 2353 Event Actions Message Sent Next State 2354 -------------------------------------------------------------------- 2355 Idle (1) 2356 1 Initialize resources none 2 2357 Start ConnectRetry timer 2358 Initiate a transport connection 2359 others none none 1 2361 Connect(2) 2362 1 none none 2 2363 3 Complete initialization OPEN 4 2364 Clear ConnectRetry timer 2365 5 Restart ConnectRetry timer none 3 2366 7 Restart ConnectRetry timer none 2 2367 Initiate a transport connection 2368 others Release resources none 1 2370 Active (3) 2371 1 none none 3 2372 3 Complete initialization OPEN 4 2373 Clear ConnectRetry timer 2374 5 Close connection 3 2375 Restart ConnectRetry timer 2376 7 Restart ConnectRetry timer none 2 2377 Initiate a transport connection 2378 others Release resources none 1 2380 OpenSent(4) 2381 1 none none 4 2382 4 Close transport connection none 3 2383 Restart ConnectRetry timer 2384 6 Release resources none 1 2385 10 Process OPEN is OK KEEPALIVE 5 2386 Process OPEN failed NOTIFICATION 1 2387 others Close transport connection NOTIFICATION 1 2388 Release resources 2390 OpenConfirm (5) 2391 1 none none 5 2392 4 Release resources none 1 2393 6 Release resources none 1 2394 RFC DRAFT February 1998 2396 9 Restart KeepAlive timer KEEPALIVE 5 2397 11 Complete initialization none 6 2398 Restart Hold Timer 2399 13 Close transport connection 1 2400 Release resources 2401 others Close transport connection NOTIFICATION 1 2402 Release resources 2404 Established (6) 2405 1 none none 6 2406 4 Release resources none 1 2407 6 Release resources none 1 2408 9 Restart KeepAlive timer KEEPALIVE 6 2409 11 Restart Hold Timer KEEPALIVE 6 2410 12 Process UPDATE is OK UPDATE 6 2411 Process UPDATE failed NOTIFICATION 1 2412 13 Close transport connection 1 2413 Release resources 2414 others Close transport connection NOTIFICATION 1 2415 Release resources 2416 --------------------------------------------------------------------- 2418 The following is a condensed version of the above state transition 2419 table. 2421 Events| Idle | Connect | Active | OpenSent | OpenConfirm | Estab 2422 | (1) | (2) | (3) | (4) | (5) | (6) 2423 |--------------------------------------------------------------- 2424 1 | 2 | 2 | 3 | 4 | 5 | 6 2425 | | | | | | 2426 2 | 1 | 1 | 1 | 1 | 1 | 1 2427 | | | | | | 2428 3 | 1 | 4 | 4 | 1 | 1 | 1 2429 | | | | | | 2430 4 | 1 | 1 | 1 | 3 | 1 | 1 2431 | | | | | | 2432 5 | 1 | 3 | 3 | 1 | 1 | 1 2433 | | | | | | 2434 6 | 1 | 1 | 1 | 1 | 1 | 1 2435 | | | | | | 2436 RFC DRAFT February 1998 2438 7 | 1 | 2 | 2 | 1 | 1 | 1 2439 | | | | | | 2440 8 | 1 | 1 | 1 | 1 | 1 | 1 2441 | | | | | | 2442 9 | 1 | 1 | 1 | 1 | 5 | 6 2443 | | | | | | 2444 10 | 1 | 1 | 1 | 1 or 5 | 1 | 1 2445 | | | | | | 2446 11 | 1 | 1 | 1 | 1 | 6 | 6 2447 | | | | | | 2448 12 | 1 | 1 | 1 | 1 | 1 | 1 or 6 2449 | | | | | | 2450 13 | 1 | 1 | 1 | 1 | 1 | 1 2451 | | | | | | 2452 --------------------------------------------------------------- 2454 Appendix 2. Comparison with RFC1267 2456 BGP-4 is capable of operating in an environment where a set of 2457 reachable destinations may be expressed via a single IP prefix. The 2458 concept of network classes, or subnetting is foreign to BGP-4. To 2459 accommodate these capabilities BGP-4 changes semantics and encoding 2460 associated with the AS_PATH attribute. New text has been added to 2461 define semantics associated with IP prefixes. These abilities allow 2462 BGP-4 to support the proposed supernetting scheme [9]. 2464 To simplify configuration this version introduces a new attribute, 2465 LOCAL_PREF, that facilitates route selection procedures. 2467 The INTER_AS_METRIC attribute has been renamed to be MULTI_EXIT_DISC. 2468 A new attribute, ATOMIC_AGGREGATE, has been introduced to insure that 2469 certain aggregates are not de-aggregated. Another new attribute, 2470 AGGREGATOR, can be added to aggregate routes in order to advertise 2471 which AS and which BGP speaker within that AS caused the aggregation. 2473 To insure that Hold Timers are symmetric, the Hold Time is now 2474 negotiated on a per-connection basis. Hold Times of zero are now 2475 supported. 2477 Appendix 3. Comparison with RFC 1163 2479 All of the changes listed in Appendix 2, plus the following. 2481 RFC DRAFT February 1998 2483 To detect and recover from BGP connection collision, a new field (BGP 2484 Identifier) has been added to the OPEN message. New text (Section 2485 6.8) has been added to specify the procedure for detecting and 2486 recovering from collision. 2488 The new document no longer restricts the border router that is passed 2489 in the NEXT_HOP path attribute to be part of the same Autonomous 2490 System as the BGP Speaker. 2492 New document optimizes and simplifies the exchange of the information 2493 about previously reachable routes. 2495 Appendix 4. Comparison with RFC 1105 2497 All of the changes listed in Appendices 2 and 3, plus the following. 2499 Minor changes to the RFC1105 Finite State Machine were necessary to 2500 accommodate the TCP user interface provided by 4.3 BSD. 2502 The notion of Up/Down/Horizontal relations present in RFC1105 has 2503 been removed from the protocol. 2505 The changes in the message format from RFC1105 are as follows: 2507 1. The Hold Time field has been removed from the BGP header and 2508 added to the OPEN message. 2510 2. The version field has been removed from the BGP header and 2511 added to the OPEN message. 2513 3. The Link Type field has been removed from the OPEN message. 2515 4. The OPEN CONFIRM message has been eliminated and replaced with 2516 implicit confirmation provided by the KEEPALIVE message. 2518 5. The format of the UPDATE message has been changed 2519 significantly. New fields were added to the UPDATE message to 2520 support multiple path attributes. 2522 6. The Marker field has been expanded and its role broadened to 2523 support authentication. 2525 Note that quite often BGP, as specified in RFC 1105, is referred 2526 to as BGP-1, BGP, as specified in RFC 1163, is referred to as 2527 BGP-2, BGP, as specified in RFC1267 is referred to as BGP-3, and 2528 BGP, as specified in this document is referred to as BGP-4. 2530 RFC DRAFT February 1998 2532 Appendix 5. TCP options that may be used with BGP 2534 If a local system TCP user interface supports TCP PUSH function, then 2535 each BGP message should be transmitted with PUSH flag set. Setting 2536 PUSH flag forces BGP messages to be transmitted promptly to the 2537 receiver. 2539 If a local system TCP user interface supports setting precedence for 2540 TCP connection, then the BGP transport connection should be opened 2541 with precedence set to Internetwork Control (110) value (see also 2542 [6]). 2544 Appendix 6. Implementation Recommendations 2546 This section presents some implementation recommendations. 2548 6.1 Multiple Networks Per Message 2550 The BGP protocol allows for multiple address prefixes with the same 2551 AS path and next-hop gateway to be specified in one message. Making 2552 use of this capability is highly recommended. With one address prefix 2553 per message there is a substantial increase in overhead in the 2554 receiver. Not only does the system overhead increase due to the 2555 reception of multiple messages, but the overhead of scanning the 2556 routing table for updates to BGP peers and other routing protocols 2557 (and sending the associated messages) is incurred multiple times as 2558 well. One method of building messages containing many address 2559 prefixes per AS path and gateway from a routing table that is not 2560 organized per AS path is to build many messages as the routing table 2561 is scanned. As each address prefix is processed, a message for the 2562 associated AS path and gateway is allocated, if it does not exist, 2563 and the new address prefix is added to it. If such a message exists, 2564 the new address prefix is just appended to it. If the message lacks 2565 the space to hold the new address prefix, it is transmitted, a new 2566 message is allocated, and the new address prefix is inserted into the 2567 new message. When the entire routing table has been scanned, all 2568 allocated messages are sent and their resources released. Maximum 2569 compression is achieved when all the destinations covered by the 2570 address prefixes share a gateway and common path attributes, making 2571 it possible to send many address prefixes in one 4096-byte message. 2573 When peering with a BGP implementation that does not compress 2574 RFC DRAFT February 1998 2576 multiple address prefixes into one message, it may be necessary to 2577 take steps to reduce the overhead from the flood of data received 2578 when a peer is acquired or a significant network topology change 2579 occurs. One method of doing this is to limit the rate of updates. 2580 This will eliminate the redundant scanning of the routing table to 2581 provide flash updates for BGP peers and other routing protocols. A 2582 disadvantage of this approach is that it increases the propagation 2583 latency of routing information. By choosing a minimum flash update 2584 interval that is not much greater than the time it takes to process 2585 the multiple messages this latency should be minimized. A better 2586 method would be to read all received messages before sending updates. 2588 6.2 Processing Messages on a Stream Protocol 2590 BGP uses TCP as a transport mechanism. Due to the stream nature of 2591 TCP, all the data for received messages does not necessarily arrive 2592 at the same time. This can make it difficult to process the data as 2593 messages, especially on systems such as BSD Unix where it is not 2594 possible to determine how much data has been received but not yet 2595 processed. 2597 One method that can be used in this situation is to first try to read 2598 just the message header. For the KEEPALIVE message type, this is a 2599 complete message; for other message types, the header should first be 2600 verified, in particular the total length. If all checks are 2601 successful, the specified length, minus the size of the message 2602 header is the amount of data left to read. An implementation that 2603 would "hang" the routing information process while trying to read 2604 from a peer could set up a message buffer (4096 bytes) per peer and 2605 fill it with data as available until a complete message has been 2606 received. 2608 6.3 Reducing route flapping 2610 To avoid excessive route flapping a BGP speaker which needs to 2611 withdraw a destination and send an update about a more specific or 2612 less specific route SHOULD combine them into the same UPDATE message. 2614 6.4 BGP Timers 2616 BGP employs five timers: ConnectRetry, Hold Time, KeepAlive, 2617 MinASOriginationInterval, and MinRouteAdvertisementInterval The 2618 RFC DRAFT February 1998 2620 suggested value for the ConnectRetry timer is 120 seconds. The 2621 suggested value for the Hold Time is 90 seconds. The suggested value 2622 for the KeepAlive timer is 30 seconds. The suggested value for the 2623 MinASOriginationInterval is 15 seconds. The suggested value for the 2624 MinRouteAdvertisementInterval is 30 seconds. 2626 An implementation of BGP MUST allow these timers to be configurable. 2628 6.5 Path attribute ordering 2630 Implementations which combine update messages as described above in 2631 6.1 may prefer to see all path attributes presented in a known order. 2632 This permits them to quickly identify sets of attributes from 2633 different update messages which are semantically identical. To 2634 facilitate this, it is a useful optimization to order the path 2635 attributes according to type code. This optimization is entirely 2636 optional. 2638 6.6 AS_SET sorting 2640 Another useful optimization that can be done to simplify this 2641 situation is to sort the AS numbers found in an AS_SET. This 2642 optimization is entirely optional. 2644 6.7 Control over version negotiation 2646 Since BGP-4 is capable of carrying aggregated routes which cannot be 2647 properly represented in BGP-3, an implementation which supports BGP-4 2648 and another BGP version should provide the capability to only speak 2649 BGP-4 on a per-peer basis. 2651 6.8 Complex AS_PATH aggregation 2653 An implementation which chooses to provide a path aggregation 2654 algorithm which retains significant amounts of path information may 2655 wish to use the following procedure: 2657 For the purpose of aggregating AS_PATH attributes of two routes, 2658 we model each AS as a tuple , where "type" identifies 2659 a type of the path segment the AS belongs to (e.g. AS_SEQUENCE, 2660 RFC DRAFT February 1998 2662 AS_SET), and "value" is the AS number. Two ASs are said to be the 2663 same if their corresponding tuples are the same. 2665 The algorithm to aggregate two AS_PATH attributes works as 2666 follows: 2668 a) Identify the same ASs (as defined above) within each AS_PATH 2669 attribute that are in the same relative order within both 2670 AS_PATH attributes. Two ASs, X and Y, are said to be in the 2671 same order if either: 2672 - X precedes Y in both AS_PATH attributes, or - Y precedes X 2673 in both AS_PATH attributes. 2675 b) The aggregated AS_PATH attribute consists of ASs identified 2676 in (a) in exactly the same order as they appear in the AS_PATH 2677 attributes to be aggregated. If two consecutive ASs identified 2678 in (a) do not immediately follow each other in both of the 2679 AS_PATH attributes to be aggregated, then the intervening ASs 2680 (ASs that are between the two consecutive ASs that are the 2681 same) in both attributes are combined into an AS_SET path 2682 segment that consists of the intervening ASs from both AS_PATH 2683 attributes; this segment is then placed in between the two 2684 consecutive ASs identified in (a) of the aggregated attribute. 2685 If two consecutive ASs identified in (a) immediately follow 2686 each other in one attribute, but do not follow in another, then 2687 the intervening ASs of the latter are combined into an AS_SET 2688 path segment; this segment is then placed in between the two 2689 consecutive ASs identified in (a) of the aggregated attribute. 2691 If as a result of the above procedure a given AS number appears 2692 more than once within the aggregated AS_PATH attribute, all, but 2693 the last instance (rightmost occurrence) of that AS number should 2694 be removed from the aggregated AS_PATH attribute. 2696 References 2698 [1] Mills, D., "Exterior Gateway Protocol Formal Specification", 2699 RFC904, April 1984. 2701 [2] Rekhter, Y., "EGP and Policy Based Routing in the New NSFNET 2702 Backbone", RFC1092, February 1989. 2704 [3] Braun, H-W., "The NSFNET Routing Architecture", RFC1093, February 2705 1989. 2707 [4] Postel, J., "Transmission Control Protocol - DARPA Internet 2708 RFC DRAFT February 1998 2710 Program Protocol Specification", RFC793, September 1981. 2712 [5] Rekhter, Y., and P. Gross, "Application of the Border Gateway 2713 Protocol in the Internet", RFC1772, March 1995. 2715 [6] Postel, J., "Internet Protocol - DARPA Internet Program Protocol 2716 Specification", RFC791, September 1981. 2718 [7] "Information Processing Systems - Telecommunications and 2719 Information Exchange between Systems - Protocol for Exchange of 2720 Inter-domain Routeing Information among Intermediate Systems to 2721 Support Forwarding of ISO 8473 PDUs", ISO/IEC IS10747, 1993 2723 [8] Fuller, V., Li, T., Yu, J., and Varadhan, K., ""Classless Inter- 2724 Domain Routing (CIDR): an Address Assignment and Aggregation 2725 Strategy", RFC1519, September 1993. 2727 [9] Rekhter, Y., Li, T., "An Architecture for IP Address Allocation 2728 with CIDR", RFC 1518, September 1993. 2730 Security Considerations 2732 Security issues are not discussed in this document. 2734 Editors' Addresses 2736 Yakov Rekhter 2737 cisco Systems, Inc. 2738 170 W. Tasman Dr. 2739 San Jose, CA 95134 2740 email: yakov@cisco.com 2742 Tony Li 2743 Juniper Networks, Inc. 2744 3260 Jay St. 2745 Santa Clara, CA 95051 2746 (408) 327-1906 2747 email: tli@juniper.net