idnits 2.17.1 draft-ietf-idr-bgp4-23.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** Looks like you're using RFC 2026 boilerplate. This must be updated to follow RFC 3978/3979, as updated by RFC 4748. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- ** The document seems to lack a 1id_guidelines paragraph about 6 months document validity -- however, there's a paragraph with a matching beginning. Boilerplate error? == No 'Intended status' indicated for this document; assuming Proposed Standard == The page length should not exceed 58 lines per page, but there was 97 longer pages, the longest (page 2) being 61 lines Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There are 96 instances of too long lines in the document, the longest one being 10 characters in excess of 72. ** The abstract seems to contain references ([RFC1518,RFC1519]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. == There are 3 instances of lines with non-RFC6890-compliant IPv4 addresses in the document. If these are example addresses, they should be changed. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the RFC 3978 Section 5.4 Copyright Line does not match the current year == Line 400 has weird spacing: '...setting any B...' == Line 2189 has weird spacing: '... system autom...' == Line 3114 has weird spacing: '...rom the under...' == Line 4292 has weird spacing: '...hen all the d...' -- The exact meaning of the all-uppercase expression 'MAY NOT' is not defined in RFC 2119. If it is intended as a requirements expression, it should be rewritten using one of the combinations defined in RFC 2119; otherwise it should not be all-uppercase. == The expression 'MAY NOT', while looking like RFC 2119 requirements text, is not defined in RFC 2119, and should not be used. Consider using 'MUST NOT' instead (if that is what you mean). Found 'MAY NOT' in this paragraph: BGP implementations MUST recognize all well-known attributes. Some of these attributes are mandatory and MUST be included in every UPDATE message that contains NLRI. Others are discretionary and MAY or MAY NOT be sent in a particular UPDATE message. == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'SHOULD not' in this paragraph: Optional Attribute Status: 1) The DelayOpen optional attribute SHOULD be set to FALSE. 2) The DelayOpenTimer SHOULD not be running. == The expression 'MAY NOT', while looking like RFC 2119 requirements text, is not defined in RFC 2119, and should not be used. Consider using 'MUST NOT' instead (if that is what you mean). Found 'MAY NOT' in this paragraph: If the route is learned from an external peer, then the local BGP speaker computes the degree of preference based on preconfigured policy information. If the return value indicates that the route is ineligible, the route MAY NOT serve as an input to the next phase of route selection; otherwise the return value MUST be used as the LOCAL_PREF value in any IBGP readvertisement. == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: If due to the limits on the maximum size of an UPDATE message (see Section 4) a single route doesn't fit into the message, the BGP speaker MUST not advertise the route to its peers and MAY choose to log an error locally. -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- Couldn't find a document date in the document -- date freshness check skipped. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'RF3065' is mentioned on line 1381, but not defined -- Looks like a reference, but probably isn't: '9' on line 4180 == Unused Reference: 'RFC1772' is defined on line 4516, but no explicit reference was found in the text == Unused Reference: 'RFC1997' is defined on line 4526, but no explicit reference was found in the text == Unused Reference: 'RFC2858' is defined on line 4538, but no explicit reference was found in the text ** Obsolete normative reference: RFC 793 (Obsoleted by RFC 9293) ** Obsolete normative reference: RFC 2385 (Obsoleted by RFC 5925) ** Obsolete normative reference: RFC 2434 (Obsoleted by RFC 5226) -- Obsolete informational reference (is this intentional?): RFC 1519 (Obsoleted by RFC 4632) -- Obsolete informational reference (is this intentional?): RFC 2796 (Obsoleted by RFC 4456) -- Obsolete informational reference (is this intentional?): RFC 2842 (ref. 'RFC3392') (Obsoleted by RFC 3392) -- Obsolete informational reference (is this intentional?): RFC 2858 (Obsoleted by RFC 4760) -- Obsolete informational reference (is this intentional?): RFC 3065 (Obsoleted by RFC 5065) Summary: 7 errors (**), 0 flaws (~~), 16 warnings (==), 9 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 Network Working Group Y. Rekhter 2 INTERNET DRAFT Juniper Networks 3 T. Li 4 Procket Networks, Inc. 5 S. Hares 6 NextHop Technologies, Inc. 7 Editors 9 A Border Gateway Protocol 4 (BGP-4) 10 12 Status of this Memo 14 This document is an Internet-Draft and is in full conformance with 15 all provisions of Section 10 of RFC2026. 17 Internet-Drafts are working documents of the Internet Engineering 18 Task Force (IETF), its areas, and its working groups. Note that 19 other groups may also distribute working documents as Internet- 20 Drafts. 22 Internet-Drafts are draft documents valid for a maximum of six months 23 and may be updated, replaced, or obsoleted by other documents at any 24 time. It is inappropriate to use Internet-Drafts as reference 25 material or to cite them other than as ``work in progress.'' 27 The list of current Internet-Drafts can be accessed at 28 http://www.ietf.org/ietf/1id-abstracts.txt 30 The list of Internet-Draft Shadow Directories can be accessed at 31 http://www.ietf.org/shadow.html. 33 Copyright Notice 35 Copyright (C) The Internet Society (2003). All Rights Reserved. 37 Abstract 39 The Border Gateway Protocol (BGP) is an inter-Autonomous System 40 routing protocol. 42 RFC DRAFT November 2003 44 The primary function of a BGP speaking system is to exchange network 45 reachability information with other BGP systems. This network 46 reachability information includes information on the list of 47 Autonomous Systems (ASs) that reachability information traverses. 48 This information is sufficient to construct a graph of AS 49 connectivity for this reachability from which routing loops may be 50 pruned and some policy decisions at the AS level may be enforced. 52 BGP-4 provides a set of mechanisms for supporting Classless Inter- 53 Domain Routing (CIDR) [RFC1518, RFC1519]. These mechanisms include 54 support for advertising a set of destinations as an IP prefix, and 55 eliminating the concept of network "class" within BGP. BGP-4 also 56 introduces mechanisms which allow aggregation of routes, including 57 aggregation of AS paths. 59 Routing information exchanged via BGP supports only the destination- 60 based forwarding paradigm, which assumes that a router forwards a 61 packet based solely on the destination address carried in the IP 62 header of the packet. This, in turn, reflects the set of policy 63 decisions that can (and can not) be enforced using BGP. BGP can 64 support only the policies conforming to the destination-based 65 forwarding paradigm. 67 This specification covers only the exchange of IP version 4 network 68 reachability information. 70 RFC DRAFT November 2003 72 Table of Contents 74 1. Definition of commonly used terms . . . . . . . . . . . . . . 5 75 2. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 7 76 Specification of Requirements . . . . . . . . . . . . . . . . . . 8 77 3. Summary of Operation . . . . . . . . . . . . . . . . . . . . . 8 78 3.1 Routes: Advertisement and Storage . . . . . . . . . . . . . . 9 79 3.2 Routing Information Bases . . . . . . . . . . . . . . . . . . 10 80 4. Message Formats . . . . . . . . . . . . . . . . . . . . . . . 12 81 4.1 Message Header Format . . . . . . . . . . . . . . . . . . . . 12 82 4.2 OPEN Message Format . . . . . . . . . . . . . . . . . . . . . 13 83 4.3 UPDATE Message Format . . . . . . . . . . . . . . . . . . . . 15 84 4.4 KEEPALIVE Message Format . . . . . . . . . . . . . . . . . . 22 85 4.5 NOTIFICATION Message Format . . . . . . . . . . . . . . . . . 22 86 5. Path Attributes . . . . . . . . . . . . . . . . . . . . . . . 24 87 5.1 Path Attribute Usage . . . . . . . . . . . . . . . . . . . . 26 88 5.1.1 ORIGIN . . . . . . . . . . . . . . . . . . . . . . . . . . 26 89 5.1.2 AS_PATH . . . . . . . . . . . . . . . . . . . . . . . . . . 26 90 5.1.3 NEXT_HOP . . . . . . . . . . . . . . . . . . . . . . . . . 27 91 5.1.4 MULTI_EXIT_DISC . . . . . . . . . . . . . . . . . . . . . . 29 92 5.1.5 LOCAL_PREF . . . . . . . . . . . . . . . . . . . . . . . . 30 93 5.1.6 ATOMIC_AGGREGATE . . . . . . . . . . . . . . . . . . . . . 30 94 5.1.7 AGGREGATOR . . . . . . . . . . . . . . . . . . . . . . . . 31 95 6. BGP Error Handling . . . . . . . . . . . . . . . . . . . . . . 31 96 6.1 Message Header error handling . . . . . . . . . . . . . . . . 31 97 6.2 OPEN message error handling . . . . . . . . . . . . . . . . . 32 98 6.3 UPDATE message error handling . . . . . . . . . . . . . . . . 33 99 6.4 NOTIFICATION message error handling . . . . . . . . . . . . . 35 100 6.5 Hold Timer Expired error handling . . . . . . . . . . . . . . 35 101 6.6 Finite State Machine error handling . . . . . . . . . . . . . 35 102 6.7 Cease . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 103 6.8 BGP connection collision detection . . . . . . . . . . . . . 36 104 7. BGP Version Negotiation . . . . . . . . . . . . . . . . . . . 37 105 8. BGP Finite State machine . . . . . . . . . . . . . . . . . . . 38 106 8.1 Events for the BGP FSM . . . . . . . . . . . . . . . . . . . 39 107 8.1.1 Optional Events linked to Optional Session attributes . . . 39 108 8.1.2 Administrative Events . . . . . . . . . . . . . . . . . . 44 109 8.1.3 Timer Events . . . . . . . . . . . . . . . . . . . . . . . 47 110 8.1.4 TCP connection based Events . . . . . . . . . . . . . . . . 49 111 8.1.5 BGP Messages based Events . . . . . . . . . . . . . . . . . 51 112 8.2 Description of FSM . . . . . . . . . . . . . . . . . . . . . 53 113 8.2.1 FSM Definition . . . . . . . . . . . . . . . . . . . . . . 53 114 8.2.1.1 Terms "active" and "passive" . . . . . . . . . . . . . . 54 115 8.2.1.2 FSM and collision detection . . . . . . . . . . . . . . . 54 116 8.2.1.3 FSM and Optional Attributes . . . . . . . . . . . . . . 55 117 8.2.1.4 FSM Event numbers . . . . . . . . . . . . . . . . . . . . 55 118 RFC DRAFT November 2003 120 8.2.1.5 FSM actions that are implementation dependent . . . . . . 56 121 8.2.2 Finite State Machine . . . . . . . . . . . . . . . . . . . 56 122 9. UPDATE Message Handling . . . . . . . . . . . . . . . . . . . 72 123 9.1 Decision Process . . . . . . . . . . . . . . . . . . . . . . 73 124 9.1.1 Phase 1: Calculation of Degree of Preference . . . . . . . 74 125 9.1.2 Phase 2: Route Selection . . . . . . . . . . . . . . . . . 74 126 9.1.2.1 Route Resolvability Condition . . . . . . . . . . . . . . 76 127 9.1.2.2 Breaking Ties (Phase 2) . . . . . . . . . . . . . . . . . 77 128 9.1.3 Phase 3: Route Dissemination . . . . . . . . . . . . . . . 79 129 9.1.4 Overlapping Routes . . . . . . . . . . . . . . . . . . . . 80 130 9.2 Update-Send Process . . . . . . . . . . . . . . . . . . . . . 81 131 9.2.1 Controlling Routing Traffic Overhead . . . . . . . . . . . 82 132 9.2.1.1 Frequency of Route Advertisement . . . . . . . . . . . . 82 133 9.2.1.2 Frequency of Route Origination . . . . . . . . . . . . . 83 134 9.2.2 Efficient Organization of Routing Information . . . . . . . 83 135 9.2.2.1 Information Reduction . . . . . . . . . . . . . . . . . . 83 136 9.2.2.2 Aggregating Routing Information . . . . . . . . . . . . . 84 137 9.3 Route Selection Criteria . . . . . . . . . . . . . . . . . . 86 138 9.4 Originating BGP routes . . . . . . . . . . . . . . . . . . . 87 139 10. BGP Timers . . . . . . . . . . . . . . . . . . . . . . . . . 87 140 Appendix A. Comparison with RFC1771 . . . . . . . . . . . . . . . 88 141 Appendix B. Comparison with RFC1267 . . . . . . . . . . . . . . . 89 142 Appendix C. Comparison with RFC 1163 . . . . . . . . . . . . . . 90 143 Appendix D. Comparison with RFC 1105 . . . . . . . . . . . . . . 90 144 Appendix E. TCP options that may be used with BGP . . . . . . . . 91 145 Appendix F. Implementation Recommendations . . . . . . . . . . . 91 146 Appendix F.1 Multiple Networks Per Message . . . . . . . . . . . 91 147 Appendix F.2 Reducing route flapping . . . . . . . . . . . . . . 92 148 Appendix F.3 Path attribute ordering . . . . . . . . . . . . . . 92 149 Appendix F.4 AS_SET sorting . . . . . . . . . . . . . . . . . . . 92 150 Appendix F.5 Control over version negotiation . . . . . . . . . . 93 151 Appendix F.6 Complex AS_PATH aggregation . . . . . . . . . . . . 93 152 Security Considerations . . . . . . . . . . . . . . . . . . . . . 94 153 IANA Considerations . . . . . . . . . . . . . . . . . . . . . . . 94 154 IPR Notice . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 155 Full Copyright Notice . . . . . . . . . . . . . . . . . . . . . . 95 156 Normative References . . . . . . . . . . . . . . . . . . . . . . 96 157 Non-normative References . . . . . . . . . . . . . . . . . . . . 96 158 Authors Information . . . . . . . . . . . . . . . . . . . . . . . 98 159 RFC DRAFT November 2003 161 Abstract 163 The Border Gateway Protocol (BGP) is an inter-Autonomous System rout- 164 ing protocol. 166 The primary function of a BGP speaking system is to exchange network 167 reachability information with other BGP systems. This network reacha- 168 bility information includes information on the list of Autonomous 169 Systems (ASs) that reachability information traverses. This informa- 170 tion is sufficient to construct a graph of AS connectivity for this 171 reachability from which routing loops may be pruned and some policy 172 decisions at the AS level may be enforced. 174 BGP-4 provides a set of mechanisms for supporting Classless Inter- 175 Domain Routing (CIDR) [RFC1518, RFC1519]. These mechanisms include 176 support for advertising a set of destinations as an IP prefix and 177 eliminating the concept of network "class" within BGP. BGP-4 also 178 introduces mechanisms which allow aggregation of routes, including 179 aggregation of AS paths. 181 Routing information exchanged via BGP supports only the destination- 182 based forwarding paradigm, which assumes that a router forwards a 183 packet based solely on the destination address carried in the IP 184 header of the packet. This, in turn, reflects the set of policy deci- 185 sions that can (and can not) be enforced using BGP. BGP can support 186 only the policies conforming to the destination-based forwarding 187 paradigm. 189 1. Definition of commonly used terms 191 This section provides definition for terms that have a specific mean- 192 ing to the BGP protocol and that are used throughout the text. 194 Adj-RIB-In 195 The Adj-RIBs-In contain unprocessed routing information that has 196 been advertised to the local BGP speaker by its peers. 198 Adj-RIB-Out 199 The Adj-RIBs-Out contains the routes for advertisement to specific 200 peers by means of the local speaker's UPDATE messages. 202 Autonomous System (AS) 203 The classic definition of an Autonomous System is a set of routers 204 under a single technical administration, using an interior gateway 205 protocol (IGP) and common metrics to determine how to route pack- 206 ets within the AS, and using an inter-AS routing protocol to 207 determine how to route packets to other ASs. Since this classic 208 RFC DRAFT November 2003 210 definition was developed, it has become common for a single AS to 211 use several IGPs and sometimes several sets of metrics within an 212 AS. The use of the term Autonomous System here stresses the fact 213 that, even when multiple IGPs and metrics are used, the adminis- 214 tration of an AS appears to other ASs to have a single coherent 215 interior routing plan and presents a consistent picture of what 216 destinations are reachable through it. 218 BGP Identifier 219 A 4-octet unsigned integer indicating the BGP Identifier of the 220 sender of BGP messages. A given BGP speaker sets the value of its 221 BGP Identifier to an IP address assigned to that BGP speaker. The 222 value of the BGP Identifier is determined on startup and is the 223 same for every local interface and every BGP peer. 225 BGP speaker 226 A router that implements BGP. 228 EBGP 229 External BGP (BGP connection between external peers). 231 External peer 232 Peer that is in a different Autonomous System than the local sys- 233 tem. 235 Feasible route 236 An advertised route that is available for use by the recipient. 238 IBGP 239 Internal BGP (BGP connection between internal peers). 241 Internal peer 242 Peer that is in the same Autonomous System as the local system. 244 IGP 245 Interior Gateway Protocol - a routing protocol used to exchange 246 routing information among routers within a single Autonomous Sys- 247 tem. 249 Loc-RIB 250 The Loc-RIB contains the routes that have been selected by the 251 local BGP speaker's Decision Process. 253 NLRI 254 Network Layer Reachability Information. 256 Route 257 A unit of information that pairs a set of destinations with the 258 RFC DRAFT November 2003 260 attributes of a path to those destinations. The set of destina- 261 tions are systems whose IP addresses are contained in one IP 262 address prefix carried in the Network Layer Reachability Informa- 263 tion (NLRI) field of an UPDATE message. The path is the informa- 264 tion reported in the path attributes field of the same UPDATE mes- 265 sage. 267 RIB 268 Routing Information Base. 270 Unfeasible route 271 A previously advertised feasible route that is no longer available 272 for use. 274 2. Acknowledgments 276 This document was originally published as RFC 1267 in October 1991, 277 jointly authored by Kirk Lougheed and Yakov Rekhter. 279 We would like to express our thanks to Guy Almes, Len Bosack, and 280 Jeffrey C. Honig for their contributions to the earlier version 281 (BGP-1) of this document. 283 We would like to specially acknowledge numerous contributions by Den- 284 nis Ferguson to the earlier version of this document. 286 We like to explicitly thank Bob Braden for the review of the earlier 287 version (BGP-2) of this document as well as his constructive and 288 valuable comments. 290 We would also like to thank Bob Hinden, Director for Routing of the 291 Internet Engineering Steering Group, and the team of reviewers he 292 assembled to review the earlier version (BGP-2) of this document. 293 This team, consisting of Deborah Estrin, Milo Medin, John Moy, Radia 294 Perlman, Martha Steenstrup, Mike St. Johns, and Paul Tsuchiya, acted 295 with a strong combination of toughness, professionalism, and cour- 296 tesy. 298 Certain sections of the document borrowed heavily from IDRP 299 [IS10747], which is the OSI counterpart of BGP. For this credit 300 should be given to the ANSI X3S3.3 group chaired by Lyman Chapin and 301 to Charles Kunzinger who was the IDRP editor within that group. 303 We would also like to thank Benjamin Abarbanel, Enke Chen, Edward 304 Crabbe, Mike Craren, Vincent Gillet, Eric Gray, Jeffrey Haas, Dimitry 305 Haskin, John Krawczyk, David LeRoy, Dan Massey, Jonathan Natale, Dan 306 Pei, Mathew Richardson, John Scudder, John Stewart III, Dave Thaler, 307 RFC DRAFT November 2003 309 Paul Traina, Russ White, Curtis Villamizar, and Alex Zinin for their 310 comments. 312 We would like to specially acknowledge Andrew Lange for his help in 313 preparing the final version of this document. 315 Finally, we would like to thank all the members of the IDR Working 316 Group for their ideas and support they have given to this document. 318 Specification of Requirements 320 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 321 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 322 document are to be interpreted as described in RFC2119 [RFC2119]. 324 3. Summary of Operation 326 The Border Gateway Protocol (BGP) is an inter-Autonomous System rout- 327 ing protocol. It is built on experience gained with EGP as defined in 328 [RFC904] and EGP usage in the NSFNET Backbone as described in 329 [RFC1092] and [RFC1093]. 331 The primary function of a BGP speaking system is to exchange network 332 reachability information with other BGP systems. This network reacha- 333 bility information includes information on the list of Autonomous 334 Systems (ASs) that reachability information traverses. This informa- 335 tion is sufficient to construct a graph of AS connectivity from which 336 routing loops may be pruned and some policy decisions at the AS level 337 may be enforced. 339 In the context of this document we assume that a BGP speaker adver- 340 tises to its peers only those routes that it itself uses (in this 341 context a BGP speaker is said to "use" a BGP route if it is the most 342 preferred BGP route and is used in forwarding). All other cases are 343 outside the scope of this document. 345 In the context of this document the term "IP address" refers to an IP 346 Version 4 address [RFC791]. 348 Routing information exchanged via BGP supports only the destination- 349 based forwarding paradigm, which assumes that a router forwards a 350 packet based solely on the destination address carried in the IP 351 header of the packet. This, in turn, reflects the set of policy deci- 352 sions that can (and can not) be enforced using BGP. Note that some 353 RFC DRAFT November 2003 355 policies can not be supported by the destination-based forwarding 356 paradigm, and thus require techniques such as source routing (aka 357 explicit routing) to be enforced. Such policies can not be enforced 358 using BGP either. For example, BGP does not enable one AS to send 359 traffic to a neighboring AS for forwarding to some destination 360 (reachable through but) beyond that neighboring AS intending that the 361 traffic take a different route to that taken by the traffic originat- 362 ing in the neighboring AS (for that same destination). On the other 363 hand, BGP can support any policy conforming to the destination-based 364 forwarding paradigm. 366 BGP-4 provides a new set of mechanisms for supporting Classless 367 Inter-Domain Routing (CIDR) [RFC1518, RFC1519]. These mechanisms 368 include support for advertising a set of destinations as an IP prefix 369 and eliminating the concept of network "class" within BGP. BGP-4 370 also introduces mechanisms which allow aggregation of routes, includ- 371 ing aggregation of AS paths. 373 This document uses the term `Autonomous System' (AS) throughout. The 374 classic definition of an Autonomous System is a set of routers under 375 a single technical administration, using an interior gateway protocol 376 (IGP) and common metrics to determine how to route packets within the 377 AS, and using an inter-AS routing protocol to determine how to route 378 packets to other ASs. Since this classic definition was developed, it 379 has become common for a single AS to use several IGPs and sometimes 380 several sets of metrics within an AS. The use of the term Autonomous 381 System here stresses the fact that, even when multiple IGPs and met- 382 rics are used, the administration of an AS appears to other ASs to 383 have a single coherent interior routing plan and presents a consis- 384 tent picture of what destinations are reachable through it. 386 BGP uses TCP [RFC793] as its transport protocol. This eliminates the 387 need to implement explicit update fragmentation, retransmission, 388 acknowledgment, and sequencing. BGP listens on TCP port 179. The 389 error notification mechanism used in BGP assumes that TCP supports a 390 "graceful" close, i.e., that all outstanding data will be delivered 391 before the connection is closed. 393 Two systems form a TCP connection between one another. They exchange 394 messages to open and confirm the connection parameters. 396 The initial data flow is the portion of the BGP routing table that is 397 allowed by the export policy, called the Adj-Ribs-Out (see 3.2). 398 Incremental updates are sent as the routing tables change. BGP does 399 not require periodic refresh of the routing table. To allow local 400 policy changes to have the correct effect without resetting any BGP 401 connections, a BGP speaker SHOULD either (a) retain the current ver- 402 sion of the routes advertised to it by all of its peers for the 403 RFC DRAFT November 2003 405 duration of the connection, or (b) make use of the Route Refresh 406 extension [RFC2918]. 408 KEEPALIVE messages may be sent periodically to ensure the liveness of 409 the connection. NOTIFICATION messages are sent in response to errors 410 or special conditions. If a connection encounters an error condition, 411 a NOTIFICATION message is sent and the connection is closed. 413 A peer in a different AS is referred to as an external peer, while a 414 peer in the same AS is referred to as an internal peer. Internal BGP 415 and external BGP are commonly abbreviated IBGP and EBGP. 417 If a particular AS has multiple BGP speakers and is providing transit 418 service for other ASs, then care must be taken to ensure a consistent 419 view of routing within the AS. A consistent view of the interior 420 routes of the AS is provided by the IGP used within the AS. For the 421 purpose of this document, it is assumed that a consistent view of the 422 routes exterior to the AS is provided by having all BGP speakers 423 within the AS maintain IBGP with each other. 425 This document specifies the base behavior of the BGP protocol. This 426 behavior can and is modified by extension specifications. When the 427 protocol is extended the new behavior is fully documented in the 428 extension specifications. 430 3.1 Routes: Advertisement and Storage 432 For the purpose of this protocol, a route is defined as a unit of 433 information that pairs a set of destinations with the attributes of a 434 path to those destinations. The set of destinations are systems whose 435 IP addresses are contained in one IP address prefix carried in the 436 Network Layer Reachability Information (NLRI) field of an UPDATE mes- 437 sage, and the path is the information reported in the path attributes 438 field of the same UPDATE message. 440 Routes are advertised between BGP speakers in UPDATE messages. Mul- 441 tiple routes that have the same path attributes can be advertised in 442 a single UPDATE message by including multiple prefixes in the NLRI 443 field of the UPDATE message. 445 Routes are stored in the Routing Information Bases (RIBs): namely, 446 the Adj-RIBs-In, the Loc-RIB, and the Adj-RIBs-Out, as described in 447 Section 3.2. 449 If a BGP speaker chooses to advertise a previously received route, it 450 MAY add to or modify the path attributes of the route before adver- 451 tising it to a peer. 453 RFC DRAFT November 2003 455 BGP provides mechanisms by which a BGP speaker can inform its peer 456 that a previously advertised route is no longer available for use. 457 There are three methods by which a given BGP speaker can indicate 458 that a route has been withdrawn from service: 460 a) the IP prefix that expresses the destination for a previously 461 advertised route can be advertised in the WITHDRAWN ROUTES field 462 in the UPDATE message, thus marking the associated route as being 463 no longer available for use 465 b) a replacement route with the same NLRI can be advertised, or 467 c) the BGP speaker - BGP speaker connection can be closed, which 468 implicitly removes from service all routes which the pair of 469 speakers had advertised to each other. 471 Changing attribute(s) of a route is accomplished by advertising a 472 replacement route. The replacement route carries new (changed) 473 attributes and has the same address prefix as the original route. 475 3.2 Routing Information Base 477 The Routing Information Base (RIB) within a BGP speaker consists of 478 three distinct parts: 480 a) Adj-RIBs-In: The Adj-RIBs-In store routing information that has 481 been learned from inbound UPDATE messages received from other BGP 482 speakers. Their contents represent routes that are available as an 483 input to the Decision Process. 485 b) Loc-RIB: The Loc-RIB contains the local routing information 486 that the BGP speaker has selected by applying its local policies 487 to the routing information contained in its Adj-RIBs-In. These are 488 the routes that will be used by the local BGP speaker. The next 489 hop for each of these routes MUST be resolvable via the local BGP 490 speaker's Routing Table. 492 c) Adj-RIBs-Out: The Adj-RIBs-Out store the information that the 493 local BGP speaker has selected for advertisement to its peers. The 494 routing information stored in the Adj-RIBs-Out will be carried in 495 the local BGP speaker's UPDATE messages and advertised to its 496 peers. 498 In summary, the Adj-RIBs-In contain unprocessed routing information 499 that has been advertised to the local BGP speaker by its peers; the 500 Loc-RIB contains the routes that have been selected by the local BGP 501 speaker's Decision Process; and the Adj-RIBs-Out organize the routes 502 RFC DRAFT November 2003 504 for advertisement to specific peers by means of the local speaker's 505 UPDATE messages. 507 Although the conceptual model distinguishes between Adj-RIBs-In, Loc- 508 RIB, and Adj-RIBs-Out, this neither implies nor requires that an 509 implementation must maintain three separate copies of the routing 510 information. The choice of implementation (for example, 3 copies of 511 the information vs 1 copy with pointers) is not constrained by the 512 protocol. 514 Routing information that the BGP speaker uses to forward packets (or 515 to construct the forwarding table that is used for packet forwarding) 516 is maintained in the Routing Table. The Routing Table accumulates 517 routes to directly connected networks, static routes, routes learned 518 from the IGP protocols, and routes learned from BGP. Whether or not 519 a specific BGP route should be installed in the Routing Table, and 520 whether a BGP route should override a route to the same destination 521 installed by another source is a local policy decision, not specified 522 in this document. Besides actual packet forwarding, the Routing Table 523 is used for resolution of the next-hop addresses specified in BGP 524 updates (see Section 5.1.3). 526 4. Message Formats 528 This section describes message formats used by BGP. 530 BGP messages are sent over a TCP connection. A message is processed 531 only after it is entirely received. The maximum message size is 4096 532 octets. All implementations are required to support this maximum mes- 533 sage size. The smallest message that may be sent consists of a BGP 534 header without a data portion, or 19 octets. 536 All multi-octet fields are in network byte order. 538 4.1 Message Header Format 540 Each message has a fixed-size header. There may or may not be a data 541 portion following the header, depending on the message type. The lay- 542 out of these fields is shown below: 544 RFC DRAFT November 2003 546 0 1 2 3 547 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 548 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 549 | | 550 + + 551 | | 552 + + 553 | Marker | 554 + + 555 | | 556 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 557 | Length | Type | 558 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 560 Marker: 562 This 16-octet field is included for compatibility; it MUST be 563 set to all ones. 565 Length: 567 This 2-octet unsigned integer indicates the total length of the 568 message, including the header, in octets. Thus, e.g., it allows 569 one to locate in the TCP stream the (Marker field of the) next 570 message. The value of the Length field MUST always be at least 571 19 and no greater than 4096, and MAY be further constrained, 572 depending on the message type. No "padding" of extra data after 573 the message is allowed, so the Length field MUST have the 574 smallest value required given the rest of the message. 576 Type: 578 This 1-octet unsigned integer indicates the type code of the 579 message. This document defines the following type codes: 581 1 - OPEN 582 2 - UPDATE 583 3 - NOTIFICATION 584 4 - KEEPALIVE 586 [RFC2918] defines one more type code. 588 4.2 OPEN Message Format 590 After a TCP connection is established, the first message sent by each 591 side is an OPEN message. If the OPEN message is acceptable, a 592 RFC DRAFT November 2003 594 KEEPALIVE message confirming the OPEN is sent back. 596 In addition to the fixed-size BGP header, the OPEN message contains 597 the following fields: 599 0 1 2 3 600 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 601 +-+-+-+-+-+-+-+-+ 602 | Version | 603 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 604 | My Autonomous System | 605 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 606 | Hold Time | 607 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 608 | BGP Identifier | 609 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 610 | Opt Parm Len | 611 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 612 | | 613 | Optional Parameters (variable) | 614 | | 615 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 617 Version: 619 This 1-octet unsigned integer indicates the protocol version 620 number of the message. The current BGP version number is 4. 622 My Autonomous System: 624 This 2-octet unsigned integer indicates the Autonomous System 625 number of the sender. 627 Hold Time: 629 This 2-octet unsigned integer indicates the number of seconds 630 that the sender proposes for the value of the Hold Timer. Upon 631 receipt of an OPEN message, a BGP speaker MUST calculate the 632 value of the Hold Timer by using the smaller of its configured 633 Hold Time and the Hold Time received in the OPEN message. The 634 Hold Time MUST be either zero or at least three seconds. An 635 implementation MAY reject connections on the basis of the Hold 636 Time. The calculated value indicates the maximum number of 637 seconds that may elapse between the receipt of successive 638 KEEPALIVE, and/or UPDATE messages by the sender. 640 BGP Identifier: 642 RFC DRAFT November 2003 644 This 4-octet unsigned integer indicates the BGP Identifier of 645 the sender. A given BGP speaker sets the value of its BGP Iden- 646 tifier to an IP address assigned to that BGP speaker. The 647 value of the BGP Identifier is determined on startup and is the 648 same for every local interface and every BGP peer. 650 Optional Parameters Length: 652 This 1-octet unsigned integer indicates the total length of the 653 Optional Parameters field in octets. If the value of this field 654 is zero, no Optional Parameters are present. 656 Optional Parameters: 658 This field contains a list of optional parameters, where each 659 parameter is encoded as a triplet. 662 0 1 663 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 664 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-... 665 | Parm. Type | Parm. Length | Parameter Value (variable) 666 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-... 668 Parameter Type is a one octet field that unambiguously identi- 669 fies individual parameters. Parameter Length is a one octet 670 field that contains the length of the Parameter Value field in 671 octets. Parameter Value is a variable length field that is 672 interpreted according to the value of the Parameter Type field. 674 [RFC3392] defines the Capabilities Optional Parameter. 676 The minimum length of the OPEN message is 29 octets (including mes- 677 sage header). 679 4.3 UPDATE Message Format 681 UPDATE messages are used to transfer routing information between BGP 682 peers. The information in the UPDATE message can be used to construct 683 a graph describing the relationships of the various Autonomous Sys- 684 tems. By applying rules to be discussed, routing information loops 685 and some other anomalies may be detected and removed from inter-AS 686 routing. 688 An UPDATE message is used to advertise feasible routes sharing common 689 path attributes to a peer, or to withdraw multiple unfeasible routes 690 RFC DRAFT November 2003 692 from service (see 3.1). An UPDATE message MAY simultaneously adver- 693 tise a feasible route and withdraw multiple unfeasible routes from 694 service. The UPDATE message always includes the fixed-size BGP 695 header, and also includes the other fields as shown below (note, some 696 of the shown fields may not be present in every UPDATE message): 698 +-----------------------------------------------------+ 699 | Withdrawn Routes Length (2 octets) | 700 +-----------------------------------------------------+ 701 | Withdrawn Routes (variable) | 702 +-----------------------------------------------------+ 703 | Total Path Attribute Length (2 octets) | 704 +-----------------------------------------------------+ 705 | Path Attributes (variable) | 706 +-----------------------------------------------------+ 707 | Network Layer Reachability Information (variable) | 708 +-----------------------------------------------------+ 710 Withdrawn Routes Length: 712 This 2-octets unsigned integer indicates the total length of 713 the Withdrawn Routes field in octets. Its value allows the 714 length of the Network Layer Reachability Information field to 715 be determined as specified below. 717 A value of 0 indicates that no routes are being withdrawn from 718 service, and that the WITHDRAWN ROUTES field is not present in 719 this UPDATE message. 721 Withdrawn Routes: 723 This is a variable length field that contains a list of IP 724 address prefixes for the routes that are being withdrawn from 725 service. Each IP address prefix is encoded as a 2-tuple of the 726 form , whose fields are described below: 728 +---------------------------+ 729 | Length (1 octet) | 730 +---------------------------+ 731 | Prefix (variable) | 732 +---------------------------+ 734 The use and the meaning of these fields are as follows: 736 a) Length: 738 RFC DRAFT November 2003 740 The Length field indicates the length in bits of the IP 741 address prefix. A length of zero indicates a prefix that 742 matches all IP addresses (with prefix, itself, of zero 743 octets). 745 b) Prefix: 747 The Prefix field contains an IP address prefix followed by 748 the minimum number of trailing bits needed to make the end 749 of the field fall on an octet boundary. Note that the value 750 of trailing bits is irrelevant. 752 Total Path Attribute Length: 754 This 2-octet unsigned integer indicates the total length of the 755 Path Attributes field in octets. Its value allows the length of 756 the Network Layer Reachability field to be determined as speci- 757 fied below. 759 A value of 0 indicates that neither the Network Layer Reacha- 760 bility Information field, nor the Path Attribute field is 761 present in this UPDATE message. 763 Path Attributes: 765 A variable length sequence of path attributes is present in 766 every UPDATE message, except for an UPDATE message that carries 767 only the withdrawn routes. Each path attribute is a triple 768 of variable 769 length. 771 Attribute Type is a two-octet field that consists of the 772 Attribute Flags octet followed by the Attribute Type Code 773 octet. 775 0 1 776 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 777 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 778 | Attr. Flags |Attr. Type Code| 779 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 781 The high-order bit (bit 0) of the Attribute Flags octet is the 782 Optional bit. It defines whether the attribute is optional (if 783 set to 1) or well-known (if set to 0). 785 The second high-order bit (bit 1) of the Attribute Flags octet 786 is the Transitive bit. It defines whether an optional attribute 787 is transitive (if set to 1) or non-transitive (if set to 0). 789 RFC DRAFT November 2003 791 For well-known attributes, the Transitive bit MUST be set to 1. 792 (See Section 5 for a discussion of transitive attributes.) 794 The third high-order bit (bit 2) of the Attribute Flags octet 795 is the Partial bit. It defines whether the information con- 796 tained in the optional transitive attribute is partial (if set 797 to 1) or complete (if set to 0). For well-known attributes and 798 for optional non-transitive attributes the Partial bit MUST be 799 set to 0. 801 The fourth high-order bit (bit 3) of the Attribute Flags octet 802 is the Extended Length bit. It defines whether the Attribute 803 Length is one octet (if set to 0) or two octets (if set to 1). 805 The lower-order four bits of the Attribute Flags octet are 806 unused. They MUST be zero when sent and MUST be ignored when 807 received. 809 The Attribute Type Code octet contains the Attribute Type Code. 810 Currently defined Attribute Type Codes are discussed in Section 811 5. 813 If the Extended Length bit of the Attribute Flags octet is set 814 to 0, the third octet of the Path Attribute contains the length 815 of the attribute data in octets. 817 If the Extended Length bit of the Attribute Flags octet is set 818 to 1, then the third and the fourth octets of the path 819 attribute contain the length of the attribute data in octets. 821 The remaining octets of the Path Attribute represent the 822 attribute value and are interpreted according to the Attribute 823 Flags and the Attribute Type Code. The supported Attribute Type 824 Codes, their attribute values and uses are the following: 826 a) ORIGIN (Type Code 1): 828 ORIGIN is a well-known mandatory attribute that defines the 829 origin of the path information. The data octet can assume 830 the following values: 832 Value Meaning 834 0 IGP - Network Layer Reachability Information 835 is interior to the originating AS 837 1 EGP - Network Layer Reachability Information 838 learned via the EGP protocol [RFC904] 839 RFC DRAFT November 2003 841 2 INCOMPLETE - Network Layer Reachability 842 Information learned by some other means 844 Usage of this attribute is defined in 5.1.1. 846 b) AS_PATH (Type Code 2): 848 AS_PATH is a well-known mandatory attribute that is composed 849 of a sequence of AS path segments. Each AS path segment is 850 represented by a triple . 853 The path segment type is a 1-octet long field with the fol- 854 lowing values defined: 856 Value Segment Type 858 1 AS_SET: unordered set of ASs a route in the 859 UPDATE message has traversed 861 2 AS_SEQUENCE: ordered set of ASs a route in 862 the UPDATE message has traversed 864 The path segment length is a 1-octet long field containing 865 the number of ASs (not the number of octets) in the path 866 segment value field. 868 The path segment value field contains one or more AS num- 869 bers, each encoded as a 2-octets long field. 871 Usage of this attribute is defined in 5.1.2. 873 c) NEXT_HOP (Type Code 3): 875 This is a well-known mandatory attribute that defines the 876 (unicast) IP address of the router that SHOULD be used as 877 the next hop to the destinations listed in the Network Layer 878 Reachability Information field of the UPDATE message. 880 Usage of this attribute is defined in 5.1.3. 882 d) MULTI_EXIT_DISC (Type Code 4): 884 This is an optional non-transitive attribute that is a four 885 octet unsigned integer. The value of this attribute MAY be 886 used by a BGP speaker's Decision Process to discriminate 887 among multiple entry points to a neighboring autonomous 888 RFC DRAFT November 2003 890 system. 892 Usage of this attribute is defined in 5.1.4. 894 e) LOCAL_PREF (Type Code 5): 896 LOCAL_PREF is a well-known attribute that is a four octet 897 unsigned integer. A BGP speaker uses it to inform its other 898 internal peers of the advertising speaker's degree of pref- 899 erence for an advertised route. 901 Usage of this attribute is defined in 5.1.5. 903 f) ATOMIC_AGGREGATE (Type Code 6) 905 ATOMIC_AGGREGATE is a well-known discretionary attribute of 906 length 0. 908 Usage of this attribute is defined in 5.1.6. 910 g) AGGREGATOR (Type Code 7) 912 AGGREGATOR is an optional transitive attribute of length 6. 913 The attribute contains the last AS number that formed the 914 aggregate route (encoded as 2 octets), followed by the IP 915 address of the BGP speaker that formed the aggregate route 916 (encoded as 4 octets). This SHOULD be the same address as 917 the one used for the BGP Identifier of the speaker. 919 Usage of this attribute is defined in 5.1.7. 921 Network Layer Reachability Information: 923 This variable length field contains a list of IP address pre- 924 fixes. The length in octets of the Network Layer Reachability 925 Information is not encoded explicitly, but can be calculated 926 as: 928 UPDATE message Length - 23 - Total Path Attributes Length - 929 Withdrawn Routes Length 931 where UPDATE message Length is the value encoded in the fixed- 932 size BGP header, Total Path Attribute Length and Withdrawn 933 Routes Length are the values encoded in the variable part of 934 the UPDATE message, and 23 is a combined length of the fixed- 935 size BGP header, the Total Path Attribute Length field and the 936 Withdrawn Routes Length field. 938 RFC DRAFT November 2003 940 Reachability information is encoded as one or more 2-tuples of 941 the form , whose fields are described below: 943 +---------------------------+ 944 | Length (1 octet) | 945 +---------------------------+ 946 | Prefix (variable) | 947 +---------------------------+ 949 The use and the meaning of these fields are as follows: 951 a) Length: 953 The Length field indicates the length in bits of the IP 954 address prefix. A length of zero indicates a prefix that 955 matches all IP addresses (with prefix, itself, of zero 956 octets). 958 b) Prefix: 960 The Prefix field contains an IP address prefix followed by 961 enough trailing bits to make the end of the field fall on an 962 octet boundary. Note that the value of the trailing bits is 963 irrelevant. 965 The minimum length of the UPDATE message is 23 octets -- 19 octets 966 for the fixed header + 2 octets for the Withdrawn Routes Length + 2 967 octets for the Total Path Attribute Length (the value of Withdrawn 968 Routes Length is 0 and the value of Total Path Attribute Length is 969 0). 971 An UPDATE message can advertise at most one set of path attributes, 972 but multiple destinations, provided that the destinations share these 973 attributes. All path attributes contained in a given UPDATE message 974 apply to all destinations carried in the NLRI field of the UPDATE 975 message. 977 An UPDATE message can list multiple routes to be withdrawn from ser- 978 vice. Each such route is identified by its destination (expressed as 979 an IP prefix), which unambiguously identifies the route in the con- 980 text of the BGP speaker - BGP speaker connection to which it has been 981 previously advertised. 983 An UPDATE message might advertise only routes to be withdrawn from 984 service, in which case it will not include path attributes or Network 985 Layer Reachability Information. Conversely, it may advertise only a 986 feasible route, in which case the WITHDRAWN ROUTES field need not be 987 present. 989 RFC DRAFT November 2003 991 An UPDATE message SHOULD NOT include the same address prefix in the 992 WITHDRAWN ROUTES and Network Layer Reachability Information fields, 993 however a BGP speaker MUST be able to process UPDATE messages in this 994 form. A BGP speaker SHOULD treat an UPDATE message of this form as if 995 the WITHDRAWN ROUTES doesn't contain the address prefix. 997 4.4 KEEPALIVE Message Format 999 BGP does not use any TCP-based keep-alive mechanism to determine if 1000 peers are reachable. Instead, KEEPALIVE messages are exchanged 1001 between peers often enough as not to cause the Hold Timer to expire. 1002 A reasonable maximum time between KEEPALIVE messages would be one 1003 third of the Hold Time interval. KEEPALIVE messages MUST NOT be sent 1004 more frequently than one per second. An implementation MAY adjust the 1005 rate at which it sends KEEPALIVE messages as a function of the Hold 1006 Time interval. 1008 If the negotiated Hold Time interval is zero, then periodic KEEPALIVE 1009 messages MUST NOT be sent. 1011 A KEEPALIVE message consists of only message header and has a length 1012 of 19 octets. 1014 4.5 NOTIFICATION Message Format 1016 A NOTIFICATION message is sent when an error condition is detected. 1017 The BGP connection is closed immediately after sending it. 1019 In addition to the fixed-size BGP header, the NOTIFICATION message 1020 contains the following fields: 1022 0 1 2 3 1023 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 1024 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1025 | Error code | Error subcode | Data (variable) | 1026 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1028 Error Code: 1030 This 1-octet unsigned integer indicates the type of NOTIFICA- 1031 TION. The following Error Codes have been defined: 1033 Error Code Symbolic Name Reference 1034 RFC DRAFT November 2003 1036 1 Message Header Error Section 6.1 1038 2 OPEN Message Error Section 6.2 1040 3 UPDATE Message Error Section 6.3 1042 4 Hold Timer Expired Section 6.5 1044 5 Finite State Machine Error Section 6.6 1046 6 Cease Section 6.7 1048 Error subcode: 1050 This 1-octet unsigned integer provides more specific informa- 1051 tion about the nature of the reported error. Each Error Code 1052 may have one or more Error Subcodes associated with it. If no 1053 appropriate Error Subcode is defined, then a zero (Unspecific) 1054 value is used for the Error Subcode field. 1056 Message Header Error subcodes: 1058 1 - Connection Not Synchronized. 1059 2 - Bad Message Length. 1060 3 - Bad Message Type. 1062 OPEN Message Error subcodes: 1064 1 - Unsupported Version Number. 1065 2 - Bad Peer AS. 1066 3 - Bad BGP Identifier. 1067 4 - Unsupported Optional Parameter. 1068 5 - [Deprecated - see Appendix A]. 1069 6 - Unacceptable Hold Time. 1071 UPDATE Message Error subcodes: 1073 1 - Malformed Attribute List. 1074 2 - Unrecognized Well-known Attribute. 1075 3 - Missing Well-known Attribute. 1076 4 - Attribute Flags Error. 1077 5 - Attribute Length Error. 1078 6 - Invalid ORIGIN Attribute. 1079 7 - [Deprecated - see Appendix A]. 1080 8 - Invalid NEXT_HOP Attribute. 1081 9 - Optional Attribute Error. 1082 10 - Invalid Network Field. 1084 RFC DRAFT November 2003 1086 11 - Malformed AS_PATH. 1088 Data: 1090 This variable-length field is used to diagnose the reason for 1091 the NOTIFICATION. The contents of the Data field depend upon 1092 the Error Code and Error Subcode. See Section 6 below for more 1093 details. 1095 Note that the length of the Data field can be determined from 1096 the message Length field by the formula: 1098 Message Length = 21 + Data Length 1100 The minimum length of the NOTIFICATION message is 21 octets (includ- 1101 ing message header). 1103 5. Path Attributes 1105 This section discusses the path attributes of the UPDATE message. 1107 Path attributes fall into four separate categories: 1109 1. Well-known mandatory. 1110 2. Well-known discretionary. 1111 3. Optional transitive. 1112 4. Optional non-transitive. 1114 BGP implementations MUST recognize all well-known attributes. Some 1115 of these attributes are mandatory and MUST be included in every 1116 UPDATE message that contains NLRI. Others are discretionary and MAY 1117 or MAY NOT be sent in a particular UPDATE message. 1119 Once a BGP peer has updated any well-known attributes, it MUST pass 1120 these attributes in any updates it transmits to its peers. 1122 In addition to well-known attributes, each path MAY contain one or 1123 more optional attributes. It is not required or expected that all BGP 1124 implementations support all optional attributes. The handling of an 1125 unrecognized optional attribute is determined by the setting of the 1126 Transitive bit in the attribute flags octet. Paths with unrecognized 1127 transitive optional attributes SHOULD be accepted. If a path with 1128 unrecognized transitive optional attribute is accepted and passed 1129 along to other BGP peers, then the unrecognized transitive optional 1130 attribute of that path MUST be passed along with the path to other 1131 RFC DRAFT November 2003 1133 BGP peers with the Partial bit in the Attribute Flags octet set to 1. 1134 If a path with recognized transitive optional attribute is accepted 1135 and passed along to other BGP peers and the Partial bit in the 1136 Attribute Flags octet is set to 1 by some previous AS, it MUST NOT be 1137 set back to 0 by the current AS. Unrecognized non-transitive optional 1138 attributes MUST be quietly ignored and not passed along to other BGP 1139 peers. 1141 New transitive optional attributes MAY be attached to the path by the 1142 originator or by any other BGP speaker in the path. If they are not 1143 attached by the originator, the Partial bit in the Attribute Flags 1144 octet is set to 1. The rules for attaching new non-transitive 1145 optional attributes will depend on the nature of the specific 1146 attribute. The documentation of each new non-transitive optional 1147 attribute will be expected to include such rules. (The description of 1148 the MULTI_EXIT_DISC attribute gives an example.) All optional 1149 attributes (both transitive and non-transitive) MAY be updated (if 1150 appropriate) by BGP speakers in the path. 1152 The sender of an UPDATE message SHOULD order path attributes within 1153 the UPDATE message in ascending order of attribute type. The receiver 1154 of an UPDATE message MUST be prepared to handle path attributes 1155 within the UPDATE message that are out of order. 1157 The same attribute (attribute with the same type) can not appear more 1158 than once within the Path Attributes field of a particular UPDATE 1159 message. 1161 The mandatory category refers to an attribute which MUST be present 1162 in both IBGP and EBGP exchanges if NLRI are contained in the UPDATE 1163 message. Attributes classified as optional for the purpose of the 1164 protocol extension mechanism may be purely discretionary, or discre- 1165 tionary, required, or disallowed in certain contexts. 1167 attribute EBGP IBGP 1168 ORIGIN mandatory mandatory 1169 AS_PATH mandatory mandatory 1170 NEXT_HOP mandatory mandatory 1171 MULTI_EXIT_DISC discretionary discretionary 1172 LOCAL_PREF see Section 5.1.5 required 1173 ATOMIC_AGGREGATE see Section 5.1.6 and 9.1.4 1174 AGGREGATOR discretionary discretionary 1175 RFC DRAFT November 2003 1177 5.1 Path Attribute Usage 1179 The usage of each BGP path attribute is described in the following 1180 clauses. 1182 5.1.1 ORIGIN 1184 ORIGIN is a well-known mandatory attribute. The ORIGIN attribute is 1185 generated by the speaker that originates the associated routing 1186 information. Its value SHOULD NOT be changed by any other speaker. 1188 5.1.2 AS_PATH 1190 AS_PATH is a well-known mandatory attribute. This attribute identi- 1191 fies the autonomous systems through which routing information carried 1192 in this UPDATE message has passed. The components of this list can be 1193 AS_SETs or AS_SEQUENCEs. 1195 When a BGP speaker propagates a route which it has learned from 1196 another BGP speaker's UPDATE message, it modifies the route's AS_PATH 1197 attribute based on the location of the BGP speaker to which the route 1198 will be sent: 1200 a) When a given BGP speaker advertises the route to an internal 1201 peer, the advertising speaker SHALL NOT modify the AS_PATH 1202 attribute associated with the route. 1204 b) When a given BGP speaker advertises the route to an external 1205 peer, then the advertising speaker updates the AS_PATH attribute 1206 as follows: 1208 1) if the first path segment of the AS_PATH is of type 1209 AS_SEQUENCE, the local system prepends its own AS number as the 1210 last element of the sequence (put it in the leftmost position 1211 with respect to the position of octets in the protocol mes- 1212 sage). If the act of prepending will cause an overflow in the 1213 AS_PATH segment, i.e. more than 255 ASs, it SHOULD prepend a 1214 new segment of type AS_SEQUENCE and prepend its own AS number 1215 to this new segment. 1217 2) if the first path segment of the AS_PATH is of type AS_SET, 1218 the local system prepends a new path segment of type 1219 RFC DRAFT November 2003 1221 AS_SEQUENCE to the AS_PATH, including its own AS number in that 1222 segment. 1224 When a BGP speaker originates a route then: 1226 a) the originating speaker includes its own AS number in a path 1227 segment of type AS_SEQUENCE in the AS_PATH attribute of all UPDATE 1228 messages sent to an external peer. (In this case, the AS number of 1229 the originating speaker's autonomous system will be the only entry 1230 the path segment, and this path segment will be the only segment 1231 in the AS_PATH attribute). 1233 b) the originating speaker includes an empty AS_PATH attribute in 1234 all UPDATE messages sent to internal peers. (An empty AS_PATH 1235 attribute is one whose length field contains the value zero). 1237 Whenever the modification of the AS_PATH attribute calls for includ- 1238 ing or prepending the AS number of the local system, the local system 1239 MAY include/prepend more than one instance of its own AS number in 1240 the AS_PATH attribute. This is controlled via local configuration. 1242 5.1.3 NEXT_HOP 1244 The NEXT_HOP is a well-known mandatory attribute that defines the IP 1245 address of the router that SHOULD be used as the next hop to the des- 1246 tinations listed in the UPDATE message. The NEXT_HOP attribute is 1247 calculated as follows. 1249 1) When sending a message to an internal peer, if the route is not 1250 locally originated the BGP speaker SHOULD NOT modify the NEXT_HOP 1251 attribute, unless it has been explicitly configured to announce 1252 its own IP address as the NEXT_HOP. When announcing a locally 1253 originated route to an internal peer, the BGP speaker SHOULD use 1254 as the NEXT_HOP the interface address of the router through which 1255 the announced network is reachable for the speaker; if the route 1256 is directly connected to the speaker, or the interface address of 1257 the router through which the announced network is reachable for 1258 the speaker is the internal peer's address, then the BGP speaker 1259 SHOULD use for the NEXT_HOP attribute its own IP address (the 1260 address of the interface that is used to reach the peer). 1262 2) When sending a message to an external peer X, and the peer is 1263 one IP hop away from the speaker: 1265 - If the route being announced was learned from an internal 1266 peer or is locally originated, the BGP speaker can use for the 1267 RFC DRAFT November 2003 1269 NEXT_HOP attribute an interface address of the internal peer 1270 router (or the internal router) through which the announced 1271 network is reachable for the speaker, provided that peer X 1272 shares a common subnet with this address. This is a form of 1273 "third party" NEXT_HOP attribute. 1275 - Otherwise, if the route being announced was learned from an 1276 external peer, the speaker can use in the NEXT_HOP attribute an 1277 IP address of any adjacent router (known from the received 1278 NEXT_HOP attribute) that the speaker itself uses for local 1279 route calculation, provided that peer X shares a common subnet 1280 with this address. This is a second form of "third party" 1281 NEXT_HOP attribute. 1283 - Otherwise, if the external peer to which the route is being 1284 advertised shares a common subnet with one of the interfaces of 1285 the announcing BGP speaker, the speaker MAY use the IP address 1286 associated with such an interface in the NEXT_HOP attribute. 1287 This is known as a "first party" NEXT_HOP attribute. 1289 - By default (if none of the above conditions apply), the BGP 1290 speaker SHOULD use in the NEXT_HOP attribute the IP address of 1291 the interface that the speaker uses to establish the BGP con- 1292 nection to peer X. 1294 3) When sending a message to an external peer X, and the peer is 1295 multiple IP hops away from the speaker (aka "multihop EBGP"): 1297 - The speaker MAY be configured to propagate the NEXT_HOP 1298 attribute. In this case when advertising a route that the 1299 speaker learned from one of its peers, the NEXT_HOP attribute 1300 of the advertised route is exactly the same as the NEXT_HOP 1301 attribute of the learned route (the speaker just doesn't modify 1302 the NEXT_HOP attribute). 1304 - By default, the BGP speaker SHOULD use in the NEXT_HOP 1305 attribute the IP address of the interface that the speaker uses 1306 to establish the BGP connection to peer X. 1308 Normally the NEXT_HOP attribute is chosen such that the shortest 1309 available path will be taken. A BGP speaker MUST be able to support 1310 disabling advertisement of third party NEXT_HOP attributes to handle 1311 imperfectly bridged media. 1313 A route originated by a BGP speaker SHALL NOT be advertised to a peer 1314 using an address of that peer as NEXT_HOP. A BGP speaker SHALL NOT 1315 install a route with itself as the next hop. 1317 RFC DRAFT November 2003 1319 The NEXT_HOP attribute is used by the BGP speaker to determine the 1320 actual outbound interface and immediate next-hop address that SHOULD 1321 be used to forward transit packets to the associated destinations. 1323 The immediate next-hop address is determined by performing a recur- 1324 sive route lookup operation for the IP address in the NEXT_HOP 1325 attribute using the contents of the Routing Table, selecting one 1326 entry if multiple entries of equal cost exist. The Routing Table 1327 entry which resolves the IP address in the NEXT_HOP attribute will 1328 always specify the outbound interface. If the entry specifies an 1329 attached subnet, but does not specify a next-hop address, then the 1330 address in the NEXT_HOP attribute SHOULD be used as the immediate 1331 next-hop address. If the entry also specifies the next-hop address, 1332 this address SHOULD be used as the immediate next-hop address for 1333 packet forwarding. 1335 5.1.4 MULTI_EXIT_DISC 1337 The MULTI_EXIT_DISC is an optional non-transitive attribute which is 1338 intended to be used on external (inter-AS) links to discriminate 1339 among multiple exit or entry points to the same neighboring AS. The 1340 value of the MULTI_EXIT_DISC attribute is a four octet unsigned num- 1341 ber which is called a metric. All other factors being equal, the exit 1342 point with lower metric SHOULD be preferred. If received over EBGP, 1343 the MULTI_EXIT_DISC attribute MAY be propagated over IBGP to other 1344 BGP speakers within the same AS (see also 9.1.2.2). The 1345 MULTI_EXIT_DISC attribute received from a neighboring AS MUST NOT be 1346 propagated to other neighboring ASs. 1348 A BGP speaker MUST implement a mechanism based on local configuration 1349 which allows the MULTI_EXIT_DISC attribute to be removed from a 1350 route. If a BGP speaker is configured to remove the MULTI_EXIT_DISC 1351 attribute from a route, then this removal MUST be done prior to 1352 determining the degree of preference of the route and performing 1353 route selection (Decision Process phases 1 and 2). 1355 An implementation MAY also (based on local configuration) alter the 1356 value of the MULTI_EXIT_DISC attribute received over EBGP. If a BGP 1357 speaker is configured to alter the value of the MULTI_EXIT_DISC 1358 attribute received over EBGP, then altering the value MUST be done 1359 prior to determining the degree of preference of the route and per- 1360 forming route selection (Decision Process phases 1 and 2). See Sec- 1361 tion 9.1.2.2 for necessary restrictions on this. 1363 RFC DRAFT November 2003 1365 5.1.5 LOCAL_PREF 1367 LOCAL_PREF is a well-known attribute that SHALL be included in all 1368 UPDATE messages that a given BGP speaker sends to the other internal 1369 peers. A BGP speaker SHALL calculate the degree of preference for 1370 each external route based on the locally configured policy, and 1371 include the degree of preference when advertising a route to its 1372 internal peers. The higher degree of preference MUST be preferred. A 1373 BGP speaker uses the degree of preference learned via LOCAL_PREF in 1374 its Decision Process (see Section 9.1.1). 1376 A BGP speaker MUST NOT include this attribute in UPDATE messages that 1377 it sends to external peers, except for the case of BGP Confederations 1378 [RFC3065]. If it is contained in an UPDATE message that is received 1379 from an external peer, then this attribute MUST be ignored by the 1380 receiving speaker, except for the case of BGP Confederations 1381 [RF3065]. 1383 5.1.6 ATOMIC_AGGREGATE 1385 ATOMIC_AGGREGATE is a well-known discretionary attribute. 1387 When a BGP speaker aggregates several routes for the purpose of 1388 advertisement to a particular peer, the AS_PATH of the aggregated 1389 route normally includes an AS_SET formed from the set of ASs from 1390 which the aggregate was formed. In many cases the network adminis- 1391 trator can determine that the aggregate can safely be advertised 1392 without the AS_SET and not form route loops. 1394 If an aggregate excludes at least some of the AS numbers present in 1395 the AS_PATH of the routes that are aggregated as a result of dropping 1396 the AS_SET, the aggregated route, when advertised to the peer, SHOULD 1397 include the ATOMIC_AGGREGATE attribute. 1399 A BGP speaker that receives a route with the ATOMIC_AGGREGATE 1400 attribute SHOULD NOT remove the attribute from the route when propa- 1401 gating it to other speakers. 1403 A BGP speaker that receives a route with the ATOMIC_AGGREGATE 1404 attribute MUST NOT make any NLRI of that route more specific (as 1405 defined in 9.1.4) when advertising this route to other BGP speakers. 1407 A BGP speaker that receives a route with the ATOMIC_AGGREGATE 1408 attribute needs to be aware of the fact that the actual path to des- 1409 tinations, as specified in the NLRI of the route, while having the 1410 RFC DRAFT November 2003 1412 loop-free property, may not be the path specified in the AS_PATH 1413 attribute of the route. 1415 5.1.7 AGGREGATOR 1417 AGGREGATOR is an optional transitive attribute which MAY be included 1418 in updates which are formed by aggregation (see Section 9.2.2.2). A 1419 BGP speaker which performs route aggregation MAY add the AGGREGATOR 1420 attribute which SHALL contain its own AS number and IP address. The 1421 IP address SHOULD be the same as the BGP Identifier of the speaker. 1423 6. BGP Error Handling. 1425 This section describes actions to be taken when errors are detected 1426 while processing BGP messages. 1428 When any of the conditions described here are detected, a NOTIFICA- 1429 TION message with the indicated Error Code, Error Subcode, and Data 1430 fields is sent, and the BGP connection is closed, unless it is 1431 explicitly stated that no NOTIFICATION message is to be sent and the 1432 BGP connection is not to be closed. If no Error Subcode is specified, 1433 then a zero MUST be used. 1435 The phrase "the BGP connection is closed" means that the TCP connec- 1436 tion has been closed, the associated Adj-RIB-In has been cleared, and 1437 that all resources for that BGP connection have been deallocated. 1438 Entries in the Loc-RIB associated with the remote peer are marked as 1439 invalid. The local system recalculates its best routes for the des- 1440 tinations of the routes marked as invalid, and before the invalid 1441 routes are deleted from the system advertises to its peers either 1442 withdraws for the routes marked as invalid, or the new best routes 1443 before the invalid routes are deleted from the system. 1445 Unless specified explicitly, the Data field of the NOTIFICATION mes- 1446 sage that is sent to indicate an error is empty. 1448 6.1 Message Header error handling. 1450 All errors detected while processing the Message Header MUST be indi- 1451 cated by sending the NOTIFICATION message with Error Code Message 1452 Header Error. The Error Subcode elaborates on the specific nature of 1453 the error. 1455 RFC DRAFT November 2003 1457 The expected value of the Marker field of the message header is all 1458 ones. If the Marker field of the message header is not as expected, 1459 then a synchronization error has occurred and the Error Subcode MUST 1460 be set to Connection Not Synchronized. 1462 If at least one of the following is true: 1464 - if the Length field of the message header is less than 19 or 1465 greater than 4096, or 1467 - if the Length field of an OPEN message is less than the minimum 1468 length of the OPEN message, or 1470 - if the Length field of an UPDATE message is less than the mini- 1471 mum length of the UPDATE message, or 1473 - if the Length field of a KEEPALIVE message is not equal to 19, 1474 or 1476 - if the Length field of a NOTIFICATION message is less than the 1477 minimum length of the NOTIFICATION message, 1479 then the Error Subcode MUST be set to Bad Message Length. The Data 1480 field MUST contain the erroneous Length field. 1482 If the Type field of the message header is not recognized, then the 1483 Error Subcode MUST be set to Bad Message Type. The Data field MUST 1484 contain the erroneous Type field. 1486 6.2 OPEN message error handling. 1488 All errors detected while processing the OPEN message MUST be indi- 1489 cated by sending the NOTIFICATION message with Error Code OPEN Mes- 1490 sage Error. The Error Subcode elaborates on the specific nature of 1491 the error. 1493 If the version number contained in the Version field of the received 1494 OPEN message is not supported, then the Error Subcode MUST be set to 1495 Unsupported Version Number. The Data field is a 2-octets unsigned 1496 integer, which indicates the largest locally supported version number 1497 less than the version the remote BGP peer bid (as indicated in the 1498 received OPEN message), or if the smallest locally supported version 1499 number is greater than the version the remote BGP peer bid, then the 1500 smallest locally supported version number. 1502 If the Autonomous System field of the OPEN message is unacceptable, 1503 RFC DRAFT November 2003 1505 then the Error Subcode MUST be set to Bad Peer AS. The determination 1506 of acceptable Autonomous System numbers is outside the scope of this 1507 protocol. 1509 If the Hold Time field of the OPEN message is unacceptable, then the 1510 Error Subcode MUST be set to Unacceptable Hold Time. An implementa- 1511 tion MUST reject Hold Time values of one or two seconds. An imple- 1512 mentation MAY reject any proposed Hold Time. An implementation which 1513 accepts a Hold Time MUST use the negotiated value for the Hold Time. 1515 If the BGP Identifier field of the OPEN message is syntactically 1516 incorrect, then the Error Subcode MUST be set to Bad BGP Identifier. 1517 Syntactic correctness means that the BGP Identifier field represents 1518 a valid unicast IP host address. 1520 If one of the Optional Parameters in the OPEN message is not recog- 1521 nized, then the Error Subcode MUST be set to Unsupported Optional 1522 Parameters. 1524 If one of the Optional Parameters in the OPEN message is recognized, 1525 but is malformed, then the Error Subcode MUST be set to 0 (Unspe- 1526 cific). 1528 6.3 UPDATE message error handling. 1530 All errors detected while processing the UPDATE message MUST be indi- 1531 cated by sending the NOTIFICATION message with Error Code UPDATE Mes- 1532 sage Error. The error subcode elaborates on the specific nature of 1533 the error. 1535 Error checking of an UPDATE message begins by examining the path 1536 attributes. If the Withdrawn Routes Length or Total Attribute Length 1537 is too large (i.e., if Withdrawn Routes Length + Total Attribute 1538 Length + 23 exceeds the message Length), then the Error Subcode MUST 1539 be set to Malformed Attribute List. 1541 If any recognized attribute has Attribute Flags that conflict with 1542 the Attribute Type Code, then the Error Subcode MUST be set to 1543 Attribute Flags Error. The Data field MUST contain the erroneous 1544 attribute (type, length and value). 1546 If any recognized attribute has Attribute Length that conflicts with 1547 the expected length (based on the attribute type code), then the 1548 Error Subcode MUST be set to Attribute Length Error. The Data field 1549 MUST contain the erroneous attribute (type, length and value). 1551 RFC DRAFT November 2003 1553 If any of the mandatory well-known attributes are not present, then 1554 the Error Subcode MUST be set to Missing Well-known Attribute. The 1555 Data field MUST contain the Attribute Type Code of the missing well- 1556 known attribute. 1558 If any of the mandatory well-known attributes are not recognized, 1559 then the Error Subcode MUST be set to Unrecognized Well-known 1560 Attribute. The Data field MUST contain the unrecognized attribute 1561 (type, length and value). 1563 If the ORIGIN attribute has an undefined value, then the Error Sub- 1564 code MUST be set to Invalid Origin Attribute. The Data field MUST 1565 contain the unrecognized attribute (type, length and value). 1567 If the NEXT_HOP attribute field is syntactically incorrect, then the 1568 Error Subcode MUST be set to Invalid NEXT_HOP Attribute. The Data 1569 field MUST contain the incorrect attribute (type, length and value). 1570 Syntactic correctness means that the NEXT_HOP attribute represents a 1571 valid IP host address. 1573 The IP address in the NEXT_HOP MUST meet the following criteria to be 1574 considered semantically correct: 1576 a) It MUST NOT be the IP address of the receiving speaker 1578 b) In the case of an EBGP where the sender and receiver are one IP 1579 hop away from each other, either the IP address in the NEXT_HOP 1580 MUST be the sender's IP address (that is used to establish the BGP 1581 connection), or the interface associated with the NEXT_HOP IP 1582 address MUST share a common subnet with the receiving BGP speaker. 1584 If the NEXT_HOP attribute is semantically incorrect, the error SHOULD 1585 be logged, and the route SHOULD be ignored. In this case, a NOTIFICA- 1586 TION message SHOULD NOT be sent, and connection SHOULD NOT be closed. 1588 The AS_PATH attribute is checked for syntactic correctness. If the 1589 path is syntactically incorrect, then the Error Subcode MUST be set 1590 to Malformed AS_PATH. 1592 If the UPDATE message is received from an external peer, the local 1593 system MAY check whether the leftmost (with respect to the position 1594 of octets in the protocol message) AS in the AS_PATH attribute is 1595 equal to the autonomous system number of the peer that sent the mes- 1596 sage. If the check determines that this is not the case, the Error 1597 Subcode MUST be set to Malformed AS_PATH. 1599 If an optional attribute is recognized, then the value of this 1600 attribute MUST be checked. If an error is detected, the attribute 1601 RFC DRAFT November 2003 1603 MUST be discarded, and the Error Subcode MUST be set to Optional 1604 Attribute Error. The Data field MUST contain the attribute (type, 1605 length and value). 1607 If any attribute appears more than once in the UPDATE message, then 1608 the Error Subcode MUST be set to Malformed Attribute List. 1610 The NLRI field in the UPDATE message is checked for syntactic valid- 1611 ity. If the field is syntactically incorrect, then the Error Subcode 1612 MUST be set to Invalid Network Field. 1614 If a prefix in the NLRI field is semantically incorrect (e.g., an 1615 unexpected multicast IP address), an error SHOULD be logged locally, 1616 and the prefix SHOULD be ignored. 1618 An UPDATE message that contains correct path attributes, but no NLRI, 1619 SHALL be treated as a valid UPDATE message. 1621 6.4 NOTIFICATION message error handling. 1623 If a peer sends a NOTIFICATION message, and the receiver of the mes- 1624 sage detects an error in that message, the receiver can not use a 1625 NOTIFICATION message to report this error back to the peer. Any such 1626 error, such as an unrecognized Error Code or Error Subcode, SHOULD be 1627 noticed, logged locally, and brought to the attention of the adminis- 1628 tration of the peer. The means to do this, however, lies outside the 1629 scope of this document. 1631 6.5 Hold Timer Expired error handling. 1633 If a system does not receive successive KEEPALIVE and/or UPDATE 1634 and/or NOTIFICATION messages within the period specified in the Hold 1635 Time field of the OPEN message, then the NOTIFICATION message with 1636 Hold Timer Expired Error Code is sent and the BGP connection is 1637 closed. 1639 6.6 Finite State Machine error handling. 1641 Any error detected by the BGP Finite State Machine (e.g., receipt of 1642 an unexpected event) is indicated by sending the NOTIFICATION message 1643 with Error Code Finite State Machine Error. 1645 RFC DRAFT November 2003 1647 6.7 Cease. 1649 In absence of any fatal errors (that are indicated in this section), 1650 a BGP peer MAY choose at any given time to close its BGP connection 1651 by sending the NOTIFICATION message with Error Code Cease. However, 1652 the Cease NOTIFICATION message MUST NOT be used when a fatal error 1653 indicated by this section does exist. 1655 A BGP speaker MAY support the ability to impose an (locally config- 1656 ured) upper bound on the number of address prefixes the speaker is 1657 willing to accept from a neighbor. When the upper bound is reached, 1658 the speaker (under control of local configuration) either (a) dis- 1659 cards new address prefixes from the neighbor (while maintaining BGP 1660 connection with the neighbor), or (b) terminates the BGP connection 1661 with the neighbor. If the BGP speaker decides to terminate its BGP 1662 connection with a neighbor because the number of address prefixes 1663 received from the neighbor exceeds the locally configured upper 1664 bound, then the speaker MUST send to the neighbor a NOTIFICATION mes- 1665 sage with the Error Code Cease. The speaker MAY also log this 1666 locally. 1668 6.8 BGP connection collision detection. 1670 If a pair of BGP speakers try simultaneously to establish a BGP con- 1671 nection to each other, then two parallel connections between this 1672 pair of speakers might well be formed. If the source IP address used 1673 by one of these connections is the same as the destination IP address 1674 used by the other, and the destination IP address used by the first 1675 connection is the same as the source IP address used by the other, we 1676 refer to this situation as connection collision. Clearly in the 1677 presence of connection collision, one of these connections MUST be 1678 closed. 1680 Based on the value of the BGP Identifier a convention is established 1681 for detecting which BGP connection is to be preserved when a colli- 1682 sion does occur. The convention is to compare the BGP Identifiers of 1683 the peers involved in the collision and to retain only the connection 1684 initiated by the BGP speaker with the higher-valued BGP Identifier. 1686 Upon receipt of an OPEN message, the local system MUST examine all of 1687 its connections that are in the OpenConfirm state. A BGP speaker MAY 1688 also examine connections in an OpenSent state if it knows the BGP 1689 Identifier of the peer by means outside of the protocol. If among 1690 these connections there is a connection to a remote BGP speaker whose 1691 BGP Identifier equals the one in the OPEN message, and this 1692 RFC DRAFT November 2003 1694 connection collides with the connection over which the OPEN message 1695 is received then the local system performs the following collision 1696 resolution procedure: 1698 1. The BGP Identifier of the local system is compared to the BGP 1699 Identifier of the remote system (as specified in the OPEN mes- 1700 sage). Comparing BGP Identifiers is done by converting them to 1701 host byte order and treating them as (4-octet long) unsigned inte- 1702 gers. 1704 2. If the value of the local BGP Identifier is less than the 1705 remote one, the local system closes the BGP connection that 1706 already exists (the one that is already in the OpenConfirm state), 1707 and accepts the BGP connection initiated by the remote system. 1709 3. Otherwise, the local system closes newly created BGP connection 1710 (the one associated with the newly received OPEN message), and 1711 continues to use the existing one (the one that is already in the 1712 OpenConfirm state). 1714 Unless allowed via configuration, a connection collision with an 1715 existing BGP connection that is in Established state causes closing 1716 of the newly created connection. 1718 Note that a connection collision can not be detected with connections 1719 that are in Idle, or Connect, or Active states. 1721 Closing the BGP connection (that results from the collision resolu- 1722 tion procedure) is accomplished by sending the NOTIFICATION message 1723 with the Error Code Cease. 1725 7. BGP Version Negotiation 1727 BGP speakers MAY negotiate the version of the protocol by making mul- 1728 tiple attempts to open a BGP connection, starting with the highest 1729 version number each supports. If an open attempt fails with an Error 1730 Code OPEN Message Error, and an Error Subcode Unsupported Version 1731 Number, then the BGP speaker has available the version number it 1732 tried, the version number its peer tried, the version number passed 1733 by its peer in the NOTIFICATION message, and the version numbers that 1734 it supports. If the two peers do support one or more common versions, 1735 then this will allow them to rapidly determine the highest common 1736 version. In order to support BGP version negotiation, future versions 1737 of BGP MUST retain the format of the OPEN and NOTIFICATION messages. 1739 RFC DRAFT November 2003 1741 8. BGP Finite State machine (FSM) 1743 The data structures and FSM described in this document are 1744 conceptual and do not have to be implemented precisely as described 1745 here, as long as the implementations support the described 1746 functionality and their externally visible behavior is the same. 1748 This section specifies the BGP operation in terms of a Finite State 1749 Machine (FSM). The section falls into 2 parts: 1751 1) Description of Events for the State machine (Section 8.1) 1752 2) Description of the FSM (Section 8.2) 1754 Session attributes required (mandatory) for each connection are: 1756 1) State 1757 2) ConnectRetryCounter 1758 3) ConnectRetryTimer 1759 4) ConnectRetryTime 1760 5) HoldTimer 1761 6) HoldTime 1762 7) KeepaliveTimer 1763 8) KeepaliveTime 1765 The state session attribute indicates what state the BGP FSM 1766 is in. The ConnectRetryCounter indicates the number of times 1767 a BGP peer has tried to establish a peer session. 1769 The mandatory attributes related to timers are described in 1770 section 10. Each timer has a "timer" and a "time" (the initial 1771 value). 1773 The optional Session attributes are listed below. These optional 1774 attributes may be supported either per connection or per local sys- 1775 tem: 1777 1) AcceptConnectionsUnconfiguredPeers 1778 2) AllowAutomaticStart 1779 3) AllowAutomaticStop 1780 4) CollisionDetectEstablishedState 1781 5) DampPeerOscillations 1782 6) DelayOpen 1783 7) DelayOpenTime 1784 8) DelayOpenTimer 1785 9) IdleHoldTime 1786 10) IdleHoldTimer 1787 11) PassiveTcpEstablishment 1788 RFC DRAFT November 2003 1790 12) SendNOTIFICATIONwithoutOPEN 1791 13) TrackTcpState 1793 The optional session attributes support different features of the BGP 1794 functionality that have implications for the BGP FSM state 1795 transitions. Two groups of the attributes which relate to timers are: 1796 group 1: DelayOpen, DelayOpenTime, DelayOpenTimer 1797 group 2: DampPeerOscillations, IdleHoldTime, IdleHoldTimer 1799 The first parameter (DelayOpen, DampPeerOscillations) is an 1800 optional attribute that indicates that the Timer function is 1801 active. The "Time" value specifies the initial value for "Timer" 1802 (DelayOpenTime, IdleHoldTime). The "Timer" specifies the actual timer. 1804 Please refer to section 8.1.1 for an explanation 1805 of the interaction between these optional attributes and the events 1806 signaled to the state machine. Section 8.2.1.3 also provides 1807 a short overview of the different types of optional attributes 1808 (flags or timers). 1810 8.1 Events for the BGP FSM 1812 8.1.1 Optional Events linked to Optional Session attributes 1814 The Inputs to the BGP FSM are events. Events can either be 1815 mandatory or optional. Some optional events are linked to 1816 optional session attributes. Optional session attributes enable 1817 several groups of FSM functionality. 1819 The description below describes the linkage between FSM 1820 functionality, events and the optional session attributes. 1822 Group 1: Automatic Administrative Events (Start/Stop) 1824 Optional Session Attributes: AllowAutomaticStart, AllowAutomaticStop, 1825 DampPeerOscillations, IdleHoldTime, 1826 IdleHoldTimer 1828 Option 1: AllowAutomaticStart 1829 RFC DRAFT November 2003 1831 Description: A BGP peer connection can be started and stopped 1832 by administrative control. This administrative 1833 control can either be manual, based on 1834 operator intervention, or under the control 1835 of logic specific to a BGP implementation. 1836 The term "automatic" refers to a start being 1837 issued to the BGP peer connection FSM when 1838 such logic determines that the BGP peer 1839 connection should be restarted. 1841 The AllowAutomaticStart attribute specifies 1842 that this BGP connection supports automatic 1843 starting of the BGP connection. 1845 If the BGP implementation supports 1846 AllowAutomaticStart, the peer may be 1847 repeatedly restarted. Three other options 1848 control the rate at which the automatic 1849 restart occurs: DampPeerOscillations, 1850 IdleHoldTime, and the IdleHoldTimer. 1852 The DampPeerOscillations option specifies 1853 that the implementation engages additional 1854 logic to damp the oscillations of BGP peers 1855 in the face of sequences of automatic start 1856 and automatic stop. IdleHoldTime specifies 1857 how long the BGP peer is held in the Idle 1858 state prior to allowing the next automatic 1859 restart. The IdleHoldTimer is the timer 1860 that runs to hold the peer in Idle state. 1862 An example of DampPeerOscillations logic 1863 is an increase of the IdleHoldTime value 1864 if a BGP peer oscillates connectivity 1865 (connected/disconnected) repeatedly 1866 within a time period. To engage this 1867 logic, a peer could connect and disconnect 1868 10 times within 5 minutes. The IdleHoldTime 1869 value would be reset from 0 to 120 seconds. 1871 Values: TRUE or FALSE 1873 Option 2: AllowAutomaticStop 1875 Description: This BGP peer session optional attribute 1876 indicates that the BGP connection allows 1877 RFC DRAFT November 2003 1879 "automatic" stopping of the BGP connection. 1880 An "automatic" stop is defined as a stop under 1881 the control of implementation specific logic. 1882 The implementation specific logic is outside 1883 the scope of this specification. 1885 Values: TRUE or FALSE 1887 Option 3: DampPeerOscillations 1889 Description: The DampPeerOscillations optional session 1890 attribute indicates that this BGP connection 1891 is using logic that damps BGP peer oscillations 1892 in the Idle State. 1894 Value: TRUE or FALSE 1896 Option 4: IdleHoldTime 1898 Description: The IdleHoldTime is the value 1899 that is set in the IdleHoldTimer. 1901 Values: Time in seconds 1903 Option 5: IdleHoldTimer 1905 Description: The IdleHoldTimer aids in controlling BGP peer 1906 oscillation. The IdleHoldTimer is used to keep 1907 the BGP peer in Idle for a particular duration. 1908 The IdleHoldTimer_Expires event is described 1909 in section 8.1.3. 1911 Values: Time in seconds 1913 Group 2: Unconfigured Peers 1915 Optional Session Attributes: AcceptConnectionsUnconfiguredPeers 1917 Option 1: AcceptConnectionsUnconfiguredPeers 1919 Description: The BGP FSM optionally allows the acceptance of BGP 1920 peer connections from neighbors that are not 1921 pre-configured. The 1922 "AcceptConnectionsUnconfiguredPeers" optional 1923 RFC DRAFT November 2003 1925 session attribute allows the FSM to support 1926 the state transitions that allow the 1927 implementation to accept or reject these 1928 unconfigured peers. 1930 The AcceptConnectionsUnconfiguredPeers has 1931 security implications. Please refer to the 1932 BGP Vulnerabilities document[BGP_VULN] for 1933 details. 1935 Value: True or False 1937 Group 3: TCP processing 1939 Optional Session Attributes: PassiveTcpEstablishment, TrackTcpState 1941 Option 1: PassiveTcpEstablishment 1943 Description: This option indicates that the BGP FSM will passively 1944 wait for the remote BGP peer to establish the BGP 1945 TCP connection. 1947 value: TRUE or FALSE 1949 Option 2: TrackTcpState 1951 Description: The BGP FSM normally tracks the end result of a TCP 1952 connection attempt rather than individual TCP messages. 1953 Optionally, the BGP FSM can support additional 1954 interaction with the TCP connection negotiation. The 1955 interaction with the TCP events may increase the 1956 amount of logging the BGP peer connection 1957 requires and the number of BGP FSM changes. 1959 Value: TRUE or FALSE 1961 Group 4: BGP Message Processing 1963 Optional Session Attributes: DelayOpen, DelayOpenTime, 1964 DelayOpenTimer, 1965 SendNOTIFICATIONwithoutOPEN, 1966 CollisionDetectEstablishedState 1968 Option 1: DelayOpen 1970 Description: The DelayOpen optional session attribute allows 1971 RFC DRAFT November 2003 1973 implementations to be configured to delay 1974 sending an OPEN message for a specific time 1975 period (DelayOpenTime). The delay allows 1976 the remote BGP Peer time to send the first 1977 OPEN message. 1979 Value: TRUE or FALSE 1981 Option 2: DelayOpenTime 1983 Description: The DelayOpenTime is the initial value that is 1984 set in the DelayOpenTimer. 1986 Value: Time in seconds 1988 Option 3: DelayOpenTimer 1990 Description: The DelayOpenTimer optional session attribute 1991 is used to delay the sending of an OPEN message 1992 on a connection. The DelayOpenTimer_Expires event 1993 (Event 12) is described in section 8.1.3. 1995 Value: Time in seconds 1997 Option 4: SendNOTIFICATIONwithoutOPEN 1999 Description: The SendNOTIFICATIONwithoutOPEN allows a peer to 2000 send a NOTIFICATION without first sending an 2001 OPEN message. Without this optional session 2002 attribute, the BGP connection assumes that an 2003 OPEN message must be sent by a peer prior 2004 to the peer sending a NOTIFICATION message. 2006 Value: True or False 2008 Option 5: CollisionDetectEstablishedState 2010 Description: Normally, a Detect Collision (6.8) will 2011 be ignored in the Established state. This 2012 optional session attribute indicates that 2013 this BGP connection processes 2014 collisions in the Established state. 2016 Value: True or False 2017 RFC DRAFT November 2003 2019 Note: The optional session attributes clarify the BGP FSM description 2020 for existing features of BGP implementations. The optional 2021 session attributes may be pre-defined for an implementation 2022 and not readable via management interfaces for existing 2023 correct implementations. As newer BGP MIBs (version 2 2024 and beyond) are supported, these fields will be accessible 2025 via a management interface. 2027 8.1.2 Administrative Events 2029 An administrative event is an event in which the operator interface 2030 and BGP Policy engine signal the BGP finite state machine to start or 2031 stop the BGP state machine. The basic start and stop indication are 2032 augmented by optional connection attributes to signal a certain type 2033 of start or stop mechanism to the BGP FSM. An example of this combi- 2034 nation is event 5, AutomaticStart_with_PassiveTcpEstablishment. With 2035 this event, the BGP implementation signals to the BGP FSM that the 2036 implementation is using an Automatic Start with option to use a Pas- 2037 sive TCP Establishment. The Passive TCP establishment signals that 2038 this BGP FSM will wait for the remote side to start the TCP estab- 2039 lishment. 2041 Please note that only Event 1 (ManualStart) and Event 2 (ManualStop) 2042 are mandatory administrative events. All other administrative events 2043 are optional (Events 3-8). Each event below has a name, definition, 2044 status (mandatory or optional), and what optional session attributes 2045 SHOULD be set at each stage. When generating Event 1 through Event 8 2046 for the BGP FSM, the conditions specified in the "Optional Attribute 2047 Status" section are verified. If any of these conditions are not 2048 satisfied, then the local system should log a FSM error. 2050 The settings of optional session attributes may be implicit in some 2051 implementations and therefore may not be set explicitly by an exter- 2052 nal operator action. Section 8.2.1.5 describes these implicit set- 2053 tings of the optional session attributes. The administrative states 2054 described below may also be implicit in some implementations and not 2055 directly configurable by an external operator. 2057 Event1: ManualStart 2059 Definition: Local system administrator manually starts peer 2060 connection. 2062 Status: Mandatory 2063 RFC DRAFT November 2003 2065 Optional 2066 Attribute 2067 Status: The PassiveTcpEstablishment attribute SHOULD be 2068 set to FALSE. 2070 Event2: ManualStop 2072 Definition: Local system administrator manually 2073 stops the peer connection. 2075 Status: Mandatory 2077 Optional 2078 Attribute 2079 Status: No interaction with any optional attributes. 2081 Event3: AutomaticStart 2083 Definition: Local system automatically starts the 2084 BGP connection. 2086 Status: Optional, depending on local system 2088 Optional 2089 Attribute 2090 Status: 1) The AllowAutomaticStart attribute SHOULD be set 2091 to TRUE if this event occurs. 2092 2) If the PassiveTcpEstablishment optional session 2093 attribute is supported, it SHOULD be set to FALSE. 2094 3) If the DampPeerOscillations is supported, it 2095 SHOULD be set to FALSE when this event occurs. 2097 Event4: ManualStart_with_PassiveTcpEstablishment 2099 Definition: Local system administrator manually starts peer 2100 connection, but has PassiveTcpEstablishment 2101 enabled. The PassiveTcpEstablishment optional 2102 attribute indicates that the peer will listen prior 2103 to establishing the connection. 2105 Status: Optional, depending on local system 2107 Optional 2108 Attribute 2109 Status: 1) The PassiveTcpEstablishment attribute SHOULD 2110 be set to TRUE if this event occurs. 2112 RFC DRAFT November 2003 2114 2) The DampPeerOscillations attribute SHOULD be 2115 set to FALSE when this event occurs. 2117 Event5: AutomaticStart_with_PassiveTcpEstablishment 2119 Definition: Local system automatically starts the 2120 BGP connection with the PassiveTcpEstablishment 2121 enabled. The PassiveTcpEstablishment 2122 optional attribute indicates 2123 that the peer will listen prior to 2124 establishing a connection. 2126 Status: Optional, depending on local system 2128 Optional 2129 Attribute 2130 Status: 1) The AllowAutomaticStart attribute SHOULD 2131 be set to TRUE. 2132 2) The PassiveTcpEstablishment attribute SHOULD 2133 be set to TRUE 2134 3) If the DampPeerOscillations attribute is 2135 supported, the DampPeerOscillations SHOULD 2136 be set to FALSE. 2138 Event6: AutomaticStart_with_DampPeerOscillations 2140 Definition: Local system automatically starts the 2141 BGP peer connection with peer oscillation 2142 damping enabled. The exact method of damping 2143 persistent peer oscillations is left up to the 2144 implementation and is outside the scope of 2145 this document. 2147 Status: Optional, depending on local system. 2149 Optional 2150 Attribute 2151 Status: 1) The AllowAutomaticStart attribute SHOULD 2152 be set to TRUE. 2153 2) The DampPeerOscillations attribute SHOULD 2154 be set to TRUE. 2155 3) The PassiveTcpEstablishment attribute 2156 SHOULD be set to FALSE. 2158 RFC DRAFT November 2003 2160 Event 7: AutomaticStart_with_DampPeerOscillations_and_ 2161 PassiveTcpEstablishment 2163 Definition: Local system automatically starts the 2164 BGP peer connection with peer oscillation 2165 damping enabled and PassiveTcpEstablishment 2166 enabled. The exact method of damping 2167 persistent peer oscillations is left up to the 2168 implementation and is outside the scope of 2169 this document. 2171 Status: Optional, depending on local system 2173 Optional 2174 Attributes 2175 Status: 1) The AllowAutomaticStart attribute 2176 SHOULD be set to TRUE. 2177 2) The DampPeerOscillations attribute SHOULD 2178 be set to TRUE. 2179 3) The PassiveTcpEstablishment attribute 2180 SHOULD be set to TRUE. 2182 Event8: AutomaticStop 2184 Definition: Local system automatically stops the 2185 BGP connection. 2187 An example of an automatic stop event is 2188 exceeding the number of prefixes for a given 2189 peer and the local system automatically 2190 disconnecting the peer. 2192 Status: Optional, depending on local system 2194 Optional 2195 Attribute 2196 Status: 1) The AllowAutomaticStop attribute 2197 SHOULD be TRUE 2199 8.1.3 Timer Events 2201 Event9: ConnectRetryTimer_Expires 2202 RFC DRAFT November 2003 2204 Definition: An event generated when the ConnectRetryTimer 2205 expires. 2207 Status: Mandatory 2209 Event10: HoldTimer_Expires 2211 Definition: An event generated when the HoldTimer expires. 2213 Status: Mandatory 2215 Event11: KeepaliveTimer_Expires 2217 Definition: An event generated when the KeepaliveTimer expires. 2218 Status: Mandatory 2220 Event12: DelayOpenTimer_Expires 2222 Definition: An event generated when the DelayOpenTimer expires. 2224 Status: Optional 2226 Optional 2227 Attribute 2228 Status: If this event occurs, 2229 1) DelayOpen attribute SHOULD be set to TRUE, 2230 2) DelayOpenTime attribute SHOULD be supported, 2231 3) DelayOpenTimer SHOULD be supported, 2233 Event13: IdleHoldTimer_Expires 2235 Definition: An event generated when the IdleHoldTimer 2236 expires indicating that the BGP connection has 2237 completed waiting for the back-off period 2238 to prevent BGP peer oscillation. 2240 The IdleHoldTimer is only used when the 2241 persistent peer oscillation damping 2242 function is enabled by setting the 2243 DampPeerOscillations optional attribute 2244 to TRUE. 2246 Implementations not implementing the 2247 persistent peer oscillation damping 2248 function may not have the IdleHoldTimer. 2250 RFC DRAFT November 2003 2252 Status: Optional 2254 Optional 2255 Attribute 2256 Status: If this event occurs: 2257 1) DampPeerOscillations attribute SHOULD be set 2258 to TRUE. 2259 2) IdleHoldTimer SHOULD have just expired. 2261 8.1.4 TCP Connection based Events 2263 Event14: TcpConnection_Valid 2265 Definition: Event indicating the local system reception of 2266 a TCP connection request with a valid 2267 source IP address and TCP port and a valid 2268 destination IP address and TCP Port. The 2269 definition of invalid source and invalid 2270 destination IP address is left to the 2271 implementation. 2273 BGP's destination port SHOULD be port 179 2274 as defined by IANA. 2276 TCP connection request is denoted by the 2277 local system receiving a TCP SYN. 2279 Status: Optional 2281 Optional 2282 Attribute 2283 Status: 1) The TrackTcpState attribute SHOULD be set to 2284 TRUE if this event occurs. 2286 Event15: Tcp_CR_Invalid 2288 Definition: Event indicating the local system reception 2289 of a TCP connection request with either 2290 an invalid source address or port 2291 number or an invalid destination 2292 address or port number. 2294 BGP destination port number SHOULD be 179 2295 as defined by IANA. 2297 RFC DRAFT November 2003 2299 A TCP connection request occurs when 2300 the local system receives a TCP 2301 SYN. 2303 Status: Optional 2305 Optional 2306 Attribute 2307 Status: 1) The TrackTcpState attribute should be set to 2308 TRUE if this event occurs. 2310 Event16: Tcp_CR_Acked 2312 Definition: Event indicating the local system's request 2313 to establish a TCP connection to the remote 2314 peer. 2316 The local system's TCP connection sent a TCP 2317 SYN, and received a TCP SYN/ACK message, 2318 and sent a TCP ACK. 2320 Status: Mandatory 2322 Event17: TcpConnectionConfirmed 2324 Definition: Event indicating that the local system has 2325 received a confirmation that the TCP 2326 connection has been established by the 2327 remote site. 2329 The remote peer's TCP engine sent a TCP SYN. 2330 The local peer's TCP engine sent a SYN, ACK 2331 message and now has received a final ACK. 2333 Status: Mandatory 2335 Event18: TcpConnectionFails 2337 Definition: Event indicating that the local system has 2338 received a TCP connection failure notice. 2340 The remote BGP peer's TCP machine could have 2341 sent a FIN. The local peer would respond 2342 with a FIN-ACK. Another alternative is that 2343 the local peer indicated a timeout in the 2344 TCP connection and downed the connection. 2346 RFC DRAFT November 2003 2348 Status: Mandatory 2350 8.1.5 BGP Message-based Events 2352 Event19: BGPOpen 2354 Definition: An event is generated when a valid OPEN 2355 message has been received. 2357 Status: Mandatory 2359 Optional 2360 Attribute 2361 Status: 1) The DelayOpen optional attribute SHOULD 2362 be set to FALSE. 2363 2) The DelayOpenTimer SHOULD not be running. 2365 Event20: BGPOpen with DelayOpenTimer running 2367 Definition: An event is generated when a valid OPEN 2368 message has been received for a peer 2369 that has a successfully established 2370 transport connection and is currently 2371 delaying the sending of a BGP open 2372 message. 2374 Status: Optional 2376 Optional 2377 Attribute 2378 Status: 1) The DelayOpen attribute SHOULD be 2379 set to TRUE. 2380 2) The DelayOpenTimer SHOULD be running. 2382 Event21: BGPHeaderErr 2384 Definition: An event is generated when a received 2385 BGP message header is not valid. 2387 Status: Mandatory 2389 Event22: BGPOpenMsgErr 2390 RFC DRAFT November 2003 2392 Definition: An event is generated when an OPEN message 2393 has been received with errors. 2395 Status: Mandatory 2397 Event23: OpenCollisionDump 2399 Definition: An event generated administratively 2400 when a connection collision has been 2401 detected while processing an incoming 2402 OPEN message and this connection has been 2403 selected to be disconnected. See section 2404 6.8 for more information on collision 2405 detection. 2407 Event23 is an administrative action 2408 generated by implementation logic 2409 that determines that this connection 2410 needs to be dropped per the rules in 2411 section 6.8. This event may occur if the FSM 2412 is implemented as two linked state machines. 2414 Status: Optional 2416 Optional 2417 Attribute 2418 Status: If the state machine is to process this 2419 event in Established state, 2420 1) CollisionDetectEstablishedState 2421 optional attribute SHOULD be set to TRUE 2423 Please note: The OpenCollisionDump event can occur 2424 in Idle, Connect, Active, OpenSent, OpenConfirm 2425 without any optional attributes being set. 2427 Event24: NotifMsgVerErr 2429 Definition: An event is generated when a 2430 NOTIFICATION message with "version 2431 error" is received. 2433 Status: Mandatory 2435 Event25: NotifMsg 2436 RFC DRAFT November 2003 2438 Definition: An event is generated when a 2439 NOTIFICATION message is received and 2440 the error code is anything but 2441 "version error". 2443 Status: Mandatory 2445 Event26: KeepAliveMsg 2447 Definition: An event is generated when a KEEPALIVE 2448 message is received. 2450 Status: Mandatory 2452 Event27: UpdateMsg 2454 Definition: An event is generated when a valid 2455 UPDATE message is received. 2457 Status: Mandatory 2459 Event28: UpdateMsgErr 2461 Definition: An event is generated when an invalid 2462 UPDATE message is received. 2464 Status: Mandatory 2466 8.2 Description of FSM 2468 8.2.1 FSM Definition 2470 BGP MUST maintain a separate FSM for each configured peer. Each BGP 2471 peer paired in a potential connection, unless configured to remain in 2472 the idle state, or configured to remain passive, will attempt to con- 2473 nect to the other. For the purpose of this discussion, the active or 2474 connecting side of the TCP connection (the side of a TCP connection 2475 sending the first TCP SYN packet) is called outgoing. The passive or 2476 listening side (the sender of the first SYN/ACK) is called an incom- 2477 ing connection. (See Section 8.2.1.1 for information on the terms 2478 active and passive used below.) 2480 A BGP implementation MUST connect to and listen on TCP port 179 for 2481 RFC DRAFT November 2003 2483 incoming connections in addition to trying to connect to peers. For 2484 each incoming connection, a state machine MUST be instantiated. 2485 There exists a period in which the identity of the peer on the other 2486 end of an incoming connection is known, but the BGP identifier is not 2487 known. During this time, both an incoming and an outgoing connection 2488 for the same configured peering may exist. This is referred to as a 2489 connection collision. (See Section 6.8.) 2491 A BGP implementation will have at most one FSM for each configured 2492 peering plus one FSM for each incoming TCP connection for which the 2493 peer has not yet been identified. Each FSM corresponds to exactly one 2494 TCP connection. 2496 There may be more than one connection between a pair of peers if the 2497 connections are configured to use a different pair of IP addresses. 2498 This is referred to as multiple "configured peerings" to the same 2499 peer. 2501 8.2.1.1 Terms "active" and "passive" 2503 The terms active and passive have been in the Internet operator's 2504 vocabulary for almost a decade and have proven useful. The words 2505 active and passive have slightly different meanings applied to a TCP 2506 connection or applied to a peer. There is only one active side and 2507 one passive side to any one TCP connection per the definition above 2508 and the state machine below. When a BGP speaker is configured active, 2509 it may end up on either the active or passive side of the connection 2510 that eventually gets established. Once the TCP connection is com- 2511 pleted, it doesn't matter which end was active and which end was pas- 2512 sive. The only difference is which side of the TCP connection has 2513 port number 179. 2515 8.2.1.2 FSM and collision detection 2517 There is one FSM per BGP connection. When the connection collision 2518 occurs prior to determining what peer a connection is associated 2519 with, there may be two connections for one peer. After the connec- 2520 tion collision is resolved (see Section 6.8) the FSM for the connec- 2521 tion that is closed SHOULD be disposed of. 2523 RFC DRAFT November 2003 2525 8.2.1.3 FSM and Optional Session Attributes 2527 Optional Session Attributes specify either attributes that act 2528 as flags (TRUE or FALSE) or optional timers. For optional 2529 attributes that act as flags, if the optional session attribute 2530 can be set to TRUE on the system, the corresponding the BGP FSM 2531 actions must be supported. For example, if the following options 2532 can be set in a BGP implementation: AutoStart and 2533 PassiveTcpEstablishment, then the events 3, 4 and 5 must be 2534 supported. If an Optional Session attribute cannot be set to 2535 TRUE, the events supporting that set of options do not have to 2536 be supported. 2538 Each of the optional timers (DelayOpenTimer and IdleHoldTimer), 2539 has a group of attributes that are: 2541 - flag indicating support, 2542 - Time set in Timer 2543 - Timer. 2545 The two optional timers show this format: 2547 DelayOpenTimer: DelayOpen, DelayOpenTime, DelayOpenTimer 2548 IdleHoldTimer: DampPeerOscillations, IdleHoldTime, 2549 IdleHoldTimer 2551 If the flag indicating support for an optional timer 2552 (DelayOpen or DampPeerOscillations), cannot be set to TRUE, 2553 the timers and events supporting that 2554 option do not have to be supported. 2556 8.2.1.4 FSM Event numbers 2558 The Event numbers (1-28) utilized in this state machine description 2559 aid in specifying the behavior of the BGP state machine. Implementa- 2560 tions MAY use these numbers to provide network management informa- 2561 tion. The exact form of a FSM or the FSM events are specific to each 2562 implementation. 2564 RFC DRAFT November 2003 2566 8.2.1.5 FSM actions that are implementation dependent. 2568 The BGP FSM specifies at certain points that BGP initialization will 2569 occur or that BGP resources will be deleted. The initialization of 2570 the BGP FSM and the associated resources depend on the policy portion 2571 of the BGP implementation. The details of these actions are outside 2572 the scope of the FSM document. 2574 8.2.2 Finite State Machine 2576 Idle state: 2578 Initially the BGP peer FSM is in the Idle state. (Hereafter 2579 the BGP peer FSM will be shortened to BGP FSM.) 2581 In this state BGP FSM refuses all incoming BGP 2582 connections for this peer. No resources are allocated to the peer. 2583 In response to a ManualStart event (Event 1) or an 2584 AutomaticStart event (Event 3), the local system: 2585 - initializes all BGP resources for the peer connection, 2586 - sets ConnectRetryCounter to zero, 2587 - starts the ConnectRetryTimer with initial value, 2588 - initiates a TCP connection to the other BGP peer, 2589 - listens for a connection that may be initiated by 2590 the remote BGP peer, and 2591 - changes its state to Connect. 2593 The ManualStop event (Event 2) and AutomaticStop (Event 8) event 2594 are ignored in the Idle state. 2596 In response to a ManualStart_with_PassiveTcpEstablishment event 2597 (Event 4) or AutomaticStart_with_PassiveTcpEstablishment event 2598 (Event 5), the local system: 2599 - initializes all BGP resources, 2600 - sets the ConnectRetryCounter to zero, 2601 - starts the ConnectRetryTimer with initial value, 2602 - listens for a connection that may be initiated by 2603 the remote peer, and 2604 - changes its state to Active. 2606 The exact value of the ConnectRetryTimer is a local 2607 matter, but it SHOULD be sufficiently large to allow TCP 2608 initialization. 2610 If the DampPeerOscillations attribute is set to TRUE, 2611 RFC DRAFT November 2003 2613 the following three additional events may occur 2614 within Idle state: 2615 - AutomaticStart_with_DampPeerOscillations (Event6), 2616 - AutomaticStart_with_DampPeerOscillations_and_ 2617 PassiveTcpEstablishment (Event7), 2618 - IdleHoldTimer_Expires (Event 13). 2620 Upon receiving these 3 events, the local system will 2621 use these events to prevent peer oscillations. 2622 The method of preventing persistent peer oscillation is 2623 outside the scope of this document. 2625 Any other event (Events 9-12, 15-28) received in the Idle state 2626 does not cause change in the state of the local system. 2628 Connect State: 2630 In this state, BGP FSM is waiting for the TCP connection to 2631 be completed. 2633 The start events (Events 1, 3-7) are ignored in connect 2634 state. 2636 In response to a ManualStop event [Event 2), the local system: 2637 - drops the TCP connection, 2638 - releases all BGP resources, 2639 - sets ConnectRetryCounter to zero, 2640 - stops the ConnectRetryTimer and sets ConnectRetryTimer 2641 to zero, and 2642 - changes its state to Idle. 2644 In response to the ConnectRetryTimer_Expires event (Event 2645 9), the local system: 2646 - drops the TCP connection, 2647 - restarts the ConnectRetryTimer, 2648 - stops the DelayOpenTimer and resets the timer to zero, 2649 - initiates a TCP connection to the other BGP peer, 2650 - continues to listen for a connection that may be 2651 initiated by the remote BGP peer, and 2652 - stays in Connect state. 2654 If the DelayOpenTimer_Expires event (Event12) occurs in the 2655 Connect state, the local system: 2656 - sends an OPEN message to its peer, 2657 - sets the HoldTimer to a large value, and 2658 RFC DRAFT November 2003 2660 - changes its state to OpenSent. 2662 If the BGP FSM receives a TcpConnection_Valid event 2663 (Event 14), the TCP connection is processed, and 2664 the connection remains in the Connect state. 2666 If the BGP FSM receives a Tcp_CR_Invalid event (Event 15), 2667 the local system rejects the TCP connection, and the connection 2668 remains in the Connect state. 2670 If the TCP connection succeeds (Event 16 or Event 17), 2671 the local system checks the DelayOpen attribute prior 2672 to processing. If the DelayOpen attribute is set to TRUE, 2673 the local system: 2674 - stops the ConnectRetryTimer (if running) and sets the 2675 ConnectRetryTimer to zero, 2676 - sets the DelayOpenTimer to the initial value, and 2677 - stays in the Connect state. 2678 If the DelayOpen attribute is set to FALSE, the local system: 2679 - stops the ConnectRetryTimer (if running) and sets the 2680 ConnectRetryTimer to zero, 2681 - completes BGP initialization 2682 - sends an OPEN message to its peer, 2683 - sets HoldTimer to a large value, and 2684 - changes its state to OpenSent. 2686 A HoldTimer value of 4 minutes is suggested. 2688 If the TCP connection fails (Event18), the local system 2689 checks the DelayOpenTimer. If the DelayOpenTimer is running, 2690 the local system: 2691 - restarts the ConnectRetryTimer with initial value, 2692 - stops the DelayOpenTimer and resets its value to zero, 2693 - continues to listen for a connection that may be 2694 initiated by the remote BGP peer, and 2695 - changes its state to Active. 2697 If the DelayOpenTimer is not running, the local system: 2698 - stops the ConnectRetryTimer to zero, 2699 - drops the TCP connection, 2700 - releases all BGP resources, and 2701 - changes its state to Idle. 2703 If an OPEN message is received while the DelayOpenTimer is 2704 running (Event 20), the local system: 2706 - stops the ConnectRetryTimer (if running) and 2707 sets the ConnectRetryTimer to zero, 2708 RFC DRAFT November 2003 2710 - completes the BGP initialization, 2711 - stops and clears the DelayOpenTimer 2712 (sets the value to zero), 2713 - sends an OPEN message, 2714 - sends a KEEPALIVE message, 2715 - if the HoldTimer initial value is non-zero, 2716 - starts the KeepaliveTimer with the initial value and 2717 - resets the HoldTimer to the negotiated value, 2718 else if HoldTimer initial value is zero, 2719 - resets the KeepaliveTimer and 2720 - resets the HoldTimer value to zero, 2721 - and changes its state to OpenConfirm. 2723 If the value of the autonomous system field is the same as the local 2724 Autonomous System number, set the connection status to an internal 2725 connection; otherwise it is "external". 2727 If BGP message header checking detects an error (Event 21) or 2728 OPEN message checking detects an error (Event 22) (see section 2729 6.2), the local system: 2730 - (optionally) If the SendNOTIFICATIONwithoutOPEN attribute 2731 is set to TRUE, then the local system first sends 2732 a NOTIFICATION message with the appropriate error 2733 code, and then 2735 - stops the ConnectRetryTimer (if running) 2736 and sets the ConnectRetryTimer to zero, 2737 - releases all BGP resources, 2738 - drops the TCP connection, 2739 - increments the ConnectRetryCounter by 1, 2740 - (optionally) performs peer oscillation damping 2741 if the DampPeerOscillations attribute is set to TRUE, and 2742 - changes its state to Idle. 2744 If a NOTIFICATION message is received with a version 2745 error(Event24), the local system checks the DelayOpenTimer. 2746 If the DelayOpenTimer is running, the local system: 2747 - stops the ConnectRetryTimer (if running) 2748 and sets the ConnectRetryTimer to zero, 2749 - stops and resets the DelayOpenTimer (sets to zero), 2750 - releases all BGP resources, 2751 - drops the TCP connection, and 2752 - changes its state to Idle. 2754 If the DelayOpenTimer is not running, the local system: 2755 - stops the ConnectRetryTimer and sets the 2756 ConnectRetryTimer to zero, 2757 - releases all BGP resources, 2758 RFC DRAFT November 2003 2760 - drops the TCP connection, 2761 - increments the ConnectRetryCounter by 1, 2762 - performs peer oscillation damping if the 2763 DampPeerOscillations attribute is set to True, and 2764 - changes its state to Idle. 2766 In response to any other events (Events 8,10-11,13,19,23, 2767 25-28) the local system: 2768 - if the ConnectRetryTimer is running, 2769 stops and resets the ConnectRetryTimer (sets to zero), 2770 - if the DelayOpenTimer is running, 2771 stops and resets the DelayOpenTimer (sets to zero), 2772 - releases all BGP resources, 2773 - drops the TCP connection, 2774 - increments the ConnectRetryCounter by 1, 2775 - performs peer oscillation damping if the 2776 DampPeerOscillations attribute is set to True, and 2777 - changes its state to Idle. 2779 Active State: 2781 In this state BGP FSM is trying to acquire a peer by listening 2782 for and accepting a TCP connection. 2784 The start events (Event1, 3-7) are ignored in the Active 2785 state. 2787 In response to a ManualStop event (Event 2), the local system: 2788 - If the DelayOpenTimer is running and the 2789 SendNOTIFICATIONwithoutOPEN session attribute is set, 2790 the local system sends a NOTIFICATION with a Cease, 2791 - releases all BGP resources including 2792 stopping the DelayOpenTimer 2793 - drops the TCP connection, 2794 - sets ConnectRetryCounter to zero, 2795 - stops the ConnectRetryTimer and sets the 2796 ConnectRetryTimer to zero, and 2797 - changes its state to Idle. 2799 In response to a ConnectRetryTimer_Expires event (Event 9), 2800 the local system: 2801 - restarts the ConnectRetryTimer (with initial value), 2802 - initiates a TCP connection to the other BGP peer, 2803 - continues to listen for TCP connection that may be 2804 initiated by remote BGP peer, and 2805 RFC DRAFT November 2003 2807 - changes its state to Connect. 2809 If the local system receives a DelayOpenTimer_Expires event 2810 (Event 12), the local system: 2811 - sets the ConnectRetryTimer to zero, 2812 - stops and clears the DelayOpenTimer (set to zero), 2813 - completes the BGP initialization, 2814 - sends the OPEN message to its remote peer, 2815 - sets its hold timer to a large value, and 2816 - changes its state to OpenSent. 2818 A HoldTimer value of 4 minutes is also suggested for this 2819 state transition. 2821 If the local system receives a TcpConnection_Valid event 2822 (Event 14), the local system processes the TCP connection 2823 flags and stays in Active state. 2825 If the local system receives an Tcp_CR_Invalid event (Event 15): 2826 the local system rejects the TCP connection and stays in 2827 the Active State. 2829 In response to a TCP connection succeeding (Event 16 or Event 17), the 2830 local system checks the DelayOpen optional attribute prior to 2831 processing. 2832 If the DelayOpen attribute is set to TRUE, the local 2833 system: 2834 - stops the ConnectRetryTimer and sets the 2835 ConnectRetryTimer to zero, 2836 - sets the DelayOpenTimer to the initial value 2837 (DelayOpenTime), and 2838 - stays in the Active state. 2839 If the DelayOpen attribute is set to FALSE, the local 2840 system: 2841 - sets the ConnectRetryTimer to zero, 2842 - completes the BGP initialization, 2843 - sends the OPEN message to its peer, 2844 - sets its HoldTimer to a large value, and 2845 - changes its state to OpenSent. 2847 A HoldTimer value of 4 minutes is suggested as a "large value" for 2848 the HoldTimer. 2850 If the local system receives a TcpConnectionFails event (Event 18), 2851 the local system: 2853 RFC DRAFT November 2003 2855 - restarts ConnectRetryTimer (with initial value), 2856 - stops and clears the DelayOpenTimer (sets the value to zero), 2857 - releases all BGP resource, 2858 - increments ConnectRetryCounter by 1, 2859 - optionally performs peer oscillation damping if 2860 the DampPeerOscillations attribute is set to TRUE, and 2861 - changes its state to Idle. 2863 If an OPEN message is received and the DelayOpenTimer is 2864 running (Event 20), the local system: 2865 - stops ConnectRetryTimer (if running) and sets 2866 the ConnectRetryTimer to zero, 2867 - stops and clears DelayOpenTimer (sets to zero), 2868 - completes the BGP initialization, 2869 - sends an OPEN message, 2870 - sends a KEEPALIVE message, 2871 - if the HoldTimer value is non-zero, 2872 - starts the KeepaliveTimer to initial value, 2873 - resets the HoldTimer to the negotiated value, 2874 else if the HoldTimer is zero 2875 - resets the KeepaliveTimer (set to zero), 2876 - resets the HoldTimer to zero, and 2877 - changes its state to OpenConfirm. 2879 If the value of the autonomous system field is the same as 2880 the local Autonomous System number, set the connection status 2881 to an internal connection; otherwise it is external. 2883 If BGP message header checking detects an error (Event 21) 2884 or OPEN message checking detects an error (Event 22) (see 2885 section 6.2), the local system: 2886 - (optionally) sends a NOTIFICATION message with the 2887 appropriate error code if the SendNOTIFICATIONwithoutOPEN 2888 attribute is set to TRUE, 2889 - sets the ConnectRetryTimer to zero, 2890 - releases all BGP resources, 2891 - drops the TCP connection, 2892 - increments the ConnectRetryCounter by 1, 2893 - (optionally) performs peer oscillation damping if the 2894 DampPeerOscillations attribute is set to TRUE, and 2895 - changes its state to Idle. 2897 If a NOTIFICATION message is received with a version 2898 error (Event 24), the local system checks the DelayOpenTimer. 2899 If the DelayOpenTimer is running, the local system: 2900 - stops the ConnectRetryTimer (if running) and 2901 sets the ConnectRetryTimer to zero, 2902 RFC DRAFT November 2003 2904 - stops and resets the DelayOpenTimer (sets to zero), 2905 - releases all BGP resources, 2906 - drops the TCP connection, and 2907 - changes its state to Idle. 2908 If the DelayOpenTimer is not running, the local system: 2909 - sets the ConnectRetryTimer to zero, 2910 - releases all BGP resources, 2911 - drops the TCP connection, 2912 - increments the ConnectRetryCounter by 1, 2913 - (optionally) performs peer oscillation damping 2914 if the DampPeerOscillations attribute is set to TRUE, and 2915 - changes its state to Idle. 2917 In response to any other event (Events 8,10-11,13,19,23,25-28), 2918 the local system: 2919 - sets the ConnectRetryTimer to zero, 2920 - releases all BGP resources, 2921 - drops the TCP connection, 2922 - increments the ConnectRetryCounter by one, 2923 - (optionally) performs peer oscillation damping if 2924 the DampPeerOscillations attribute is set to TRUE, and 2925 - changes its state to Idle. 2927 OpenSent: 2929 In this state BGP FSM waits for an OPEN message from its peer. 2931 The start events (Event1, 3-7) are ignored in the OpenSent 2932 state. 2934 If a ManualStop event (Event 2) is issued in OpenSent 2935 state, the local system: 2936 - sends the NOTIFICATION with a cease, 2937 - sets the ConnectRetryTimer to zero, 2938 - releases all BGP resources, 2939 - drops the TCP connection, 2940 - sets the ConnectRetryCounter to zero, and 2941 - changes its state to Idle. 2943 If an AutomaticStop event (Event 8) is issued in OpenSent 2944 state, the local system: 2945 - sends the NOTIFICATION with a cease, 2946 - sets the ConnectRetryTimer to zero, 2947 - releases all the BGP resources, 2948 - drops the TCP connection, 2949 - increments the ConnectRetryCounter by 1, 2950 - (optionally) performs peer oscillation damping if the 2951 RFC DRAFT November 2003 2953 DampPeerOscillations attribute is set to TRUE, and 2954 - changes its state to Idle. 2956 If the HoldTimer_Expires (Event 10), the local system: 2957 - sends a NOTIFICATION message with error code Hold 2958 Timer Expired, 2959 - sets the ConnectRetryTimer to zero, 2960 - releases all BGP resources, 2961 - drops the TCP connection, 2962 - increments the ConnectRetryCounter, 2963 - (optionally) performs peer oscillation damping if the 2964 DampPeerOscillations attribute is set to TRUE, and 2965 - changes its state to Idle. 2967 If a TcpConnection_Valid (Event 14) or Tcp_CR_Acked (Event 16) 2968 is received, or a TcpConnectionConfirmed event (Event 17) is 2969 received, a second TCP connection may be in progress. This 2970 second TCP connection is tracked per Connection Collision 2971 processing (Section 6.8) until an OPEN message is received. 2973 A TCP Connection Request for an Invalid port 2974 (Tcp_CR_Invalid (Event 15)) is ignored. 2976 If a TcpConnectionFails event (Event18) is received, 2977 the local system: 2978 - closes the BGP connection, 2979 - restarts the ConnectRetryTimer, 2980 - continues to listen for a connection that may be 2981 initiated by the remote BGP peer, and 2982 - changes its state to Active. 2984 When an OPEN message is received, all fields are checked 2985 for correctness. If there are no errors in the OPEN message 2986 (Event 19), the local system: 2987 - resets the DelayOpenTimer to zero, 2988 - sets the BGP ConnectRetryTimer to zero, 2989 - sends a KEEPALIVE message, and 2990 - sets a KeepaliveTimer (via the text below) 2991 - sets the HoldTimer according to the negotiated value 2992 (see Section 4.2), 2993 - changes its state to OpenConfirm. 2995 If the negotiated hold time value is zero, then the HoldTimer and 2996 KeepaliveTimer are not started. If the value of the Autonomous 2997 System field is the same as the local Autonomous System number, 2998 then the connection is an "internal" connection; otherwise, it 2999 is an "external" connection. (This will impact UPDATE processing 3000 RFC DRAFT November 2003 3002 as described below.) 3004 If the BGP message header checking (Event 21) or OPEN message 3005 check detects an error (Event 22)(see Section 6.2), the local system: 3006 - sends a NOTIFICATION message with appropriate error 3007 code, 3008 - sets the ConnectRetryTimer to zero, 3009 - releases all BGP resources, 3010 - drops the TCP connection, 3011 - increments the ConnectRetryCounter by 1, 3012 - (optionally) performs peer oscillation damping if the 3013 DampPeerOscillations attribute is TRUE, and 3014 - changes its state to Idle. 3016 Collision detection mechanisms (Section 6.8) need to be 3017 applied when a valid BGP OPEN message is received (Event 19 or 3018 Event 20). Please refer to Section 6.8 for the details of 3019 the comparison. A CollisionDetectDump event occurs when the 3020 BGP implementation determines, by a means outside the scope of 3021 this document, that a connection collision has occurred. 3023 If a connection in OpenSent state is determined to be the 3024 connection that must be closed, an OpenCollisionDump (Event 23) 3025 is signaled to the state machine. If such an event is 3026 received in OpenSent state, the local system: 3027 - sends a NOTIFICATION with a Cease 3028 - sets the ConnectRetryTimer to zero, 3029 - releases all BGP resources, 3030 - drops the TCP connection, 3031 - increments ConnectRetryCounter by 1, 3032 - (optionally) performs peer oscillation damping if the 3033 DampPeerOscillations attribute is set to TRUE, and 3034 - changes its state to Idle. 3036 If a NOTIFICATION message is received with a version 3037 error (Event24), the local system: 3038 - sets the ConnectRetryTimer to zero, 3039 - releases all BGP resources, 3040 - drops the TCP connection, and 3041 - changes its state to Idle. 3043 In response to any other event (Events 9, 11-13,20,25-28), 3044 the local system: 3045 - sends the NOTIFICATION with the Error Code Finite 3046 state machine error, 3047 - sets the ConnectRetryTimer to zero, 3048 RFC DRAFT November 2003 3050 - releases all BGP resources, 3051 - drops the TCP connection, 3052 - increments the ConnectRetryCounter by 1, 3053 - (optionally) performs peer oscillation damping if the 3054 DampPeerOscillations attribute is set to TRUE, and 3055 - changes its state to Idle. 3057 OpenConfirm State: 3059 In this state BGP waits for a KEEPALIVE or NOTIFICATION 3060 message. 3062 Any start event (Event1, 3-7) is ignored in the OpenConfirm 3063 state. 3065 In response to a ManualStop event (Event 2) initiated by 3066 the operator, the local system: 3067 - sends the NOTIFICATION message with Cease, 3068 - releases all BGP resources, 3069 - drops the TCP connection, 3070 - sets the ConnectRetryCounter to zero, 3071 - sets the ConnectRetryTimer to zero, and 3072 - changes its state to Idle. 3074 In response to the AutomaticStop event initiated by the 3075 system (Event 8), the local system: 3076 - sends the NOTIFICATION message with Cease, 3077 - sets the ConnectRetryTimer to zero, 3078 - releases all BGP resources, 3079 - drops the TCP connection, 3080 - increments the ConnectRetryCounter by 1, 3081 - (optionally) performs peer oscillation damping 3082 if the DampPeerOscillations attribute is set to TRUE, 3083 and 3084 - changes its state to Idle. 3086 If the HoldTimer_Expires event (Event 10) occurs before a KEEPALIVE 3087 message is received, the local system: 3088 - sends the NOTIFICATION message with the error code, 3089 - sets the ConnectRetryTimer to zero, 3090 - releases all BGP resources, 3091 - drops the TCP connection, 3092 - increments the ConnectRetryCounter by 1, 3093 - (optionally) performs peer oscillation damping if 3094 RFC DRAFT November 2003 3096 the DampPeerOscillations attribute is set to TRUE, and 3097 - changes its state to Idle. 3099 If the local system receives a KeepaliveTimer_Expires 3100 event (Event 11), the system: 3101 - sends a KEEPALIVE message, 3102 - restarts the KeepaliveTimer, and 3103 - remains in OpenConfirmed state. 3105 In the event of TcpConnection_Valid event (Event 14), or TCP 3106 connection succeeding (Event 16 or Event 17) while in OpenConfirm, 3107 the local system needs to track the second connection. 3109 If a TCP connection is attempted to an invalid port (Event 3110 15), the local system will ignore the second connection 3111 attempt. 3113 If the local system receives a TcpConnectionFails event 3114 (Event 18) from the underlying TCP or a NOTIFICATION 3115 message (Event 25), the local system: 3116 - sets the ConnectRetryTimer to zero, 3117 - releases all BGP resources, 3118 - drops the TCP connection, 3119 - increments the ConnectRetryCounter by 1, 3120 - (optionally) performs peer oscillation damping if the 3121 DampPeerOscillations attribute is set to TRUE, and 3122 - changes its state to Idle. 3124 If the local system receives a NOTIFICATION message with a 3125 version error (NotifMsgVerErr (Event 24)), the local system: 3126 - sets the ConnectRetryTimer to zero, 3127 - releases all BGP resources, 3128 - drops the TCP connection, and 3129 - changes its state to Idle. 3131 If the local system receives a valid OPEN message 3132 (BGPOpen (Event 19)), the collision detect function is 3133 processed per Section 6.8. If this connection is to be 3134 dropped due to connection collision, the local system: 3135 - sends a NOTIFICATION with a Cease, 3136 - sets the ConnectRetryTimer to zero, 3137 - releases all BGP resources, 3138 - drops the TCP connection (send TCP FIN), 3139 - increments the ConnectRetryCounter by 1, 3140 - (optionally) performs peer oscillation damping if the 3141 RFC DRAFT November 2003 3143 DampPeerOscillations attribute is set to TRUE, and 3144 - changes its state to Idle. 3146 If an OPEN message is received, all fields are checked for 3147 correctness. If the BGP message header checking 3148 (BGPHeaderErr (Event21)) or OPEN message check detects 3149 an error (see Section 6.2) (BGPOpenMsgErr(Event22)), the 3150 local system: 3151 - sends a NOTIFICATION message with appropriate error 3152 code, 3153 - sets the ConnectRetryTimer to zero, 3154 - releases all BGP resources, 3155 - drops the TCP connection, 3156 - increments the ConnectRetryCounter by 1, 3157 - (optionally) performs peer oscillation damping if the 3158 DampPeerOscillations attribute is set to TRUE, and 3159 - changes its state to Idle. 3161 If during the processing of another OPEN message, the BGP 3162 implementation determines by a means outside the scope of 3163 this document that a connection collision has occurred and 3164 this connection is to be closed, the local system will 3165 issue an OpenCollisionDump event (Event 23). When the local 3166 system receives an OpenCollisionDump event (Event 23), the 3167 local system: 3168 - sends a NOTIFICATION with a Cease 3169 - sets the ConnectRetryTimer to zero, 3170 - releases all BGP resources 3171 - drops the TCP connection, 3172 - increments the ConnectRetryCounter by 1, 3173 - (optionally) performs peer oscillation damping if the 3174 DampPeerOscillations attribute is set to TRUE, and 3175 - changes its state to Idle. 3177 If the local system receives a KEEPALIVE message 3178 (KeepAliveMsg (Event 26)), the local system: 3179 - restarts the HoldTimer and 3180 - changes its state to Established. 3182 In response to any other event (Events 9, 12-13, 20, 27-28), 3183 the local system: 3184 - sends a NOTIFICATION with a code of Finite State 3185 Machine Error, 3186 - sets the ConnectRetryTimer to zero, 3187 - releases all BGP resources, 3188 RFC DRAFT November 2003 3190 - drops the TCP connection, 3191 - increments the ConnectRetryCounter by 1, 3192 - (optionally) performs peer oscillation damping if the 3193 DampPeerOscillations attribute is set to TRUE, and 3194 - changes its state to Idle. 3196 Established State: 3198 In the Established state, the BGP FSM can exchange UPDATE, 3199 NOTIFICATION, and KEEPALIVE messages with its peer. 3201 Any Start event (Event 1, 3-7) is ignored in the 3202 Established state. 3204 In response to a ManualStop event (initiated by an 3205 operator)(Event2), the local system: 3206 - sends the NOTIFICATION message with Cease, 3207 - sets the ConnectRetryTimer to zero, 3208 - deletes all routes associated with this connection, 3209 - releases BGP resources, 3210 - drops the TCP connection, 3211 - sets ConnectRetryCounter to zero, and 3212 - changes its state to Idle. 3214 In response to an AutomaticStop event (Event8), the local system: 3215 - sends a NOTIFICATION with Cease, 3216 - sets the ConnectRetryTimer to zero 3217 - deletes all routes associated with this connection, 3218 - releases all BGP resources, 3219 - drops the TCP connection, 3220 - increments the ConnectRetryCounter by 1, 3221 - (optionally) performs peer oscillation damping if the 3222 DampPeerOscillations attribute is set to TRUE, and 3223 - changes its state to Idle. 3225 One reason for an AutomaticStop event is: A BGP receives 3226 UPDATE messages with number of prefixes for a given 3227 peer so that the total prefixes received exceeds the 3228 maximum number of prefixes configured. The local system 3229 automatically disconnects the peer. 3231 If the HoldTimer_Expires event occurs (Event10), the 3232 local system: 3233 - sends a NOTIFICATION message with Error Code Hold 3234 Timer Expired, 3235 RFC DRAFT November 2003 3237 - sets the ConnectRetryTimer to zero, 3238 - releases all BGP resources, 3239 - drops the TCP connection, 3240 - increments the ConnectRetryCounter by 1, 3241 - (optionally) performs peer oscillation damping if the 3242 DampPeerOscillations attribute is set to TRUE, and 3243 - changes its state to Idle. 3245 If the KeepaliveTimer_Expires event occurs (Event11), 3246 the local system: 3247 - sends a KEEPALIVE message, and 3248 - restarts its KeepaliveTimer unless the negotiated 3249 HoldTime value is zero. 3251 Each time the local system sends a KEEPALIVE or UPDATE 3252 message, it restarts its KeepaliveTimer, unless the 3253 negotiated HoldTime value is zero. 3255 A TcpConnection_Valid (Event 14) received for a 3256 valid port will cause the second connection to be 3257 tracked. 3259 An invalid TCP connection (Tcp_CR_Invalid Event 3260 (Event 15)), will be ignored. 3262 In response to an indication that the TCP connection 3263 is successfully established (Event 16 3264 or Event 17), the second connection SHALL be tracked until 3265 it sends an OPEN message. 3267 If a valid OPEN message (BGPOpen (Event 19)) is received, 3268 and if the CollisionDetectEstablishedState optional 3269 attribute is TRUE, the OPEN message will be checked 3270 to see if it collides (Section 6.8) with any other connection. 3271 If the BGP implementation determines that this connection 3272 needs to be terminated, it will process an OpenCollisionDump 3273 event (Event 23). If this connection needs to be 3274 terminated, the local system: 3275 - sends a NOTIFICATION with a Cease, 3276 - sets the ConnectRetryTimer to zero, 3277 - deletes all routes associated with this connection, 3278 - releases all BGP resources, 3279 - drops the TCP connection, 3280 - increments ConnectRetryCounter by 1, 3281 - (optionally) performs peer oscillation damping if the 3282 DampPeerOscillations is set to TRUE, and 3283 - changes its state to Idle. 3285 RFC DRAFT November 2003 3287 If the local system receives a NOTIFICATION message 3288 (Event24 or Event 25) or a TcpConnectionFails (Event18) 3289 from the underlying TCP, it: 3290 - sets the ConnectRetryTimer to zero, 3291 - deletes all routes associated with this connection, 3292 - releases all the BGP resources, 3293 - drops the TCP connection, 3294 - increments the ConnectRetryCounter by 1, 3295 - changes its state to Idle. 3297 If the local system receives a KEEPALIVE message 3298 (Event 26), the local system: 3299 - restarts its HoldTimer, if the negotiated HoldTime 3300 value is non-zero, and 3301 - remains in the Established state. 3303 If the local system receives an UPDATE message (Event27), 3304 the local system: 3305 - processes the message, 3306 - restarts its HoldTimer if the negotiated HoldTime 3307 value is non-zero, and 3308 - remains in the Established state. 3310 If the local system receives an UPDATE message, and the 3311 UPDATE message error handling procedure (see Section 6.3) 3312 detects an error (Event28), the local system: 3313 - sends a NOTIFICATION message with Update error, 3314 - sets the ConnectRetryTimer to zero, 3315 - deletes all routes associated with this connection, 3316 - releases all BGP resources, 3317 - drops the TCP connection, 3318 - increments the ConnectRetryCounter by 1, 3319 - (optionally) performs peer oscillation damping if the 3320 DampPeerOscillations attribute is set to TRUE, and 3321 - changes its state to Idle. 3323 In response to any other event (Events 9, 12-13, 20-22) the 3324 local system: 3325 - sends a NOTIFICATION message with Error Code Finite 3326 State Machine Error, 3327 - deletes all routes associated with this connection, 3328 - sets the ConnectRetryTimer to zero, 3329 - releases all BGP resources, 3330 - drops the TCP connection, 3331 RFC DRAFT November 2003 3333 - increments the ConnectRetryCounter by 1, 3334 - (optionally) performs peer oscillation damping if the 3335 DampPeerOscillations attribute is set to TRUE, and 3336 - changes its state to Idle. 3338 9. UPDATE Message Handling 3340 An UPDATE message may be received only in the Established state. 3341 Receiving an UPDATE message in any other state is an error. When an 3342 UPDATE message is received, each field is checked for validity as 3343 specified in Section 6.3. 3345 If an optional non-transitive attribute is unrecognized, it is qui- 3346 etly ignored. If an optional transitive attribute is unrecognized, 3347 the Partial bit (the third high-order bit) in the attribute flags 3348 octet is set to 1, and the attribute is retained for propagation to 3349 other BGP speakers. 3351 If an optional attribute is recognized, and has a valid value, then, 3352 depending on the type of the optional attribute, it is processed 3353 locally, retained, and updated, if necessary, for possible propaga- 3354 tion to other BGP speakers. 3356 If the UPDATE message contains a non-empty WITHDRAWN ROUTES field, 3357 the previously advertised routes whose destinations (expressed as IP 3358 prefixes) contained in this field SHALL be removed from the Adj-RIB- 3359 In. This BGP speaker SHALL run its Decision Process since the previ- 3360 ously advertised route is no longer available for use. 3362 If the UPDATE message contains a feasible route, the Adj-RIB-In will 3363 be updated with this route as follows: if the NLRI of the new route 3364 is identical to the one of the route currently stored in the Adj-RIB- 3365 In, then the new route SHALL replace the older route in the Adj-RIB- 3366 In, thus implicitly withdrawing the older route from service. Other- 3367 wise, if the Adj-RIB-In has no route with NLRI identical to the new 3368 route, the new route SHALL be placed in the Adj-RIB-In. 3370 Once the BGP speaker updates the Adj-RIB-In, the speaker SHALL run 3371 its Decision Process. 3373 RFC DRAFT November 2003 3375 9.1 Decision Process 3377 The Decision Process selects routes for subsequent advertisement by 3378 applying the policies in the local Policy Information Base (PIB) to 3379 the routes stored in its Adj-RIBs-In. The output of the Decision Pro- 3380 cess is the set of routes that will be advertised to peers; the 3381 selected routes will be stored in the local speaker's Adj-RIBs-Out 3382 according to policy. 3384 The BGP Decision Process described here is conceptual, and does not 3385 have to be implemented precisely as described here, as long as the 3386 implementations support the described functionality and their exter- 3387 nally visible behavior is the same. 3389 The selection process is formalized by defining a function that takes 3390 the attribute of a given route as an argument and returns either (a) 3391 a non-negative integer denoting the degree of preference for the 3392 route, or (b) a value denoting that this route is ineligible to be 3393 installed in Loc-RIB and will be excluded from the next phase of 3394 route selection. 3396 The function that calculates the degree of preference for a given 3397 route SHALL NOT use as its inputs any of the following: the existence 3398 of other routes, the non-existence of other routes, or the path 3399 attributes of other routes. Route selection then consists of individ- 3400 ual application of the degree of preference function to each feasible 3401 route, followed by the choice of the one with the highest degree of 3402 preference. 3404 The Decision Process operates on routes contained in the Adj-RIBs-In, 3405 and is responsible for: 3407 - selection of routes to be used locally by the speaker 3409 - selection of routes to be advertised to other BGP peers 3411 - route aggregation and route information reduction 3413 The Decision Process takes place in three distinct phases, each trig- 3414 gered by a different event: 3416 a) Phase 1 is responsible for calculating the degree of preference 3417 for each route received from a peer. 3419 b) Phase 2 is invoked on completion of phase 1. It is responsible 3420 for choosing the best route out of all those available for each 3421 distinct destination, and for installing each chosen route into 3422 RFC DRAFT November 2003 3424 the Loc-RIB. 3426 c) Phase 3 is invoked after the Loc-RIB has been modified. It is 3427 responsible for disseminating routes in the Loc-RIB to each peer, 3428 according to the policies contained in the PIB. Route aggregation 3429 and information reduction can optionally be performed within this 3430 phase. 3432 9.1.1 Phase 1: Calculation of Degree of Preference 3434 The Phase 1 decision function is invoked whenever the local BGP 3435 speaker receives from a peer an UPDATE message that advertises a new 3436 route, a replacement route, or withdrawn routes. 3438 The Phase 1 decision function is a separate process which completes 3439 when it has no further work to do. 3441 The Phase 1 decision function locks an Adj-RIB-In prior to operating 3442 on any route contained within it, and unlocks it after operating on 3443 all new or unfeasible routes contained within it. 3445 For each newly received or replacement feasible route, the local BGP 3446 speaker determines a degree of preference as follows: 3448 If the route is learned from an internal peer, either the value of 3449 the LOCAL_PREF attribute is taken as the degree of preference, or 3450 the local system computes the degree of preference of the route 3451 based on preconfigured policy information. Note that the latter 3452 (computing the degree of preference based on preconfigured policy 3453 information) may result in formation of persistent routing loops. 3455 If the route is learned from an external peer, then the local BGP 3456 speaker computes the degree of preference based on preconfigured 3457 policy information. If the return value indicates that the route 3458 is ineligible, the route MAY NOT serve as an input to the next 3459 phase of route selection; otherwise the return value MUST be used 3460 as the LOCAL_PREF value in any IBGP readvertisement. 3462 The exact nature of this policy information and the computation 3463 involved is a local matter. 3465 9.1.2 Phase 2: Route Selection 3467 The Phase 2 decision function is invoked on completion of Phase 1. 3469 RFC DRAFT November 2003 3471 The Phase 2 function is a separate process which completes when it 3472 has no further work to do. The Phase 2 process considers all routes 3473 that are eligible in the Adj-RIBs-In. 3475 The Phase 2 decision function is blocked from running while the Phase 3476 3 decision function is in process. The Phase 2 function locks all 3477 Adj-RIBs-In prior to commencing its function, and unlocks them on 3478 completion. 3480 If the NEXT_HOP attribute of a BGP route depicts an address that is 3481 not resolvable, or it would become unresolvable if the route was 3482 installed in the routing table the BGP route MUST be excluded from 3483 the Phase 2 decision function. 3485 If the AS_PATH attribute of a BGP route contains an AS loop, the BGP 3486 route should be excluded from the Phase 2 decision function. AS loop 3487 detection is done by scanning the full AS path (as specified in the 3488 AS_PATH attribute), and checking that the autonomous system number of 3489 the local system does not appear in the AS path. Operations of a BGP 3490 speaker that is configured to accept routes with its own autonomous 3491 system number in the AS path are outside the scope of this document. 3493 It is critical that BGP speakers within an AS do not make conflicting 3494 decisions regarding route selection that would cause forwarding loops 3495 to occur. 3497 For each set of destinations for which a feasible route exists in the 3498 Adj-RIBs-In, the local BGP speaker identifies the route that has: 3500 a) the highest degree of preference of any route to the same set 3501 of destinations, or 3503 b) is the only route to that destination, or 3505 c) is selected as a result of the Phase 2 tie breaking rules spec- 3506 ified in 9.1.2.2. 3508 The local speaker SHALL then install that route in the Loc-RIB, 3509 replacing any route to the same destination that is currently being 3510 held in the Loc-RIB. When the new BGP route is installed in the Rout- 3511 ing Table, care must be taken to ensure that existing routes to the 3512 same destination that are now considered invalid are removed from the 3513 Routing Table. Whether or not the new BGP route replaces an existing 3514 non-BGP route in the Routing Table depends on the policy configured 3515 on the BGP speaker. 3517 The local speaker MUST determine the immediate next-hop address from 3518 the NEXT_HOP attribute of the selected route (see Section 5.1.3). If 3519 RFC DRAFT November 2003 3521 either the immediate next hop or the IGP cost to the NEXT_HOP (where 3522 the NEXT_HOP is resolved through an IGP route) changes, Phase 2 Route 3523 Selection MUST be performed again. 3525 Notice that even though BGP routes do not have to be installed in the 3526 Routing Table with the immediate next hop(s), implementations MUST 3527 take care that before any packets are forwarded along a BGP route, 3528 its associated NEXT_HOP address is resolved to the immediate 3529 (directly connected) next-hop address and this address (or multiple 3530 addresses) is finally used for actual packet forwarding. 3532 Unresolvable routes SHALL be removed from the Loc-RIB and the routing 3533 table. However, corresponding unresolvable routes SHOULD be kept in 3534 the Adj-RIBs-In (in case they become resolvable). 3536 9.1.2.1 Route Resolvability Condition 3538 As indicated in Section 9.1.2, BGP speakers SHOULD exclude unresolv- 3539 able routes from the Phase 2 decision. This ensures that only valid 3540 routes are installed in Loc-RIB and the Routing Table. 3542 The route resolvability condition is defined as follows. 3544 1. A route Rte1, referencing only the intermediate network 3545 address, is considered resolvable if the Routing Table contains at 3546 least one resolvable route Rte2 that matches Rte1's intermediate 3547 network address and is not recursively resolved (directly or indi- 3548 rectly) through Rte1. If multiple matching routes are available, 3549 only the longest matching route SHOULD be considered. 3551 2. Routes referencing interfaces (with or without intermediate 3552 addresses) are considered resolvable if the state of the refer- 3553 enced interface is up and IP processing is enabled on this inter- 3554 face. 3556 BGP routes do not refer to interfaces, but can be resolved through 3557 the routes in the Routing Table that can be of both types (those that 3558 specify interfaces or those that do not). IGP routes and routes to 3559 directly connected networks are expected to specify the outbound 3560 interface. Static routes can specify the outbound interface, or the 3561 intermediate address, or both. 3563 Note that a BGP route is considered unresolvable not only in situa- 3564 tions where the BGP speaker's Routing Table contains no route match- 3565 ing the BGP route's NEXT_HOP. Mutually recursive routes (routes 3566 resolving each other or themselves), also fail the resolvability 3567 RFC DRAFT November 2003 3569 check. 3571 It is also important that implementations do not consider feasible 3572 routes that would become unresolvable if they were installed in the 3573 Routing Table even if their NEXT_HOPs are resolvable using the cur- 3574 rent contents of the Routing Table (an example of such routes would 3575 be mutually recursive routes). This check ensures that a BGP speaker 3576 does not install in the Routing Table routes that will be removed and 3577 not used by the speaker. Therefore, in addition to local Routing Ta- 3578 ble stability, this check also improves behavior of the protocol in 3579 the network. 3581 Whenever a BGP speaker identifies a route that fails the resolvabil- 3582 ity check because of mutual recursion, an error message SHOULD be 3583 logged. 3585 9.1.2.2 Breaking Ties (Phase 2) 3587 In its Adj-RIBs-In a BGP speaker may have several routes to the same 3588 destination that have the same degree of preference. The local 3589 speaker can select only one of these routes for inclusion in the 3590 associated Loc-RIB. The local speaker considers all routes with the 3591 same degrees of preference, both those received from internal peers, 3592 and those received from external peers. 3594 The following tie-breaking procedure assumes that for each candidate 3595 route all the BGP speakers within an autonomous system can ascertain 3596 the cost of a path (interior distance) to the address depicted by the 3597 NEXT_HOP attribute of the route, and follow the same route selection 3598 algorithm. 3600 The tie-breaking algorithm begins by considering all equally prefer- 3601 able routes to the same destination, and then selects routes to be 3602 removed from consideration. The algorithm terminates as soon as only 3603 one route remains in consideration. The criteria MUST be applied in 3604 the order specified. 3606 Several of the criteria are described using pseudo-code. Note that 3607 the pseudo-code shown was chosen for clarity, not efficiency. It is 3608 not intended to specify any particular implementation. BGP implemen- 3609 tations MAY use any algorithm which produces the same results as 3610 those described here. 3612 a) Remove from consideration all routes which are not tied for 3613 having the smallest number of AS numbers present in their AS_PATH 3614 attributes. Note, that when counting this number, an AS_SET counts 3615 RFC DRAFT November 2003 3617 as 1, no matter how many ASs are in the set. 3619 b) Remove from consideration all routes which are not tied for 3620 having the lowest Origin number in their Origin attribute. 3622 c) Remove from consideration routes with less-preferred 3623 MULTI_EXIT_DISC attributes. MULTI_EXIT_DISC is only comparable 3624 between routes learned from the same neighboring AS (the neighbor- 3625 ing AS is determined from the AS_PATH attribute). Routes which do 3626 not have the MULTI_EXIT_DISC attribute are considered to have the 3627 lowest possible MULTI_EXIT_DISC value. 3629 This is also described in the following procedure: 3631 for m = all routes still under consideration 3632 for n = all routes still under consideration 3633 if (neighborAS(m) == neighborAS(n)) and (MED(n) < MED(m)) 3634 remove route m from consideration 3636 In the pseudo-code above, MED(n) is a function which returns the 3637 value of route n's MULTI_EXIT_DISC attribute. If route n has no 3638 MULTI_EXIT_DISC attribute, the function returns the lowest possi- 3639 ble MULTI_EXIT_DISC value, i.e. 0. 3641 Similarly, neighborAS(n) is a function which returns the neighbor 3642 AS from which the route was received. If the route is learned via 3643 IBGP, and the other IBGP speaker didn't originate the route, it is 3644 the neighbor AS from which the other IBGP speaker learned the 3645 route. If the route is learned via IBGP, and the other IBGP 3646 speaker either (a) originated the route, or (b) created the route 3647 by aggregation and the AS_PATH attribute of the aggregate route is 3648 either empty or begins with an AS_SET, it is the local AS. 3650 If a MULTI_EXIT_DISC attribute is removed before re-advertising a 3651 route into IBGP, then comparison based on the received EBGP 3652 MULTI_EXIT_DISC attribute MAY still be performed. If an implemen- 3653 tation chooses to remove MULTI_EXIT_DISC, then the optional com- 3654 parison on MULTI_EXIT_DISC if performed at all MUST be performed 3655 only among EBGP learned routes. The best EBGP learned route may 3656 then be compared with IBGP learned routes after the removal of the 3657 MULTI_EXIT_DISC attribute. If MULTI_EXIT_DISC is removed from a 3658 subset of EBGP learned routes and the selected "best" EBGP learned 3659 route will not have MULTI_EXIT_DISC removed, then the 3660 MULTI_EXIT_DISC must be used in the comparison with IBGP learned 3661 routes. For IBGP learned routes the MULTI_EXIT_DISC MUST be used 3662 in route comparisons which reach this step in the Decision Pro- 3663 cess. Including the MULTI_EXIT_DISC of an EBGP learned route in 3664 the comparison with an IBGP learned route, then removing the 3665 RFC DRAFT November 2003 3667 MULTI_EXIT_DISC attribute and advertising the route has been 3668 proven to cause route loops. 3670 d) If at least one of the candidate routes was received via EBGP, 3671 remove from consideration all routes which were received via IBGP. 3673 e) Remove from consideration any routes with less-preferred inte- 3674 rior cost. The interior cost of a route is determined by calcu- 3675 lating the metric to the NEXT_HOP for the route using the Routing 3676 Table. If the NEXT_HOP hop for a route is reachable, but no cost 3677 can be determined, then this step should be skipped (equivalently, 3678 consider all routes to have equal costs). 3680 This is also described in the following procedure. 3682 for m = all routes still under consideration 3683 for n = all routes in still under consideration 3684 if (cost(n) is lower than cost(m)) 3685 remove m from consideration 3687 In the pseudo-code above, cost(n) is a function which returns the 3688 cost of the path (interior distance) to the address given in the 3689 NEXT_HOP attribute of the route. 3691 f) Remove from consideration all routes other than the route that 3692 was advertised by the BGP speaker whose BGP Identifier has the 3693 lowest value. 3695 g) Prefer the route received from the lowest peer address. 3697 9.1.3 Phase 3: Route Dissemination 3699 The Phase 3 decision function is invoked on completion of Phase 2, or 3700 when any of the following events occur: 3702 a) when routes in the Loc-RIB to local destinations have changed 3704 b) when locally generated routes learned by means outside of BGP 3705 have changed 3707 c) when a new BGP speaker - BGP speaker connection has been estab- 3708 lished 3710 The Phase 3 function is a separate process which completes when it 3711 has no further work to do. The Phase 3 Routing Decision function is 3712 blocked from running while the Phase 2 decision function is in 3713 RFC DRAFT November 2003 3715 process. 3717 All routes in the Loc-RIB are processed into Adj-RIBs-Out according 3718 to configured policy. This policy MAY exclude a route in the Loc-RIB 3719 from being installed in a particular Adj-RIB-Out. A route SHALL NOT 3720 be installed in the Adj-Rib-Out unless the destination and NEXT_HOP 3721 described by this route may be forwarded appropriately by the Routing 3722 Table. If a route in Loc-RIB is excluded from a particular Adj-RIB- 3723 Out the previously advertised route in that Adj-RIB-Out MUST be with- 3724 drawn from service by means of an UPDATE message (see 9.2). 3726 Route aggregation and information reduction techniques (see 9.2.2.1) 3727 may optionally be applied. 3729 Any local policy which results in routes being added to an Adj-RIB- 3730 Out without also being added to the local BGP speaker's forwarding 3731 table, is outside the scope of this document. 3733 When the updating of the Adj-RIBs-Out and the Routing Table is com- 3734 plete, the local BGP speaker runs the Update-Send process of 9.2. 3736 9.1.4 Overlapping Routes 3738 A BGP speaker may transmit routes with overlapping Network Layer 3739 Reachability Information (NLRI) to another BGP speaker. NLRI overlap 3740 occurs when a set of destinations are identified in non-matching mul- 3741 tiple routes. Since BGP encodes NLRI using IP prefixes, overlap will 3742 always exhibit subset relationships. A route describing a smaller 3743 set of destinations (a longer prefix) is said to be more specific 3744 than a route describing a larger set of destinations (a shorter pre- 3745 fix); similarly, a route describing a larger set of destinations is 3746 said to be less specific than a route describing a smaller set of 3747 destinations. 3749 The precedence relationship effectively decomposes less specific 3750 routes into two parts: 3752 - a set of destinations described only by the less specific route, 3753 and 3755 - a set of destinations described by the overlap of the less spe- 3756 cific and the more specific routes 3758 The set of destinations described by the overlap represents a portion 3759 of the less specific route that is feasible, but is not currently in 3760 RFC DRAFT November 2003 3762 use. If a more specific route is later withdrawn, the set of desti- 3763 nations described by the overlap will still be reachable using the 3764 less specific route. 3766 If a BGP speaker receives overlapping routes, the Decision Process 3767 MUST consider both routes based on the configured acceptance policy. 3768 If both a less and a more specific route are accepted, then the Deci- 3769 sion Process MUST either install in Loc-RIB both the less and the 3770 more specific routes or it MUST aggregate the two routes and install 3771 in Loc-RIB the aggregated route, provided that both routes have the 3772 same value of the NEXT_HOP attribute. 3774 If a BGP speaker chooses to aggregate, then it SHOULD either include 3775 all AS used to form the aggregate in an AS_SET or add the 3776 ATOMIC_AGGREGATE attribute to the route. This attribute is now pri- 3777 marily informational. With the elimination of IP routing protocols 3778 that do not support classless routing and the elimination of router 3779 and host implementations that do not support classless routing, there 3780 is no longer a need to de-aggregate. Routes SHOULD NOT be de-aggre- 3781 gated. A route that carries ATOMIC_AGGREGATE attribute in particular 3782 MUST NOT be de-aggregated. That is, the NLRI of this route can not be 3783 made more specific. Forwarding along such a route does not guarantee 3784 that IP packets will actually traverse only ASs listed in the AS_PATH 3785 attribute of the route. 3787 9.2 Update-Send Process 3789 The Update-Send process is responsible for advertising UPDATE mes- 3790 sages to all peers. For example, it distributes the routes chosen by 3791 the Decision Process to other BGP speakers which may be located in 3792 either the same autonomous system or a neighboring autonomous system. 3794 When a BGP speaker receives an UPDATE message from an internal peer, 3795 the receiving BGP speaker SHALL NOT re-distribute the routing infor- 3796 mation contained in that UPDATE message to other internal peers 3797 (unless the speaker acts as a BGP Route Reflector [RFC2796]). 3799 As part of Phase 3 of the route selection process, the BGP speaker 3800 has updated its Adj-RIBs-Out. All newly installed routes and all 3801 newly unfeasible routes for which there is no replacement route SHALL 3802 be advertised to its peers by means of an UPDATE message. 3804 A BGP speaker SHOULD NOT advertise a given feasible BGP route from 3805 its Adj-RIB-Out if it would produce an UPDATE message containing the 3806 same BGP route as was previously advertised. 3808 RFC DRAFT November 2003 3810 Any routes in the Loc-RIB marked as unfeasible SHALL be removed. 3811 Changes to the reachable destinations within its own autonomous sys- 3812 tem SHALL also be advertised in an UPDATE message. 3814 If due to the limits on the maximum size of an UPDATE message (see 3815 Section 4) a single route doesn't fit into the message, the BGP 3816 speaker MUST not advertise the route to its peers and MAY choose to 3817 log an error locally. 3819 9.2.1 Controlling Routing Traffic Overhead 3821 The BGP protocol constrains the amount of routing traffic (that is, 3822 UPDATE messages) in order to limit both the link bandwidth needed to 3823 advertise UPDATE messages and the processing power needed by the 3824 Decision Process to digest the information contained in the UPDATE 3825 messages. 3827 9.2.1.1 Frequency of Route Advertisement 3829 The parameter MinRouteAdvertisementIntervalTimer determines the mini- 3830 mum amount of time that must elapse between advertisement and/or 3831 withdrawal of routes to a particular destination by a BGP speaker to 3832 a peer. This rate limiting procedure applies on a per-destination 3833 basis, although the value of MinRouteAdvertisementIntervalTimer is 3834 set on a per BGP peer basis. 3836 Two UPDATE messages sent by a BGP speaker to a peer that advertise 3837 feasible routes and/or withdrawal of unfeasible routes to some common 3838 set of destinations MUST be separated by at least MinRouteAdvertise- 3839 mentIntervalTimer. Clearly, this can only be achieved precisely by 3840 keeping a separate timer for each common set of destinations. This 3841 would be unwarranted overhead. Any technique which ensures that the 3842 interval between two UPDATE messages sent from a BGP speaker to a 3843 peer that advertise feasible routes and/or withdrawal of unfeasible 3844 routes to some common set of destinations will be at least Min- 3845 RouteAdvertisementIntervalTimer, and will also ensure a constant 3846 upper bound on the interval is acceptable. 3848 Since fast convergence is needed within an autonomous system, either 3849 (a) the MinRouteAdvertisementIntervalTimer used for internal peers 3850 SHOULD be shorter than the MinRouteAdvertisementIntervalTimer used 3851 for external peers, or (b) the procedure describe in this section 3852 RFC DRAFT November 2003 3854 SHOULD NOT apply for routes sent to internal peers. 3856 This procedure does not limit the rate of route selection, but only 3857 the rate of route advertisement. If new routes are selected multiple 3858 times while awaiting the expiration of MinRouteAdvertisementInterval- 3859 Timer, the last route selected SHALL be advertised at the end of Min- 3860 RouteAdvertisementIntervalTimer. 3862 9.2.1.2 Frequency of Route Origination 3864 The parameter MinASOriginationIntervalTimer determines the minimum 3865 amount of time that must elapse between successive advertisements of 3866 UPDATE messages that report changes within the advertising BGP 3867 speaker's own autonomous systems. 3869 9.2.2 Efficient Organization of Routing Information 3871 Having selected the routing information which it will advertise, a 3872 BGP speaker may avail itself of several methods to organize this 3873 information in an efficient manner. 3875 9.2.2.1 Information Reduction 3877 Information reduction may imply a reduction in granularity of policy 3878 control - after information is collapsed, the same policies will 3879 apply to all destinations and paths in the equivalence class. 3881 The Decision Process may optionally reduce the amount of information 3882 that it will place in the Adj-RIBs-Out by any of the following meth- 3883 ods: 3885 a) Network Layer Reachability Information (NLRI): 3887 Destination IP addresses can be represented as IP address pre- 3888 fixes. In cases where there is a correspondence between the 3889 address structure and the systems under control of an autonomous 3890 system administrator, it will be possible to reduce the size of 3891 the NLRI carried in the UPDATE messages. 3893 b) AS_PATHs: 3895 AS path information can be represented as ordered AS_SEQUENCEs or 3896 RFC DRAFT November 2003 3898 unordered AS_SETs. AS_SETs are used in the route aggregation algo- 3899 rithm described in 9.2.2.2. They reduce the size of the AS_PATH 3900 information by listing each AS number only once, regardless of how 3901 many times it may have appeared in multiple AS_PATHs that were 3902 aggregated. 3904 An AS_SET implies that the destinations listed in the NLRI can be 3905 reached through paths that traverse at least some of the con- 3906 stituent autonomous systems. AS_SETs provide sufficient informa- 3907 tion to avoid routing information looping; however their use may 3908 prune potentially feasible paths, since such paths are no longer 3909 listed individually as in the form of AS_SEQUENCEs. In practice 3910 this is not likely to be a problem, since once an IP packet 3911 arrives at the edge of a group of autonomous systems, the BGP 3912 speaker at that point is likely to have more detailed path infor- 3913 mation and can distinguish individual paths to destinations. 3915 9.2.2.2 Aggregating Routing Information 3917 Aggregation is the process of combining the characteristics of sev- 3918 eral different routes in such a way that a single route can be adver- 3919 tised. Aggregation can occur as part of the Decision Process to 3920 reduce the amount of routing information that will be placed in the 3921 Adj-RIBs-Out. 3923 Aggregation reduces the amount of information that a BGP speaker must 3924 store and exchange with other BGP speakers. Routes can be aggregated 3925 by applying the following procedure separately to path attributes of 3926 the same type and to the Network Layer Reachability Information. 3928 Routes that have different MULTI_EXIT_DISC attribute SHALL NOT be 3929 aggregated. 3931 If the aggregated route has an AS_SET as the first element in its 3932 AS_PATH attribute, then the router that originates the route SHOULD 3933 NOT advertise the MULTI_EXIT_DISC attribute with this route. 3935 Path attributes that have different type codes can not be aggregated 3936 together. Path attributes of the same type code may be aggregated, 3937 according to the following rules: 3939 NEXT_HOP: 3940 When aggregating routes that have different NEXT_HOP attribute, 3941 the NEXT_HOP attribute of the aggregated route SHALL identify 3942 an interface on the BGP speaker that performs the aggregation. 3944 RFC DRAFT November 2003 3946 ORIGIN attribute: 3947 If at least one route among routes that are aggregated has ORI- 3948 GIN with the value INCOMPLETE, then the aggregated route MUST 3949 have the ORIGIN attribute with the value INCOMPLETE. Other- 3950 wise, if at least one route among routes that are aggregated 3951 has ORIGIN with the value EGP, then the aggregated route MUST 3952 have the ORIGIN attribute with the value EGP. In all other 3953 cases the value of the ORIGIN attribute of the aggregated route 3954 is IGP. 3956 AS_PATH attribute: 3957 If routes to be aggregated have identical AS_PATH attributes, 3958 then the aggregated route has the same AS_PATH attribute as 3959 each individual route. 3961 For the purpose of aggregating AS_PATH attributes we model each 3962 AS within the AS_PATH attribute as a tuple , where 3963 "type" identifies a type of the path segment the AS belongs to 3964 (e.g. AS_SEQUENCE, AS_SET), and "value" is the AS number. If 3965 the routes to be aggregated have different AS_PATH attributes, 3966 then the aggregated AS_PATH attribute SHALL satisfy all of the 3967 following conditions: 3969 - all tuples of type AS_SEQUENCE in the aggregated AS_PATH 3970 SHALL appear in all of the AS_PATH in the initial set of 3971 routes to be aggregated. 3973 - all tuples of type AS_SET in the aggregated AS_PATH SHALL 3974 appear in at least one of the AS_PATH in the initial set 3975 (they may appear as either AS_SET or AS_SEQUENCE types). 3977 - for any tuple X of type AS_SEQUENCE in the aggregated 3978 AS_PATH which precedes tuple Y in the aggregated AS_PATH, X 3979 precedes Y in each AS_PATH in the initial set which contains 3980 Y, regardless of the type of Y. 3982 - No tuple of type AS_SET with the same value SHALL appear 3983 more than once in the aggregated AS_PATH. 3985 - Multiple tuples of type AS_SEQUENCE with the same value 3986 may appear in the aggregated AS_PATH only when adjacent to 3987 another tuple of the same type and value. 3989 An implementation may choose any algorithm which conforms to 3990 these rules. At a minimum a conformant implementation SHALL be 3991 able to perform the following algorithm that meets all of the 3992 above conditions: 3994 RFC DRAFT November 2003 3996 - determine the longest leading sequence of tuples (as 3997 defined above) common to all the AS_PATH attributes of the 3998 routes to be aggregated. Make this sequence the leading 3999 sequence of the aggregated AS_PATH attribute. 4001 - set the type of the rest of the tuples from the AS_PATH 4002 attributes of the routes to be aggregated to AS_SET, and 4003 append them to the aggregated AS_PATH attribute. 4005 - if the aggregated AS_PATH has more than one tuple with the 4006 same value (regardless of tuple's type), eliminate all, but 4007 one such tuple by deleting tuples of the type AS_SET from 4008 the aggregated AS_PATH attribute. 4010 - for each pair of adjacent tuples in the aggregated 4011 AS_PATH, if both tuples have the same type, merge them 4012 together, as long as doing so will not cause a segment with 4013 length greater than 255 to be generated. 4015 Appendix F, Section F.6 presents another algorithm that satis- 4016 fies the conditions and allows for more complex policy configu- 4017 rations. 4019 ATOMIC_AGGREGATE: 4020 If at least one of the routes to be aggregated has 4021 ATOMIC_AGGREGATE path attribute, then the aggregated route 4022 SHALL have this attribute as well. 4024 AGGREGATOR: 4025 Any AGGREGATOR attributes from the routes to be aggregated MUST 4026 NOT be included in the aggregated route. The BGP speaker per- 4027 forming the route aggregation MAY attach a new AGGREGATOR 4028 attribute (see Section 5.1.7). 4030 9.3 Route Selection Criteria 4032 Generally speaking, additional rules for comparing routes among sev- 4033 eral alternatives are outside the scope of this document. There are 4034 two exceptions: 4036 - If the local AS appears in the AS path of the new route being 4037 considered, then that new route can not be viewed as better than 4038 any other route (provided that the speaker is configured to accept 4039 such routes). If such a route were ever used, a routing loop could 4040 result. 4042 RFC DRAFT November 2003 4044 - In order to achieve successful distributed operation, only 4045 routes with a likelihood of stability can be chosen. Thus, an AS 4046 SHOULD avoid using unstable routes, and it SHOULD NOT make rapid 4047 spontaneous changes to its choice of route. Quantifying the terms 4048 "unstable" and "rapid" in the previous sentence will require expe- 4049 rience, but the principle is clear. Routes that are unstable can 4050 be "penalized" (e.g., by using the procedures described in 4051 [RFC2439]). 4053 9.4 Originating BGP routes 4055 A BGP speaker may originate BGP routes by injecting routing informa- 4056 tion acquired by some other means (e.g. via an IGP) into BGP. A BGP 4057 speaker that originates BGP routes assigns the degree of preference 4058 (e.g., according to local configuration) to these routes by passing 4059 them through the Decision Process (see Section 9.1). These routes MAY 4060 also be distributed to other BGP speakers within the local AS as part 4061 of the update process (see Section 9.2). The decision whether to dis- 4062 tribute non-BGP acquired routes within an AS via BGP or not depends 4063 on the environment within the AS (e.g. type of IGP) and SHOULD be 4064 controlled via configuration. 4066 10 BGP Timers 4068 BGP employs five timers: ConnectRetryTimer (see Section 8), HoldTimer 4069 (see Section 4.2), KeepaliveTimer (see Section 8), MinASOrigination- 4070 IntervalTimer (see Section 9.2.1.2), and MinRouteAdvertisementInter- 4071 valTimer (see Section 9.2.1.1). 4073 Two optional timers MAY be supported: DelayOpenTimer, IdleHoldTimer 4074 by BGP (see section 8). Section 8 describes their use. The full oper- 4075 ation of these optional timers is outside the scope of this document. 4077 ConnectRetryTime is a mandatory FSM attribute that stores the initial 4078 value for the ConnectRetryTimer. The suggested default value for the 4079 ConnectRetryTime is 120 seconds. 4081 HoldTime is a mandatory FSM attribute that stores the initial value 4082 for the HoldTimer. The suggested default value for the HoldTime is 90 4083 seconds. 4085 During some portions of the state machine (see Section 8), the Hold- 4086 Timer is set to a large value. The suggested default for this large 4087 value is 4 minutes. 4089 RFC DRAFT November 2003 4091 The KeepaliveTime is a mandatory FSM attribute that stores the ini- 4092 tial value for the KeepaliveTimer. The suggested default value for 4093 the KeepaliveTime is 1/3 of the HoldTime. 4095 The suggested default value for the MinASOriginationIntervalTimer is 4096 15 seconds. 4098 The suggested default value for the MinRouteAdvertisementInterval- 4099 Timer on EBGP connections is 30 seconds. 4101 The suggested default value for the MinRouteAdvertisementInterval- 4102 Timer on IBGP connections is 5 seconds. 4104 An implementation of BGP MUST allow the HoldTimer to be configurable 4105 on a per peer basis, and MAY allow the other timers to be config- 4106 urable. 4108 To minimize the likelihood that the distribution of BGP messages by a 4109 given BGP speaker will contain peaks, jitter SHOULD be applied to the 4110 timers associated with MinASOriginationIntervalTimer, KeepaliveTimer, 4111 MinRouteAdvertisementIntervalTimer, and ConnectRetryTimer. A given 4112 BGP speaker MAY apply the same jitter to each of these quantities 4113 regardless of the destinations to which the updates are being sent; 4114 that is, jitter need not be configured on a "per peer" basis. 4116 The suggested default amount of jitter SHALL be determined by multi- 4117 plying the base value of the appropriate timer by a random factor 4118 which is uniformly distributed in the range from 0.75 to 1.0. A new 4119 random value SHOULD be picked each time the timer is set. The range 4120 of the jitter random value MAY be configurable. 4122 Appendix A. Comparison with RFC1771 4124 There are numerous editorial changes (too many to list here). 4126 The following list the technical changes: 4128 Changes to reflect the usages of such features as TCP MD5 4129 [RFC2385], BGP Route Reflectors [RFC2796], BGP Confederations 4130 [RFC3065], and BGP Route Refresh [RFC2918]. 4132 Clarification on the use of the BGP Identifier in the AGGREGATOR 4133 attribute. 4135 Procedures for imposing an upper bound on the number of prefixes 4136 that a BGP speaker would accept from a peer. 4138 RFC DRAFT November 2003 4140 The ability of a BGP speaker to include more than one instance of 4141 its own AS in the AS_PATH attribute for the purpose of inter-AS 4142 traffic engineering. 4144 Clarifications on the various types of NEXT_HOPs. 4146 Clarifications to the use of the ATOMIC_AGGREGATE attribute. 4148 The relationship between the immediate next hop, and the next hop 4149 as specified in the NEXT_HOP path attribute. 4151 Clarifications on the tie-breaking procedures. 4153 Clarifications on the frequency of route advertisements. 4155 Optional Parameter Type 1 (Authentication Information) has been 4156 deprecated. 4158 UPDATE Message Error subcode 7 (AS Routing Loop) has been depre- 4159 cated. 4161 OPEN Message Error subcode 5 (Authentication Failure) has been 4162 deprecated. 4164 Use of the Marker field for authentication has been deprecated. 4166 Implementations MUST support TCP MD5 [RFC2385] for authentication. 4168 Clarification of BGP FSM. 4170 Appendix B. Comparison with RFC1267 4172 All the changes listed in Appendix A, plus the following. 4174 BGP-4 is capable of operating in an environment where a set of reach- 4175 able destinations may be expressed via a single IP prefix. The con- 4176 cept of network classes, or subnetting is foreign to BGP-4. To 4177 accommodate these capabilities BGP-4 changes semantics and encoding 4178 associated with the AS_PATH attribute. New text has been added to 4179 define semantics associated with IP prefixes. These abilities allow 4180 BGP-4 to support the proposed supernetting scheme [9]. 4182 To simplify configuration this version introduces a new attribute, 4183 LOCAL_PREF, that facilitates route selection procedures. 4185 The INTER_AS_METRIC attribute has been renamed to be MULTI_EXIT_DISC. 4187 RFC DRAFT November 2003 4189 A new attribute, ATOMIC_AGGREGATE, has been introduced to insure that 4190 certain aggregates are not de-aggregated. Another new attribute, 4191 AGGREGATOR, can be added to aggregate routes in order to advertise 4192 which AS and which BGP speaker within that AS caused the aggregation. 4194 To insure that Hold Timers are symmetric, the Hold Timer is now nego- 4195 tiated on a per-connection basis. Hold Timers of zero are now sup- 4196 ported. 4198 Appendix C. Comparison with RFC 1163 4200 All of the changes listed in Appendices A and B, plus the following. 4202 To detect and recover from BGP connection collision, a new field (BGP 4203 Identifier) has been added to the OPEN message. New text (Section 4204 6.8) has been added to specify the procedure for detecting and recov- 4205 ering from collision. 4207 The new document no longer restricts the router that is passed in the 4208 NEXT_HOP path attribute to be part of the same Autonomous System as 4209 the BGP Speaker. 4211 New document optimizes and simplifies the exchange of the information 4212 about previously reachable routes. 4214 Appendix D. Comparison with RFC 1105 4216 All of the changes listed in Appendices A, B and C, plus the follow- 4217 ing. 4219 Minor changes to the RFC1105 Finite State Machine were necessary to 4220 accommodate the TCP user interface provided by 4.3 BSD. 4222 The notion of Up/Down/Horizontal relations present in RFC1105 has 4223 been removed from the protocol. 4225 The changes in the message format from RFC1105 are as follows: 4227 1. The Hold Time field has been removed from the BGP header and 4228 added to the OPEN message. 4230 2. The version field has been removed from the BGP header and 4231 added to the OPEN message. 4233 3. The Link Type field has been removed from the OPEN message. 4235 RFC DRAFT November 2003 4237 4. The OPEN CONFIRM message has been eliminated and replaced with 4238 implicit confirmation provided by the KEEPALIVE message. 4240 5. The format of the UPDATE message has been changed signifi- 4241 cantly. New fields were added to the UPDATE message to support 4242 multiple path attributes. 4244 6. The Marker field has been expanded and its role broadened to 4245 support authentication. 4247 Note that quite often BGP, as specified in RFC 1105, is referred 4248 to as BGP-1, BGP, as specified in RFC 1163, is referred to as 4249 BGP-2, BGP, as specified in RFC1267 is referred to as BGP-3, and 4250 BGP, as specified in this document is referred to as BGP-4. 4252 Appendix E. TCP options that may be used with BGP 4254 If a local system TCP user interface supports TCP PUSH function, then 4255 each BGP message SHOULD be transmitted with PUSH flag set. Setting 4256 PUSH flag forces BGP messages to be transmitted promptly to the 4257 receiver. 4259 If a local system TCP user interface supports setting of the DSCP 4260 field [RFC2474] for TCP connections, then the TCP connection used by 4261 BGP SHOULD be opened with bits 0-2 of the DSCP field set to 110 4262 (binary). 4264 Appendix F. Implementation Recommendations 4266 This section presents some implementation recommendations. 4268 Appendix F.1 Multiple Networks Per Message 4270 The BGP protocol allows for multiple address prefixes with the same 4271 path attributes to be specified in one message. Making use of this 4272 capability is highly recommended. With one address prefix per message 4273 there is a substantial increase in overhead in the receiver. Not only 4274 does the system overhead increase due to the reception of multiple 4275 messages, but the overhead of scanning the routing table for updates 4276 to BGP peers and other routing protocols (and sending the associated 4277 messages) is incurred multiple times as well. 4279 RFC DRAFT November 2003 4281 One method of building messages containing many address prefixes per 4282 a path attribute set from a routing table that is not organized on a 4283 per path attribute set basis is to build many messages as the routing 4284 table is scanned. As each address prefix is processed, a message for 4285 the associated set of path attributes is allocated, if it does not 4286 exist, and the new address prefix is added to it. If such a message 4287 exists, the new address prefix is just appended to it. If the message 4288 lacks the space to hold the new address prefix, it is transmitted, a 4289 new message is allocated, and the new address prefix is inserted into 4290 the new message. When the entire routing table has been scanned, all 4291 allocated messages are sent and their resources released. Maximum 4292 compression is achieved when all the destinations covered by the 4293 address prefixes share a common set of path attributes making it pos- 4294 sible to send many address prefixes in one 4096-byte message. 4296 When peering with a BGP implementation that does not compress multi- 4297 ple address prefixes into one message, it may be necessary to take 4298 steps to reduce the overhead from the flood of data received when a 4299 peer is acquired or a significant network topology change occurs. One 4300 method of doing this is to limit the rate of updates. This will 4301 eliminate the redundant scanning of the routing table to provide 4302 flash updates for BGP peers and other routing protocols. A disadvan- 4303 tage of this approach is that it increases the propagation latency of 4304 routing information. By choosing a minimum flash update interval 4305 that is not much greater than the time it takes to process the multi- 4306 ple messages this latency should be minimized. A better method would 4307 be to read all received messages before sending updates. 4309 Appendix F.2 Reducing route flapping 4311 To avoid excessive route flapping a BGP speaker which needs to with- 4312 draw a destination and send an update about a more specific or less 4313 specific route SHOULD combine them into the same UPDATE message. 4315 Appendix F.3 Path attribute ordering 4317 Implementations which combine update messages as described above in 4318 6.1 may prefer to see all path attributes presented in a known order. 4319 This permits them to quickly identify sets of attributes from differ- 4320 ent update messages which are semantically identical. To facilitate 4321 this, it is a useful optimization to order the path attributes 4322 according to type code. This optimization is entirely optional. 4324 RFC DRAFT November 2003 4326 Appendix F.4 AS_SET sorting 4328 Another useful optimization that can be done to simplify this situa- 4329 tion is to sort the AS numbers found in an AS_SET. This optimization 4330 is entirely optional. 4332 Appendix F.5 Control over version negotiation 4334 Since BGP-4 is capable of carrying aggregated routes which can not be 4335 properly represented in BGP-3, an implementation which supports BGP-4 4336 and another BGP version should provide the capability to only speak 4337 BGP-4 on a per-peer basis. 4339 Appendix F.6 Complex AS_PATH aggregation 4341 An implementation which chooses to provide a path aggregation algo- 4342 rithm which retains significant amounts of path information may wish 4343 to use the following procedure: 4345 For the purpose of aggregating AS_PATH attributes of two routes, 4346 we model each AS as a tuple , where "type" identifies 4347 a type of the path segment the AS belongs to (e.g. AS_SEQUENCE, 4348 AS_SET), and "value" is the AS number. Two ASs are said to be the 4349 same if their corresponding tuples are the same. 4351 The algorithm to aggregate two AS_PATH attributes works as fol- 4352 lows: 4354 a) Identify the same ASs (as defined above) within each AS_PATH 4355 attribute that are in the same relative order within both 4356 AS_PATH attributes. Two ASs, X and Y, are said to be in the 4357 same order if either: 4358 - X precedes Y in both AS_PATH attributes, or - Y precedes X 4359 in both AS_PATH attributes. 4361 b) The aggregated AS_PATH attribute consists of ASs identified 4362 in (a) in exactly the same order as they appear in the AS_PATH 4363 attributes to be aggregated. If two consecutive ASs identified 4364 in (a) do not immediately follow each other in both of the 4365 AS_PATH attributes to be aggregated, then the intervening ASs 4366 (ASs that are between the two consecutive ASs that are the 4367 same) in both attributes are combined into an AS_SET path seg- 4368 ment that consists of the intervening ASs from both AS_PATH 4369 RFC DRAFT November 2003 4371 attributes; this segment is then placed in between the two con- 4372 secutive ASs identified in (a) of the aggregated attribute. If 4373 two consecutive ASs identified in (a) immediately follow each 4374 other in one attribute, but do not follow in another, then the 4375 intervening ASs of the latter are combined into an AS_SET path 4376 segment; this segment is then placed in between the two consec- 4377 utive ASs identified in (a) of the aggregated attribute. 4379 c) For each pair of adjacent tuples in the aggregated AS_PATH, 4380 if both tuples have the same type, merge them together, as long 4381 as doing so will not cause a segment with length greater than 4382 255 to be generated. 4384 If as a result of the above procedure a given AS number appears 4385 more than once within the aggregated AS_PATH attribute, all, but 4386 the last instance (rightmost occurrence) of that AS number SHOULD 4387 be removed from the aggregated AS_PATH attribute. 4389 Security Considerations 4391 The authentication mechanism that an implementation of BGP MUST sup- 4392 port is specified in [RFC2385]. The authentication provided by this 4393 mechanism could be done on a per peer basis. 4395 BGP vulnerabilities analysis is discussed in [BGP_VULN]. 4397 IANA Considerations 4399 All new BGP message types, Path Attributes Type codes, Message Header 4400 Error subcodes, OPEN Message Error subcodes, and UPDATE Message Error 4401 subcodes MUST only be made using the Standards Action process defined 4402 in [RFC2434]. 4404 This document defines the following message types: OPEN, UPDATE, 4405 KEEPALIVE, NOTIFICATION. 4407 This document defines the following Path Attributes Type codes: ORI- 4408 GIN, AS_PATH, NEXT_HOP, MULTI_EXIT_DISC, LOCAL_PREF, ATOMIC_AGGRE- 4409 GATE, AGGREGATOR. 4411 This document defines the following Message Header Error subcodes: 4412 Connection Not Synchronized, Bad Message Length, Bad Message Type. 4414 This document defines the following OPEN Message Error subcodes: 4416 RFC DRAFT November 2003 4418 Unsupported Version Number, Bad Peer AS, Bad BGP Identifier, Unsup- 4419 ported Optional Parameter, Unacceptable Hold Time. 4421 This document defines the following UPDATE Message Error subcodes: 4422 Malformed Attribute List, Unrecognized Well-known Attribute, Missing 4423 Well-known Attribute, Attribute Flags Error, Attribute Length Error, 4424 Invalid ORIGIN Attribute, Invalid NEXT_HOP Attribute, Optional 4425 Attribute Error, Invalid Network Field, Malformed AS_PATH. 4427 IPR Notice 4429 The IETF has been notified of intellectual property rights claimed in 4430 regard to some or all of the specification contained in this docu- 4431 ment. For more information consult the online list of claimed rights. 4433 The IETF takes no position regarding the validity or scope of any 4434 intellectual property or other rights that might be claimed to per- 4435 tain to the implementation or use of the technology described in this 4436 document or the extent to which any license under such rights might 4437 or might not be available; neither does it represent that it has made 4438 any effort to identify any such rights. Information on the IETF's 4439 procedures with respect to rights in standards-track and standards- 4440 related documentation can be found in BCP-11. Copies of claims of 4441 rights made available for publication and any assurances of licenses 4442 to be made available, or the result of an attempt made to obtain a 4443 general license or permission for the use of such proprietary rights 4444 by implementors or users of this specification can be obtained from 4445 the IETF Secretariat. 4447 The IETF invites any interested party to bring to its attention any 4448 copyrights, patents or patent applications, or other proprietary 4449 rights which may cover technology that may be required to practice 4450 this standard. Please address the information to the IETF Executive 4451 Director. 4453 Full Copyright Notice 4455 Copyright (C) The Internet Society (2003). All Rights Reserved. 4457 This document and translations of it may be copied and furnished to 4458 others, and derivative works that comment on or otherwise explain it 4459 or assist in its implementation may be prepared, copied, published 4460 and distributed, in whole or in part, without restriction of any 4461 RFC DRAFT November 2003 4463 kind, provided that the above copyright notice and this paragraph are 4464 included on all such copies and derivative works. However, this doc- 4465 ument itself may not be modified in any way, such as by removing the 4466 copyright notice or references to the Internet Society or other 4467 Internet organizations, except as needed for the purpose of develop- 4468 ing Internet standards in which case the procedures for copyrights 4469 defined in the Internet Standards process must be followed, or as 4470 required to translate it into languages other than English. 4472 The limited permissions granted above are perpetual and will not be 4473 revoked by the Internet Society or its successors or assigns. 4475 This document and the information contained herein is provided on an 4476 "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING 4477 TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING 4478 BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION 4479 HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MER- 4480 CHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE." 4482 Normative References 4484 [RFC791] Postel, J., "Internet Protocol - DARPA Internet Program Pro- 4485 tocol Specification", RFC791, September 1981. 4487 [RFC793] Postel, J., "Transmission Control Protocol - DARPA Internet 4488 Program Protocol Specification", RFC793, September 1981. 4490 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 4491 Requirement Levels", BCP 14, RFC 2119, March 1997. 4493 [RFC2385] Heffernan, A., "Protection of BGP Sessions via the TCP MD5 4494 Signature Option", RFC2385, August 1998. 4496 [RFC2434] Narten, T., Alvestrand, H., "Guidelines for Writing an IANA 4497 Considerations Section in RFCs", RFC2434, October 1998 4499 [RFC2474] Nichols, K., et al.,"Definition of the Differentiated Ser- 4500 vices Field (DS Field) in the IPv4 and IPv6 Headers", RFC2474, Decem- 4501 ber 1998 4503 Non-normative References 4505 [RFC904] Mills, D., "Exterior Gateway Protocol Formal Specification", 4506 RFC904, April 1984. 4508 RFC DRAFT November 2003 4510 [RFC1092] Rekhter, Y., "EGP and Policy Based Routing in the New 4511 NSFNET Backbone", RFC1092, February 1989. 4513 [RFC1093] Braun, H-W., "The NSFNET Routing Architecture", RFC1093, 4514 February 1989. 4516 [RFC1772] Rekhter, Y., and P. Gross, "Application of the Border Gate- 4517 way Protocol in the Internet", RFC1772, March 1995. 4519 [RFC1518] Rekhter, Y., Li, T., "An Architecture for IP Address Allo- 4520 cation with CIDR", RFC 1518, September 1993. 4522 [RFC1519] Fuller, V., Li, T., Yu, J., and Varadhan, K., ""Classless 4523 Inter-Domain Routing (CIDR): an Address Assignment and Aggregation 4524 Strategy", RFC1519, September 1993. 4526 [RFC1997] R. Chandra, P. Traina, T. Li, "BGP Communities Attribute", 4527 RFC 1997, August 1996. 4529 [RFC2439] C. Villamizar, R. Chandra, R. Govindan, "BGP Route Flap 4530 Damping", RFC2439, November 1998. 4532 [RFC2796] Bates, T., Chandra, R., Chen, E., "BGP Route Reflection - 4533 An Alternative to Full Mesh IBGP", RFC2796, April 2000. 4535 [RFC3392] R. Chandra, J. Scudder, "Capabilities Advertisement with 4536 BGP-4", RFC2842. 4538 [RFC2858] T. Bates, R. Chandra, D. Katz, Y. Rekhter, "Multiprotocol 4539 Extensions for BGP-4", RFC2858. 4541 [RFC2918] Chen, E., "Route Refresh Capability for BGP-4", RFC2918, 4542 September 2000. 4544 [RFC3065] Traina, P, McPherson, D., Scudder, J., "Autonomous System 4545 Confederations for BGP", RFC3065, February 2001. 4547 [IS10747] "Information Processing Systems - Telecommunications and 4548 Information Exchange between Systems - Protocol for Exchange of 4549 Inter-domain Routeing Information among Intermediate Systems to Sup- 4550 port Forwarding of ISO 8473 PDUs", ISO/IEC IS10747, 1993 4552 [BGP_VULN] Murphy, S., "BGP Security Vulnerabilities Analysis", 4553 draft-ietf-idr-bgp-vuln-00.txt, work in progress 4554 RFC DRAFT November 2003 4556 Editors' Addresses 4558 Yakov Rekhter 4559 Juniper Networks 4560 email: yakov@juniper.net 4562 Tony Li 4563 Procket Networks, Inc. 4564 email: tli@procket.com 4566 Susan Hares 4568 NextHop Technologies, Inc. 4569 email: skh@nexthop.com