idnits 2.17.1 draft-ietf-idr-bgp4-24.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 98 longer pages, the longest (page 2) being 61 lines Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There are 98 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 397 has weird spacing: '...setting any B...' == Line 2192 has weird spacing: '... system autom...' == Line 3118 has weird spacing: '...rom the under...' == Line 4298 has weird spacing: '...hen all the d...' == Line 4444 has weird spacing: '...y, each key a...' -- 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 1382, but not defined -- Looks like a reference, but probably isn't: '9' on line 4184 == Unused Reference: 'RFC1772' is defined on line 4577, but no explicit reference was found in the text == Unused Reference: 'RFC1997' is defined on line 4587, but no explicit reference was found in the text == Unused Reference: 'RFC2858' is defined on line 4599, 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 (~~), 17 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 T.Li 3 S. Hares 4 Editors 6 A Border Gateway Protocol 4 (BGP-4) 7 9 Status of this Memo 11 This document is an Internet-Draft and is in full conformance with 12 all provisions of Section 10 of RFC2026. 14 Internet-Drafts are working documents of the Internet Engineering 15 Task Force (IETF), its areas, and its working groups. Note that 16 other groups may also distribute working documents as Internet- 17 Drafts. 19 Internet-Drafts are draft documents valid for a maximum of six months 20 and may be updated, replaced, or obsoleted by other documents at any 21 time. It is inappropriate to use Internet-Drafts as reference 22 material or to cite them other than as ``work in progress.'' 24 The list of current Internet-Drafts can be accessed at 25 http://www.ietf.org/ietf/1id-abstracts.txt 27 The list of Internet-Draft Shadow Directories can be accessed at 28 http://www.ietf.org/shadow.html. 30 Copyright Notice 32 Copyright (C) The Internet Society (2003). All Rights Reserved. 34 Abstract 36 The Border Gateway Protocol (BGP) is an inter-Autonomous System 37 routing protocol. 39 The primary function of a BGP speaking system is to exchange network 40 reachability information with other BGP systems. This network 41 reachability information includes information on the list of 42 RFC DRAFT November 2003 44 Autonomous Systems (ASs) that reachability information traverses. 45 This information is sufficient to construct a graph of AS 46 connectivity for this reachability from which routing loops may be 47 pruned and some policy decisions at the AS level may be enforced. 49 BGP-4 provides a set of mechanisms for supporting Classless Inter- 50 Domain Routing (CIDR) [RFC1518, RFC1519]. These mechanisms include 51 support for advertising a set of destinations as an IP prefix, and 52 eliminating the concept of network "class" within BGP. BGP-4 also 53 introduces mechanisms which allow aggregation of routes, including 54 aggregation of AS paths. 56 Routing information exchanged via BGP supports only the destination- 57 based forwarding paradigm, which assumes that a router forwards a 58 packet based solely on the destination address carried in the IP 59 header of the packet. This, in turn, reflects the set of policy 60 decisions that can (and can not) be enforced using BGP. BGP can 61 support only the policies conforming to the destination-based 62 forwarding paradigm. 64 This specification covers only the exchange of IP version 4 network 65 reachability information. 67 RFC DRAFT November 2003 69 Table of Contents 71 1. Definition of commonly used terms . . . . . . . . . . . . . . 5 72 2. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 7 73 Specification of Requirements . . . . . . . . . . . . . . . . . . 8 74 3. Summary of Operation . . . . . . . . . . . . . . . . . . . . . 8 75 3.1 Routes: Advertisement and Storage . . . . . . . . . . . . . . 9 76 3.2 Routing Information Bases . . . . . . . . . . . . . . . . . . 10 77 4. Message Formats . . . . . . . . . . . . . . . . . . . . . . . 12 78 4.1 Message Header Format . . . . . . . . . . . . . . . . . . . . 12 79 4.2 OPEN Message Format . . . . . . . . . . . . . . . . . . . . . 13 80 4.3 UPDATE Message Format . . . . . . . . . . . . . . . . . . . . 15 81 4.4 KEEPALIVE Message Format . . . . . . . . . . . . . . . . . . 22 82 4.5 NOTIFICATION Message Format . . . . . . . . . . . . . . . . . 22 83 5. Path Attributes . . . . . . . . . . . . . . . . . . . . . . . 24 84 5.1 Path Attribute Usage . . . . . . . . . . . . . . . . . . . . 26 85 5.1.1 ORIGIN . . . . . . . . . . . . . . . . . . . . . . . . . . 26 86 5.1.2 AS_PATH . . . . . . . . . . . . . . . . . . . . . . . . . . 26 87 5.1.3 NEXT_HOP . . . . . . . . . . . . . . . . . . . . . . . . . 27 88 5.1.4 MULTI_EXIT_DISC . . . . . . . . . . . . . . . . . . . . . . 29 89 5.1.5 LOCAL_PREF . . . . . . . . . . . . . . . . . . . . . . . . 30 90 5.1.6 ATOMIC_AGGREGATE . . . . . . . . . . . . . . . . . . . . . 30 91 5.1.7 AGGREGATOR . . . . . . . . . . . . . . . . . . . . . . . . 31 92 6. BGP Error Handling . . . . . . . . . . . . . . . . . . . . . . 31 93 6.1 Message Header error handling . . . . . . . . . . . . . . . . 31 94 6.2 OPEN message error handling . . . . . . . . . . . . . . . . . 32 95 6.3 UPDATE message error handling . . . . . . . . . . . . . . . . 33 96 6.4 NOTIFICATION message error handling . . . . . . . . . . . . . 35 97 6.5 Hold Timer Expired error handling . . . . . . . . . . . . . . 35 98 6.6 Finite State Machine error handling . . . . . . . . . . . . . 35 99 6.7 Cease . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 100 6.8 BGP connection collision detection . . . . . . . . . . . . . 36 101 7. BGP Version Negotiation . . . . . . . . . . . . . . . . . . . 37 102 8. BGP Finite State machine . . . . . . . . . . . . . . . . . . . 38 103 8.1 Events for the BGP FSM . . . . . . . . . . . . . . . . . . . 39 104 8.1.1 Optional Events linked to Optional Session attributes . . . 39 105 8.1.2 Administrative Events . . . . . . . . . . . . . . . . . . 44 106 8.1.3 Timer Events . . . . . . . . . . . . . . . . . . . . . . . 47 107 8.1.4 TCP connection based Events . . . . . . . . . . . . . . . . 49 108 8.1.5 BGP Messages based Events . . . . . . . . . . . . . . . . . 51 109 8.2 Description of FSM . . . . . . . . . . . . . . . . . . . . . 53 110 8.2.1 FSM Definition . . . . . . . . . . . . . . . . . . . . . . 53 111 8.2.1.1 Terms "active" and "passive" . . . . . . . . . . . . . . 54 112 8.2.1.2 FSM and collision detection . . . . . . . . . . . . . . . 54 113 8.2.1.3 FSM and Optional Attributes . . . . . . . . . . . . . . 55 114 8.2.1.4 FSM Event numbers . . . . . . . . . . . . . . . . . . . . 55 115 RFC DRAFT November 2003 117 8.2.1.5 FSM actions that are implementation dependent . . . . . . 56 118 8.2.2 Finite State Machine . . . . . . . . . . . . . . . . . . . 56 119 9. UPDATE Message Handling . . . . . . . . . . . . . . . . . . . 72 120 9.1 Decision Process . . . . . . . . . . . . . . . . . . . . . . 73 121 9.1.1 Phase 1: Calculation of Degree of Preference . . . . . . . 74 122 9.1.2 Phase 2: Route Selection . . . . . . . . . . . . . . . . . 74 123 9.1.2.1 Route Resolvability Condition . . . . . . . . . . . . . . 76 124 9.1.2.2 Breaking Ties (Phase 2) . . . . . . . . . . . . . . . . . 77 125 9.1.3 Phase 3: Route Dissemination . . . . . . . . . . . . . . . 79 126 9.1.4 Overlapping Routes . . . . . . . . . . . . . . . . . . . . 80 127 9.2 Update-Send Process . . . . . . . . . . . . . . . . . . . . . 81 128 9.2.1 Controlling Routing Traffic Overhead . . . . . . . . . . . 82 129 9.2.1.1 Frequency of Route Advertisement . . . . . . . . . . . . 82 130 9.2.1.2 Frequency of Route Origination . . . . . . . . . . . . . 83 131 9.2.2 Efficient Organization of Routing Information . . . . . . . 83 132 9.2.2.1 Information Reduction . . . . . . . . . . . . . . . . . . 83 133 9.2.2.2 Aggregating Routing Information . . . . . . . . . . . . . 84 134 9.3 Route Selection Criteria . . . . . . . . . . . . . . . . . . 86 135 9.4 Originating BGP routes . . . . . . . . . . . . . . . . . . . 87 136 10. BGP Timers . . . . . . . . . . . . . . . . . . . . . . . . . 87 137 Appendix A. Comparison with RFC1771 . . . . . . . . . . . . . . . 88 138 Appendix B. Comparison with RFC1267 . . . . . . . . . . . . . . . 89 139 Appendix C. Comparison with RFC 1163 . . . . . . . . . . . . . . 90 140 Appendix D. Comparison with RFC 1105 . . . . . . . . . . . . . . 90 141 Appendix E. TCP options that may be used with BGP . . . . . . . . 91 142 Appendix F. Implementation Recommendations . . . . . . . . . . . 91 143 Appendix F.1 Multiple Networks Per Message . . . . . . . . . . . 91 144 Appendix F.2 Reducing route flapping . . . . . . . . . . . . . . 92 145 Appendix F.3 Path attribute ordering . . . . . . . . . . . . . . 92 146 Appendix F.4 AS_SET sorting . . . . . . . . . . . . . . . . . . . 92 147 Appendix F.5 Control over version negotiation . . . . . . . . . . 93 148 Appendix F.6 Complex AS_PATH aggregation . . . . . . . . . . . . 93 149 Security Considerations . . . . . . . . . . . . . . . . . . . . . 94 150 IANA Considerations . . . . . . . . . . . . . . . . . . . . . . . 95 151 IPR Notice . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 152 Full Copyright Notice . . . . . . . . . . . . . . . . . . . . . . 96 153 Normative References . . . . . . . . . . . . . . . . . . . . . . 97 154 Non-normative References . . . . . . . . . . . . . . . . . . . . 98 155 Authors Information . . . . . . . . . . . . . . . . . . . . . . . 99 156 RFC DRAFT November 2003 158 Abstract 160 The Border Gateway Protocol (BGP) is an inter-Autonomous System rout- 161 ing protocol. 163 The primary function of a BGP speaking system is to exchange network 164 reachability information with other BGP systems. This network reacha- 165 bility information includes information on the list of Autonomous 166 Systems (ASs) that reachability information traverses. This informa- 167 tion is sufficient to construct a graph of AS connectivity for this 168 reachability from which routing loops may be pruned and some policy 169 decisions at the AS level may be enforced. 171 BGP-4 provides a set of mechanisms for supporting Classless Inter- 172 Domain Routing (CIDR) [RFC1518, RFC1519]. These mechanisms include 173 support for advertising a set of destinations as an IP prefix and 174 eliminating the concept of network "class" within BGP. BGP-4 also 175 introduces mechanisms which allow aggregation of routes, including 176 aggregation of AS paths. 178 Routing information exchanged via BGP supports only the destination- 179 based forwarding paradigm, which assumes that a router forwards a 180 packet based solely on the destination address carried in the IP 181 header of the packet. This, in turn, reflects the set of policy deci- 182 sions that can (and can not) be enforced using BGP. BGP can support 183 only the policies conforming to the destination-based forwarding 184 paradigm. 186 1. Definition of commonly used terms 188 This section provides definition for terms that have a specific mean- 189 ing to the BGP protocol and that are used throughout the text. 191 Adj-RIB-In 192 The Adj-RIBs-In contain unprocessed routing information that has 193 been advertised to the local BGP speaker by its peers. 195 Adj-RIB-Out 196 The Adj-RIBs-Out contains the routes for advertisement to specific 197 peers by means of the local speaker's UPDATE messages. 199 Autonomous System (AS) 200 The classic definition of an Autonomous System is a set of routers 201 under a single technical administration, using an interior gateway 202 protocol (IGP) and common metrics to determine how to route pack- 203 ets within the AS, and using an inter-AS routing protocol to 204 determine how to route packets to other ASs. Since this classic 205 RFC DRAFT November 2003 207 definition was developed, it has become common for a single AS to 208 use several IGPs and sometimes several sets of metrics within an 209 AS. The use of the term Autonomous System here stresses the fact 210 that, even when multiple IGPs and metrics are used, the adminis- 211 tration of an AS appears to other ASs to have a single coherent 212 interior routing plan and presents a consistent picture of what 213 destinations are reachable through it. 215 BGP Identifier 216 A 4-octet unsigned integer indicating the BGP Identifier of the 217 sender of BGP messages. A given BGP speaker sets the value of its 218 BGP Identifier to an IP address assigned to that BGP speaker. The 219 value of the BGP Identifier is determined on startup and is the 220 same for every local interface and every BGP peer. 222 BGP speaker 223 A router that implements BGP. 225 EBGP 226 External BGP (BGP connection between external peers). 228 External peer 229 Peer that is in a different Autonomous System than the local sys- 230 tem. 232 Feasible route 233 An advertised route that is available for use by the recipient. 235 IBGP 236 Internal BGP (BGP connection between internal peers). 238 Internal peer 239 Peer that is in the same Autonomous System as the local system. 241 IGP 242 Interior Gateway Protocol - a routing protocol used to exchange 243 routing information among routers within a single Autonomous Sys- 244 tem. 246 Loc-RIB 247 The Loc-RIB contains the routes that have been selected by the 248 local BGP speaker's Decision Process. 250 NLRI 251 Network Layer Reachability Information. 253 Route 254 A unit of information that pairs a set of destinations with the 255 RFC DRAFT November 2003 257 attributes of a path to those destinations. The set of destina- 258 tions are systems whose IP addresses are contained in one IP 259 address prefix carried in the Network Layer Reachability Informa- 260 tion (NLRI) field of an UPDATE message. The path is the informa- 261 tion reported in the path attributes field of the same UPDATE mes- 262 sage. 264 RIB 265 Routing Information Base. 267 Unfeasible route 268 A previously advertised feasible route that is no longer available 269 for use. 271 2. Acknowledgments 273 This document was originally published as RFC 1267 in October 1991, 274 jointly authored by Kirk Lougheed and Yakov Rekhter. 276 We would like to express our thanks to Guy Almes, Len Bosack, and 277 Jeffrey C. Honig for their contributions to the earlier version 278 (BGP-1) of this document. 280 We would like to specially acknowledge numerous contributions by Den- 281 nis Ferguson to the earlier version of this document. 283 We like to explicitly thank Bob Braden for the review of the earlier 284 version (BGP-2) of this document as well as his constructive and 285 valuable comments. 287 We would also like to thank Bob Hinden, Director for Routing of the 288 Internet Engineering Steering Group, and the team of reviewers he 289 assembled to review the earlier version (BGP-2) of this document. 290 This team, consisting of Deborah Estrin, Milo Medin, John Moy, Radia 291 Perlman, Martha Steenstrup, Mike St. Johns, and Paul Tsuchiya, acted 292 with a strong combination of toughness, professionalism, and cour- 293 tesy. 295 Certain sections of the document borrowed heavily from IDRP 296 [IS10747], which is the OSI counterpart of BGP. For this credit 297 should be given to the ANSI X3S3.3 group chaired by Lyman Chapin and 298 to Charles Kunzinger who was the IDRP editor within that group. 300 We would also like to thank Benjamin Abarbanel, Enke Chen, Edward 301 Crabbe, Mike Craren, Vincent Gillet, Eric Gray, Jeffrey Haas, Dimitry 302 Haskin, Stephen Kent, John Krawczyk, David LeRoy, Dan Massey, 303 Jonathan Natale, Dan Pei, Mathew Richardson, John Scudder, John 304 RFC DRAFT November 2003 306 Stewart III, Dave Thaler, Paul Traina, Russ White, Curtis Villamizar, 307 and Alex Zinin for their comments. 309 We would like to specially acknowledge Andrew Lange for his help in 310 preparing the final version of this document. 312 Finally, we would like to thank all the members of the IDR Working 313 Group for their ideas and support they have given to this document. 315 Specification of Requirements 317 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 318 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 319 document are to be interpreted as described in RFC2119 [RFC2119]. 321 3. Summary of Operation 323 The Border Gateway Protocol (BGP) is an inter-Autonomous System rout- 324 ing protocol. It is built on experience gained with EGP as defined in 325 [RFC904] and EGP usage in the NSFNET Backbone as described in 326 [RFC1092] and [RFC1093]. 328 The primary function of a BGP speaking system is to exchange network 329 reachability information with other BGP systems. This network reacha- 330 bility information includes information on the list of Autonomous 331 Systems (ASs) that reachability information traverses. This informa- 332 tion is sufficient to construct a graph of AS connectivity from which 333 routing loops may be pruned and some policy decisions at the AS level 334 may be enforced. 336 In the context of this document we assume that a BGP speaker adver- 337 tises to its peers only those routes that it itself uses (in this 338 context a BGP speaker is said to "use" a BGP route if it is the most 339 preferred BGP route and is used in forwarding). All other cases are 340 outside the scope of this document. 342 In the context of this document the term "IP address" refers to an IP 343 Version 4 address [RFC791]. 345 Routing information exchanged via BGP supports only the destination- 346 based forwarding paradigm, which assumes that a router forwards a 347 packet based solely on the destination address carried in the IP 348 header of the packet. This, in turn, reflects the set of policy deci- 349 sions that can (and can not) be enforced using BGP. Note that some 350 RFC DRAFT November 2003 352 policies can not be supported by the destination-based forwarding 353 paradigm, and thus require techniques such as source routing (aka 354 explicit routing) to be enforced. Such policies can not be enforced 355 using BGP either. For example, BGP does not enable one AS to send 356 traffic to a neighboring AS for forwarding to some destination 357 (reachable through but) beyond that neighboring AS intending that the 358 traffic take a different route to that taken by the traffic originat- 359 ing in the neighboring AS (for that same destination). On the other 360 hand, BGP can support any policy conforming to the destination-based 361 forwarding paradigm. 363 BGP-4 provides a new set of mechanisms for supporting Classless 364 Inter-Domain Routing (CIDR) [RFC1518, RFC1519]. These mechanisms 365 include support for advertising a set of destinations as an IP prefix 366 and eliminating the concept of network "class" within BGP. BGP-4 367 also introduces mechanisms which allow aggregation of routes, includ- 368 ing aggregation of AS paths. 370 This document uses the term `Autonomous System' (AS) throughout. The 371 classic definition of an Autonomous System is a set of routers under 372 a single technical administration, using an interior gateway protocol 373 (IGP) and common metrics to determine how to route packets within the 374 AS, and using an inter-AS routing protocol to determine how to route 375 packets to other ASs. Since this classic definition was developed, it 376 has become common for a single AS to use several IGPs and sometimes 377 several sets of metrics within an AS. The use of the term Autonomous 378 System here stresses the fact that, even when multiple IGPs and met- 379 rics are used, the administration of an AS appears to other ASs to 380 have a single coherent interior routing plan and presents a consis- 381 tent picture of what destinations are reachable through it. 383 BGP uses TCP [RFC793] as its transport protocol. This eliminates the 384 need to implement explicit update fragmentation, retransmission, 385 acknowledgment, and sequencing. BGP listens on TCP port 179. The 386 error notification mechanism used in BGP assumes that TCP supports a 387 "graceful" close, i.e., that all outstanding data will be delivered 388 before the connection is closed. 390 Two systems form a TCP connection between one another. They exchange 391 messages to open and confirm the connection parameters. 393 The initial data flow is the portion of the BGP routing table that is 394 allowed by the export policy, called the Adj-Ribs-Out (see 3.2). 395 Incremental updates are sent as the routing tables change. BGP does 396 not require periodic refresh of the routing table. To allow local 397 policy changes to have the correct effect without resetting any BGP 398 connections, a BGP speaker SHOULD either (a) retain the current ver- 399 sion of the routes advertised to it by all of its peers for the 400 RFC DRAFT November 2003 402 duration of the connection, or (b) make use of the Route Refresh 403 extension [RFC2918]. 405 KEEPALIVE messages may be sent periodically to ensure the liveness of 406 the connection. NOTIFICATION messages are sent in response to errors 407 or special conditions. If a connection encounters an error condition, 408 a NOTIFICATION message is sent and the connection is closed. 410 A peer in a different AS is referred to as an external peer, while a 411 peer in the same AS is referred to as an internal peer. Internal BGP 412 and external BGP are commonly abbreviated IBGP and EBGP. 414 If a particular AS has multiple BGP speakers and is providing transit 415 service for other ASs, then care must be taken to ensure a consistent 416 view of routing within the AS. A consistent view of the interior 417 routes of the AS is provided by the IGP used within the AS. For the 418 purpose of this document, it is assumed that a consistent view of the 419 routes exterior to the AS is provided by having all BGP speakers 420 within the AS maintain IBGP with each other. 422 This document specifies the base behavior of the BGP protocol. This 423 behavior can and is modified by extension specifications. When the 424 protocol is extended the new behavior is fully documented in the 425 extension specifications. 427 3.1 Routes: Advertisement and Storage 429 For the purpose of this protocol, a route is defined as a unit of 430 information that pairs a set of destinations with the attributes of a 431 path to those destinations. The set of destinations are systems whose 432 IP addresses are contained in one IP address prefix carried in the 433 Network Layer Reachability Information (NLRI) field of an UPDATE mes- 434 sage, and the path is the information reported in the path attributes 435 field of the same UPDATE message. 437 Routes are advertised between BGP speakers in UPDATE messages. Mul- 438 tiple routes that have the same path attributes can be advertised in 439 a single UPDATE message by including multiple prefixes in the NLRI 440 field of the UPDATE message. 442 Routes are stored in the Routing Information Bases (RIBs): namely, 443 the Adj-RIBs-In, the Loc-RIB, and the Adj-RIBs-Out, as described in 444 Section 3.2. 446 If a BGP speaker chooses to advertise a previously received route, it 447 MAY add to or modify the path attributes of the route before adver- 448 tising it to a peer. 450 RFC DRAFT November 2003 452 BGP provides mechanisms by which a BGP speaker can inform its peer 453 that a previously advertised route is no longer available for use. 454 There are three methods by which a given BGP speaker can indicate 455 that a route has been withdrawn from service: 457 a) the IP prefix that expresses the destination for a previously 458 advertised route can be advertised in the WITHDRAWN ROUTES field 459 in the UPDATE message, thus marking the associated route as being 460 no longer available for use 462 b) a replacement route with the same NLRI can be advertised, or 464 c) the BGP speaker - BGP speaker connection can be closed, which 465 implicitly removes from service all routes which the pair of 466 speakers had advertised to each other. 468 Changing attribute(s) of a route is accomplished by advertising a 469 replacement route. The replacement route carries new (changed) 470 attributes and has the same address prefix as the original route. 472 3.2 Routing Information Base 474 The Routing Information Base (RIB) within a BGP speaker consists of 475 three distinct parts: 477 a) Adj-RIBs-In: The Adj-RIBs-In store routing information that has 478 been learned from inbound UPDATE messages received from other BGP 479 speakers. Their contents represent routes that are available as an 480 input to the Decision Process. 482 b) Loc-RIB: The Loc-RIB contains the local routing information 483 that the BGP speaker has selected by applying its local policies 484 to the routing information contained in its Adj-RIBs-In. These are 485 the routes that will be used by the local BGP speaker. The next 486 hop for each of these routes MUST be resolvable via the local BGP 487 speaker's Routing Table. 489 c) Adj-RIBs-Out: The Adj-RIBs-Out store the information that the 490 local BGP speaker has selected for advertisement to its peers. The 491 routing information stored in the Adj-RIBs-Out will be carried in 492 the local BGP speaker's UPDATE messages and advertised to its 493 peers. 495 In summary, the Adj-RIBs-In contain unprocessed routing information 496 that has been advertised to the local BGP speaker by its peers; the 497 Loc-RIB contains the routes that have been selected by the local BGP 498 speaker's Decision Process; and the Adj-RIBs-Out organize the routes 499 RFC DRAFT November 2003 501 for advertisement to specific peers by means of the local speaker's 502 UPDATE messages. 504 Although the conceptual model distinguishes between Adj-RIBs-In, Loc- 505 RIB, and Adj-RIBs-Out, this neither implies nor requires that an 506 implementation must maintain three separate copies of the routing 507 information. The choice of implementation (for example, 3 copies of 508 the information vs 1 copy with pointers) is not constrained by the 509 protocol. 511 Routing information that the BGP speaker uses to forward packets (or 512 to construct the forwarding table that is used for packet forwarding) 513 is maintained in the Routing Table. The Routing Table accumulates 514 routes to directly connected networks, static routes, routes learned 515 from the IGP protocols, and routes learned from BGP. Whether or not 516 a specific BGP route should be installed in the Routing Table, and 517 whether a BGP route should override a route to the same destination 518 installed by another source is a local policy decision, not specified 519 in this document. Besides actual packet forwarding, the Routing Table 520 is used for resolution of the next-hop addresses specified in BGP 521 updates (see Section 5.1.3). 523 4. Message Formats 525 This section describes message formats used by BGP. 527 BGP messages are sent over a TCP connection. A message is processed 528 only after it is entirely received. The maximum message size is 4096 529 octets. All implementations are required to support this maximum mes- 530 sage size. The smallest message that may be sent consists of a BGP 531 header without a data portion, or 19 octets. 533 All multi-octet fields are in network byte order. 535 4.1 Message Header Format 537 Each message has a fixed-size header. There may or may not be a data 538 portion following the header, depending on the message type. The lay- 539 out of these fields is shown below: 541 RFC DRAFT November 2003 543 0 1 2 3 544 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 545 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 546 | | 547 + + 548 | | 549 + + 550 | Marker | 551 + + 552 | | 553 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 554 | Length | Type | 555 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 557 Marker: 559 This 16-octet field is included for compatibility; it MUST be 560 set to all ones. 562 Length: 564 This 2-octet unsigned integer indicates the total length of the 565 message, including the header, in octets. Thus, e.g., it allows 566 one to locate in the TCP stream the (Marker field of the) next 567 message. The value of the Length field MUST always be at least 568 19 and no greater than 4096, and MAY be further constrained, 569 depending on the message type. No "padding" of extra data after 570 the message is allowed, so the Length field MUST have the 571 smallest value required given the rest of the message. 573 Type: 575 This 1-octet unsigned integer indicates the type code of the 576 message. This document defines the following type codes: 578 1 - OPEN 579 2 - UPDATE 580 3 - NOTIFICATION 581 4 - KEEPALIVE 583 [RFC2918] defines one more type code. 585 4.2 OPEN Message Format 587 After a TCP connection is established, the first message sent by each 588 side is an OPEN message. If the OPEN message is acceptable, a 589 RFC DRAFT November 2003 591 KEEPALIVE message confirming the OPEN is sent back. 593 In addition to the fixed-size BGP header, the OPEN message contains 594 the following fields: 596 0 1 2 3 597 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 598 +-+-+-+-+-+-+-+-+ 599 | Version | 600 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 601 | My Autonomous System | 602 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 603 | Hold Time | 604 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 605 | BGP Identifier | 606 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 607 | Opt Parm Len | 608 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 609 | | 610 | Optional Parameters (variable) | 611 | | 612 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 614 Version: 616 This 1-octet unsigned integer indicates the protocol version 617 number of the message. The current BGP version number is 4. 619 My Autonomous System: 621 This 2-octet unsigned integer indicates the Autonomous System 622 number of the sender. 624 Hold Time: 626 This 2-octet unsigned integer indicates the number of seconds 627 that the sender proposes for the value of the Hold Timer. Upon 628 receipt of an OPEN message, a BGP speaker MUST calculate the 629 value of the Hold Timer by using the smaller of its configured 630 Hold Time and the Hold Time received in the OPEN message. The 631 Hold Time MUST be either zero or at least three seconds. An 632 implementation MAY reject connections on the basis of the Hold 633 Time. The calculated value indicates the maximum number of 634 seconds that may elapse between the receipt of successive 635 KEEPALIVE, and/or UPDATE messages by the sender. 637 BGP Identifier: 639 RFC DRAFT November 2003 641 This 4-octet unsigned integer indicates the BGP Identifier of 642 the sender. A given BGP speaker sets the value of its BGP Iden- 643 tifier to an IP address assigned to that BGP speaker. The 644 value of the BGP Identifier is determined on startup and is the 645 same for every local interface and every BGP peer. 647 Optional Parameters Length: 649 This 1-octet unsigned integer indicates the total length of the 650 Optional Parameters field in octets. If the value of this field 651 is zero, no Optional Parameters are present. 653 Optional Parameters: 655 This field contains a list of optional parameters, where each 656 parameter is encoded as a triplet. 659 0 1 660 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 661 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-... 662 | Parm. Type | Parm. Length | Parameter Value (variable) 663 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-... 665 Parameter Type is a one octet field that unambiguously identi- 666 fies individual parameters. Parameter Length is a one octet 667 field that contains the length of the Parameter Value field in 668 octets. Parameter Value is a variable length field that is 669 interpreted according to the value of the Parameter Type field. 671 [RFC3392] defines the Capabilities Optional Parameter. 673 The minimum length of the OPEN message is 29 octets (including mes- 674 sage header). 676 4.3 UPDATE Message Format 678 UPDATE messages are used to transfer routing information between BGP 679 peers. The information in the UPDATE message can be used to construct 680 a graph describing the relationships of the various Autonomous Sys- 681 tems. By applying rules to be discussed, routing information loops 682 and some other anomalies may be detected and removed from inter-AS 683 routing. 685 An UPDATE message is used to advertise feasible routes sharing common 686 path attributes to a peer, or to withdraw multiple unfeasible routes 687 RFC DRAFT November 2003 689 from service (see 3.1). An UPDATE message MAY simultaneously adver- 690 tise a feasible route and withdraw multiple unfeasible routes from 691 service. The UPDATE message always includes the fixed-size BGP 692 header, and also includes the other fields as shown below (note, some 693 of the shown fields may not be present in every UPDATE message): 695 +-----------------------------------------------------+ 696 | Withdrawn Routes Length (2 octets) | 697 +-----------------------------------------------------+ 698 | Withdrawn Routes (variable) | 699 +-----------------------------------------------------+ 700 | Total Path Attribute Length (2 octets) | 701 +-----------------------------------------------------+ 702 | Path Attributes (variable) | 703 +-----------------------------------------------------+ 704 | Network Layer Reachability Information (variable) | 705 +-----------------------------------------------------+ 707 Withdrawn Routes Length: 709 This 2-octets unsigned integer indicates the total length of 710 the Withdrawn Routes field in octets. Its value allows the 711 length of the Network Layer Reachability Information field to 712 be determined as specified below. 714 A value of 0 indicates that no routes are being withdrawn from 715 service, and that the WITHDRAWN ROUTES field is not present in 716 this UPDATE message. 718 Withdrawn Routes: 720 This is a variable length field that contains a list of IP 721 address prefixes for the routes that are being withdrawn from 722 service. Each IP address prefix is encoded as a 2-tuple of the 723 form , whose fields are described below: 725 +---------------------------+ 726 | Length (1 octet) | 727 +---------------------------+ 728 | Prefix (variable) | 729 +---------------------------+ 731 The use and the meaning of these fields are as follows: 733 a) Length: 735 RFC DRAFT November 2003 737 The Length field indicates the length in bits of the IP 738 address prefix. A length of zero indicates a prefix that 739 matches all IP addresses (with prefix, itself, of zero 740 octets). 742 b) Prefix: 744 The Prefix field contains an IP address prefix followed by 745 the minimum number of trailing bits needed to make the end 746 of the field fall on an octet boundary. Note that the value 747 of trailing bits is irrelevant. 749 Total Path Attribute Length: 751 This 2-octet unsigned integer indicates the total length of the 752 Path Attributes field in octets. Its value allows the length of 753 the Network Layer Reachability field to be determined as speci- 754 fied below. 756 A value of 0 indicates that neither the Network Layer Reacha- 757 bility Information field, nor the Path Attribute field is pre- 758 sent in this UPDATE message. 760 Path Attributes: 762 A variable length sequence of path attributes is present in 763 every UPDATE message, except for an UPDATE message that carries 764 only the withdrawn routes. Each path attribute is a triple 765 of variable 766 length. 768 Attribute Type is a two-octet field that consists of the 769 Attribute Flags octet followed by the Attribute Type Code 770 octet. 772 0 1 773 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 774 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 775 | Attr. Flags |Attr. Type Code| 776 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 778 The high-order bit (bit 0) of the Attribute Flags octet is the 779 Optional bit. It defines whether the attribute is optional (if 780 set to 1) or well-known (if set to 0). 782 The second high-order bit (bit 1) of the Attribute Flags octet 783 is the Transitive bit. It defines whether an optional attribute 784 is transitive (if set to 1) or non-transitive (if set to 0). 786 RFC DRAFT November 2003 788 For well-known attributes, the Transitive bit MUST be set to 1. 789 (See Section 5 for a discussion of transitive attributes.) 791 The third high-order bit (bit 2) of the Attribute Flags octet 792 is the Partial bit. It defines whether the information con- 793 tained in the optional transitive attribute is partial (if set 794 to 1) or complete (if set to 0). For well-known attributes and 795 for optional non-transitive attributes the Partial bit MUST be 796 set to 0. 798 The fourth high-order bit (bit 3) of the Attribute Flags octet 799 is the Extended Length bit. It defines whether the Attribute 800 Length is one octet (if set to 0) or two octets (if set to 1). 802 The lower-order four bits of the Attribute Flags octet are 803 unused. They MUST be zero when sent and MUST be ignored when 804 received. 806 The Attribute Type Code octet contains the Attribute Type Code. 807 Currently defined Attribute Type Codes are discussed in Section 808 5. 810 If the Extended Length bit of the Attribute Flags octet is set 811 to 0, the third octet of the Path Attribute contains the length 812 of the attribute data in octets. 814 If the Extended Length bit of the Attribute Flags octet is set 815 to 1, then the third and the fourth octets of the path 816 attribute contain the length of the attribute data in octets. 818 The remaining octets of the Path Attribute represent the 819 attribute value and are interpreted according to the Attribute 820 Flags and the Attribute Type Code. The supported Attribute Type 821 Codes, their attribute values and uses are the following: 823 a) ORIGIN (Type Code 1): 825 ORIGIN is a well-known mandatory attribute that defines the 826 origin of the path information. The data octet can assume 827 the following values: 829 Value Meaning 831 0 IGP - Network Layer Reachability Information 832 is interior to the originating AS 834 1 EGP - Network Layer Reachability Information 835 learned via the EGP protocol [RFC904] 836 RFC DRAFT November 2003 838 2 INCOMPLETE - Network Layer Reachability 839 Information learned by some other means 841 Usage of this attribute is defined in 5.1.1. 843 b) AS_PATH (Type Code 2): 845 AS_PATH is a well-known mandatory attribute that is composed 846 of a sequence of AS path segments. Each AS path segment is 847 represented by a triple . 850 The path segment type is a 1-octet long field with the fol- 851 lowing values defined: 853 Value Segment Type 855 1 AS_SET: unordered set of ASs a route in the 856 UPDATE message has traversed 858 2 AS_SEQUENCE: ordered set of ASs a route in 859 the UPDATE message has traversed 861 The path segment length is a 1-octet long field containing 862 the number of ASs (not the number of octets) in the path 863 segment value field. 865 The path segment value field contains one or more AS num- 866 bers, each encoded as a 2-octets long field. 868 Usage of this attribute is defined in 5.1.2. 870 c) NEXT_HOP (Type Code 3): 872 This is a well-known mandatory attribute that defines the 873 (unicast) IP address of the router that SHOULD be used as 874 the next hop to the destinations listed in the Network Layer 875 Reachability Information field of the UPDATE message. 877 Usage of this attribute is defined in 5.1.3. 879 d) MULTI_EXIT_DISC (Type Code 4): 881 This is an optional non-transitive attribute that is a four 882 octet unsigned integer. The value of this attribute MAY be 883 used by a BGP speaker's Decision Process to discriminate 884 among multiple entry points to a neighboring autonomous 885 RFC DRAFT November 2003 887 system. 889 Usage of this attribute is defined in 5.1.4. 891 e) LOCAL_PREF (Type Code 5): 893 LOCAL_PREF is a well-known attribute that is a four octet 894 unsigned integer. A BGP speaker uses it to inform its other 895 internal peers of the advertising speaker's degree of pref- 896 erence for an advertised route. 898 Usage of this attribute is defined in 5.1.5. 900 f) ATOMIC_AGGREGATE (Type Code 6) 902 ATOMIC_AGGREGATE is a well-known discretionary attribute of 903 length 0. 905 Usage of this attribute is defined in 5.1.6. 907 g) AGGREGATOR (Type Code 7) 909 AGGREGATOR is an optional transitive attribute of length 6. 910 The attribute contains the last AS number that formed the 911 aggregate route (encoded as 2 octets), followed by the IP 912 address of the BGP speaker that formed the aggregate route 913 (encoded as 4 octets). This SHOULD be the same address as 914 the one used for the BGP Identifier of the speaker. 916 Usage of this attribute is defined in 5.1.7. 918 Network Layer Reachability Information: 920 This variable length field contains a list of IP address pre- 921 fixes. The length in octets of the Network Layer Reachability 922 Information is not encoded explicitly, but can be calculated 923 as: 925 UPDATE message Length - 23 - Total Path Attributes Length - 926 Withdrawn Routes Length 928 where UPDATE message Length is the value encoded in the fixed- 929 size BGP header, Total Path Attribute Length and Withdrawn 930 Routes Length are the values encoded in the variable part of 931 the UPDATE message, and 23 is a combined length of the fixed- 932 size BGP header, the Total Path Attribute Length field and the 933 Withdrawn Routes Length field. 935 RFC DRAFT November 2003 937 Reachability information is encoded as one or more 2-tuples of 938 the form , whose fields are described below: 940 +---------------------------+ 941 | Length (1 octet) | 942 +---------------------------+ 943 | Prefix (variable) | 944 +---------------------------+ 946 The use and the meaning of these fields are as follows: 948 a) Length: 950 The Length field indicates the length in bits of the IP 951 address prefix. A length of zero indicates a prefix that 952 matches all IP addresses (with prefix, itself, of zero 953 octets). 955 b) Prefix: 957 The Prefix field contains an IP address prefix followed by 958 enough trailing bits to make the end of the field fall on an 959 octet boundary. Note that the value of the trailing bits is 960 irrelevant. 962 The minimum length of the UPDATE message is 23 octets -- 19 octets 963 for the fixed header + 2 octets for the Withdrawn Routes Length + 2 964 octets for the Total Path Attribute Length (the value of Withdrawn 965 Routes Length is 0 and the value of Total Path Attribute Length is 966 0). 968 An UPDATE message can advertise at most one set of path attributes, 969 but multiple destinations, provided that the destinations share these 970 attributes. All path attributes contained in a given UPDATE message 971 apply to all destinations carried in the NLRI field of the UPDATE 972 message. 974 An UPDATE message can list multiple routes to be withdrawn from ser- 975 vice. Each such route is identified by its destination (expressed as 976 an IP prefix), which unambiguously identifies the route in the con- 977 text of the BGP speaker - BGP speaker connection to which it has been 978 previously advertised. 980 An UPDATE message might advertise only routes to be withdrawn from 981 service, in which case it will not include path attributes or Network 982 Layer Reachability Information. Conversely, it may advertise only a 983 feasible route, in which case the WITHDRAWN ROUTES field need not be 984 present. 986 RFC DRAFT November 2003 988 An UPDATE message SHOULD NOT include the same address prefix in the 989 WITHDRAWN ROUTES and Network Layer Reachability Information fields, 990 however a BGP speaker MUST be able to process UPDATE messages in this 991 form. A BGP speaker SHOULD treat an UPDATE message of this form as if 992 the WITHDRAWN ROUTES doesn't contain the address prefix. 994 4.4 KEEPALIVE Message Format 996 BGP does not use any TCP-based keep-alive mechanism to determine if 997 peers are reachable. Instead, KEEPALIVE messages are exchanged 998 between peers often enough as not to cause the Hold Timer to expire. 999 A reasonable maximum time between KEEPALIVE messages would be one 1000 third of the Hold Time interval. KEEPALIVE messages MUST NOT be sent 1001 more frequently than one per second. An implementation MAY adjust the 1002 rate at which it sends KEEPALIVE messages as a function of the Hold 1003 Time interval. 1005 If the negotiated Hold Time interval is zero, then periodic KEEPALIVE 1006 messages MUST NOT be sent. 1008 A KEEPALIVE message consists of only message header and has a length 1009 of 19 octets. 1011 4.5 NOTIFICATION Message Format 1013 A NOTIFICATION message is sent when an error condition is detected. 1014 The BGP connection is closed immediately after sending it. 1016 In addition to the fixed-size BGP header, the NOTIFICATION message 1017 contains the following fields: 1019 0 1 2 3 1020 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 1021 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1022 | Error code | Error subcode | Data (variable) | 1023 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1025 Error Code: 1027 This 1-octet unsigned integer indicates the type of NOTIFICA- 1028 TION. The following Error Codes have been defined: 1030 Error Code Symbolic Name Reference 1031 RFC DRAFT November 2003 1033 1 Message Header Error Section 6.1 1035 2 OPEN Message Error Section 6.2 1037 3 UPDATE Message Error Section 6.3 1039 4 Hold Timer Expired Section 6.5 1041 5 Finite State Machine Error Section 6.6 1043 6 Cease Section 6.7 1045 Error subcode: 1047 This 1-octet unsigned integer provides more specific informa- 1048 tion about the nature of the reported error. Each Error Code 1049 may have one or more Error Subcodes associated with it. If no 1050 appropriate Error Subcode is defined, then a zero (Unspecific) 1051 value is used for the Error Subcode field. 1053 Message Header Error subcodes: 1055 1 - Connection Not Synchronized. 1056 2 - Bad Message Length. 1057 3 - Bad Message Type. 1059 OPEN Message Error subcodes: 1061 1 - Unsupported Version Number. 1062 2 - Bad Peer AS. 1063 3 - Bad BGP Identifier. 1064 4 - Unsupported Optional Parameter. 1065 5 - [Deprecated - see Appendix A]. 1066 6 - Unacceptable Hold Time. 1068 UPDATE Message Error subcodes: 1070 1 - Malformed Attribute List. 1071 2 - Unrecognized Well-known Attribute. 1072 3 - Missing Well-known Attribute. 1073 4 - Attribute Flags Error. 1074 5 - Attribute Length Error. 1075 6 - Invalid ORIGIN Attribute. 1076 7 - [Deprecated - see Appendix A]. 1077 8 - Invalid NEXT_HOP Attribute. 1078 9 - Optional Attribute Error. 1079 10 - Invalid Network Field. 1081 RFC DRAFT November 2003 1083 11 - Malformed AS_PATH. 1085 Data: 1087 This variable-length field is used to diagnose the reason for 1088 the NOTIFICATION. The contents of the Data field depend upon 1089 the Error Code and Error Subcode. See Section 6 below for more 1090 details. 1092 Note that the length of the Data field can be determined from 1093 the message Length field by the formula: 1095 Message Length = 21 + Data Length 1097 The minimum length of the NOTIFICATION message is 21 octets (includ- 1098 ing message header). 1100 5. Path Attributes 1102 This section discusses the path attributes of the UPDATE message. 1104 Path attributes fall into four separate categories: 1106 1. Well-known mandatory. 1107 2. Well-known discretionary. 1108 3. Optional transitive. 1109 4. Optional non-transitive. 1111 BGP implementations MUST recognize all well-known attributes. Some 1112 of these attributes are mandatory and MUST be included in every 1113 UPDATE message that contains NLRI. Others are discretionary and MAY 1114 or MAY NOT be sent in a particular UPDATE message. 1116 Once a BGP peer has updated any well-known attributes, it MUST pass 1117 these attributes in any updates it transmits to its peers. 1119 In addition to well-known attributes, each path MAY contain one or 1120 more optional attributes. It is not required or expected that all BGP 1121 implementations support all optional attributes. The handling of an 1122 unrecognized optional attribute is determined by the setting of the 1123 Transitive bit in the attribute flags octet. Paths with unrecognized 1124 transitive optional attributes SHOULD be accepted. If a path with 1125 unrecognized transitive optional attribute is accepted and passed 1126 along to other BGP peers, then the unrecognized transitive optional 1127 attribute of that path MUST be passed along with the path to other 1128 RFC DRAFT November 2003 1130 BGP peers with the Partial bit in the Attribute Flags octet set to 1. 1131 If a path with recognized transitive optional attribute is accepted 1132 and passed along to other BGP peers and the Partial bit in the 1133 Attribute Flags octet is set to 1 by some previous AS, it MUST NOT be 1134 set back to 0 by the current AS. Unrecognized non-transitive optional 1135 attributes MUST be quietly ignored and not passed along to other BGP 1136 peers. 1138 New transitive optional attributes MAY be attached to the path by the 1139 originator or by any other BGP speaker in the path. If they are not 1140 attached by the originator, the Partial bit in the Attribute Flags 1141 octet is set to 1. The rules for attaching new non-transitive 1142 optional attributes will depend on the nature of the specific 1143 attribute. The documentation of each new non-transitive optional 1144 attribute will be expected to include such rules. (The description of 1145 the MULTI_EXIT_DISC attribute gives an example.) All optional 1146 attributes (both transitive and non-transitive) MAY be updated (if 1147 appropriate) by BGP speakers in the path. 1149 The sender of an UPDATE message SHOULD order path attributes within 1150 the UPDATE message in ascending order of attribute type. The receiver 1151 of an UPDATE message MUST be prepared to handle path attributes 1152 within the UPDATE message that are out of order. 1154 The same attribute (attribute with the same type) can not appear more 1155 than once within the Path Attributes field of a particular UPDATE 1156 message. 1158 The mandatory category refers to an attribute which MUST be present 1159 in both IBGP and EBGP exchanges if NLRI are contained in the UPDATE 1160 message. Attributes classified as optional for the purpose of the 1161 protocol extension mechanism may be purely discretionary, or discre- 1162 tionary, required, or disallowed in certain contexts. 1164 attribute EBGP IBGP 1165 ORIGIN mandatory mandatory 1166 AS_PATH mandatory mandatory 1167 NEXT_HOP mandatory mandatory 1168 MULTI_EXIT_DISC discretionary discretionary 1169 LOCAL_PREF see Section 5.1.5 required 1170 ATOMIC_AGGREGATE see Section 5.1.6 and 9.1.4 1171 AGGREGATOR discretionary discretionary 1172 RFC DRAFT November 2003 1174 5.1 Path Attribute Usage 1176 The usage of each BGP path attribute is described in the following 1177 clauses. 1179 5.1.1 ORIGIN 1181 ORIGIN is a well-known mandatory attribute. The ORIGIN attribute is 1182 generated by the speaker that originates the associated routing 1183 information. Its value SHOULD NOT be changed by any other speaker. 1185 5.1.2 AS_PATH 1187 AS_PATH is a well-known mandatory attribute. This attribute identi- 1188 fies the autonomous systems through which routing information carried 1189 in this UPDATE message has passed. The components of this list can be 1190 AS_SETs or AS_SEQUENCEs. 1192 When a BGP speaker propagates a route which it has learned from 1193 another BGP speaker's UPDATE message, it modifies the route's AS_PATH 1194 attribute based on the location of the BGP speaker to which the route 1195 will be sent: 1197 a) When a given BGP speaker advertises the route to an internal 1198 peer, the advertising speaker SHALL NOT modify the AS_PATH 1199 attribute associated with the route. 1201 b) When a given BGP speaker advertises the route to an external 1202 peer, then the advertising speaker updates the AS_PATH attribute 1203 as follows: 1205 1) if the first path segment of the AS_PATH is of type 1206 AS_SEQUENCE, the local system prepends its own AS number as the 1207 last element of the sequence (put it in the leftmost position 1208 with respect to the position of octets in the protocol mes- 1209 sage). If the act of prepending will cause an overflow in the 1210 AS_PATH segment, i.e. more than 255 ASs, it SHOULD prepend a 1211 new segment of type AS_SEQUENCE and prepend its own AS number 1212 to this new segment. 1214 2) if the first path segment of the AS_PATH is of type AS_SET, 1215 the local system prepends a new path segment of type 1216 RFC DRAFT November 2003 1218 AS_SEQUENCE to the AS_PATH, including its own AS number in that 1219 segment. 1221 3) if the AS_PATH is empty, the local system creates a path 1222 segment of type AS_SEQUENCE, places its own AS into that seg- 1223 ment, and places that segment into the AS_PATH. 1225 When a BGP speaker originates a route then: 1227 a) the originating speaker includes its own AS number in a path 1228 segment of type AS_SEQUENCE in the AS_PATH attribute of all UPDATE 1229 messages sent to an external peer. (In this case, the AS number of 1230 the originating speaker's autonomous system will be the only entry 1231 the path segment, and this path segment will be the only segment 1232 in the AS_PATH attribute). 1234 b) the originating speaker includes an empty AS_PATH attribute in 1235 all UPDATE messages sent to internal peers. (An empty AS_PATH 1236 attribute is one whose length field contains the value zero). 1238 Whenever the modification of the AS_PATH attribute calls for includ- 1239 ing or prepending the AS number of the local system, the local system 1240 MAY include/prepend more than one instance of its own AS number in 1241 the AS_PATH attribute. This is controlled via local configuration. 1243 5.1.3 NEXT_HOP 1245 The NEXT_HOP is a well-known mandatory attribute that defines the IP 1246 address of the router that SHOULD be used as the next hop to the des- 1247 tinations listed in the UPDATE message. The NEXT_HOP attribute is 1248 calculated as follows. 1250 1) When sending a message to an internal peer, if the route is not 1251 locally originated the BGP speaker SHOULD NOT modify the NEXT_HOP 1252 attribute, unless it has been explicitly configured to announce 1253 its own IP address as the NEXT_HOP. When announcing a locally 1254 originated route to an internal peer, the BGP speaker SHOULD use 1255 as the NEXT_HOP the interface address of the router through which 1256 the announced network is reachable for the speaker; if the route 1257 is directly connected to the speaker, or the interface address of 1258 the router through which the announced network is reachable for 1259 the speaker is the internal peer's address, then the BGP speaker 1260 SHOULD use for the NEXT_HOP attribute its own IP address (the 1261 address of the interface that is used to reach the peer). 1263 2) When sending a message to an external peer X, and the peer is 1264 RFC DRAFT November 2003 1266 one IP hop away from the speaker: 1268 - If the route being announced was learned from an internal 1269 peer or is locally originated, the BGP speaker can use for the 1270 NEXT_HOP attribute an interface address of the internal peer 1271 router (or the internal router) through which the announced 1272 network is reachable for the speaker, provided that peer X 1273 shares a common subnet with this address. This is a form of 1274 "third party" NEXT_HOP attribute. 1276 - Otherwise, if the route being announced was learned from an 1277 external peer, the speaker can use in the NEXT_HOP attribute an 1278 IP address of any adjacent router (known from the received 1279 NEXT_HOP attribute) that the speaker itself uses for local 1280 route calculation, provided that peer X shares a common subnet 1281 with this address. This is a second form of "third party" 1282 NEXT_HOP attribute. 1284 - Otherwise, if the external peer to which the route is being 1285 advertised shares a common subnet with one of the interfaces of 1286 the announcing BGP speaker, the speaker MAY use the IP address 1287 associated with such an interface in the NEXT_HOP attribute. 1288 This is known as a "first party" NEXT_HOP attribute. 1290 - By default (if none of the above conditions apply), the BGP 1291 speaker SHOULD use in the NEXT_HOP attribute the IP address of 1292 the interface that the speaker uses to establish the BGP con- 1293 nection to peer X. 1295 3) When sending a message to an external peer X, and the peer is 1296 multiple IP hops away from the speaker (aka "multihop EBGP"): 1298 - The speaker MAY be configured to propagate the NEXT_HOP 1299 attribute. In this case when advertising a route that the 1300 speaker learned from one of its peers, the NEXT_HOP attribute 1301 of the advertised route is exactly the same as the NEXT_HOP 1302 attribute of the learned route (the speaker just doesn't modify 1303 the NEXT_HOP attribute). 1305 - By default, the BGP speaker SHOULD use in the NEXT_HOP 1306 attribute the IP address of the interface that the speaker uses 1307 to establish the BGP connection to peer X. 1309 Normally the NEXT_HOP attribute is chosen such that the shortest 1310 available path will be taken. A BGP speaker MUST be able to support 1311 disabling advertisement of third party NEXT_HOP attributes to handle 1312 imperfectly bridged media. 1314 RFC DRAFT November 2003 1316 A route originated by a BGP speaker SHALL NOT be advertised to a peer 1317 using an address of that peer as NEXT_HOP. A BGP speaker SHALL NOT 1318 install a route with itself as the next hop. 1320 The NEXT_HOP attribute is used by the BGP speaker to determine the 1321 actual outbound interface and immediate next-hop address that SHOULD 1322 be used to forward transit packets to the associated destinations. 1324 The immediate next-hop address is determined by performing a recur- 1325 sive route lookup operation for the IP address in the NEXT_HOP 1326 attribute using the contents of the Routing Table, selecting one 1327 entry if multiple entries of equal cost exist. The Routing Table 1328 entry which resolves the IP address in the NEXT_HOP attribute will 1329 always specify the outbound interface. If the entry specifies an 1330 attached subnet, but does not specify a next-hop address, then the 1331 address in the NEXT_HOP attribute SHOULD be used as the immediate 1332 next-hop address. If the entry also specifies the next-hop address, 1333 this address SHOULD be used as the immediate next-hop address for 1334 packet forwarding. 1336 5.1.4 MULTI_EXIT_DISC 1338 The MULTI_EXIT_DISC is an optional non-transitive attribute which is 1339 intended to be used on external (inter-AS) links to discriminate 1340 among multiple exit or entry points to the same neighboring AS. The 1341 value of the MULTI_EXIT_DISC attribute is a four octet unsigned num- 1342 ber which is called a metric. All other factors being equal, the exit 1343 point with lower metric SHOULD be preferred. If received over EBGP, 1344 the MULTI_EXIT_DISC attribute MAY be propagated over IBGP to other 1345 BGP speakers within the same AS (see also 9.1.2.2). The 1346 MULTI_EXIT_DISC attribute received from a neighboring AS MUST NOT be 1347 propagated to other neighboring ASs. 1349 A BGP speaker MUST implement a mechanism based on local configuration 1350 which allows the MULTI_EXIT_DISC attribute to be removed from a 1351 route. If a BGP speaker is configured to remove the MULTI_EXIT_DISC 1352 attribute from a route, then this removal MUST be done prior to 1353 determining the degree of preference of the route and performing 1354 route selection (Decision Process phases 1 and 2). 1356 An implementation MAY also (based on local configuration) alter the 1357 value of the MULTI_EXIT_DISC attribute received over EBGP. If a BGP 1358 speaker is configured to alter the value of the MULTI_EXIT_DISC 1359 attribute received over EBGP, then altering the value MUST be done 1360 prior to determining the degree of preference of the route and per- 1361 forming route selection (Decision Process phases 1 and 2). See 1362 RFC DRAFT November 2003 1364 Section 9.1.2.2 for necessary restrictions on this. 1366 5.1.5 LOCAL_PREF 1368 LOCAL_PREF is a well-known attribute that SHALL be included in all 1369 UPDATE messages that a given BGP speaker sends to the other internal 1370 peers. A BGP speaker SHALL calculate the degree of preference for 1371 each external route based on the locally configured policy, and 1372 include the degree of preference when advertising a route to its 1373 internal peers. The higher degree of preference MUST be preferred. A 1374 BGP speaker uses the degree of preference learned via LOCAL_PREF in 1375 its Decision Process (see Section 9.1.1). 1377 A BGP speaker MUST NOT include this attribute in UPDATE messages that 1378 it sends to external peers, except for the case of BGP Confederations 1379 [RFC3065]. If it is contained in an UPDATE message that is received 1380 from an external peer, then this attribute MUST be ignored by the 1381 receiving speaker, except for the case of BGP Confederations 1382 [RF3065]. 1384 5.1.6 ATOMIC_AGGREGATE 1386 ATOMIC_AGGREGATE is a well-known discretionary attribute. 1388 When a BGP speaker aggregates several routes for the purpose of 1389 advertisement to a particular peer, the AS_PATH of the aggregated 1390 route normally includes an AS_SET formed from the set of ASs from 1391 which the aggregate was formed. In many cases the network adminis- 1392 trator can determine that the aggregate can safely be advertised 1393 without the AS_SET and not form route loops. 1395 If an aggregate excludes at least some of the AS numbers present in 1396 the AS_PATH of the routes that are aggregated as a result of dropping 1397 the AS_SET, the aggregated route, when advertised to the peer, SHOULD 1398 include the ATOMIC_AGGREGATE attribute. 1400 A BGP speaker that receives a route with the ATOMIC_AGGREGATE 1401 attribute SHOULD NOT remove the attribute from the route when propa- 1402 gating it to other speakers. 1404 A BGP speaker that receives a route with the ATOMIC_AGGREGATE 1405 attribute MUST NOT make any NLRI of that route more specific (as 1406 defined in 9.1.4) when advertising this route to other BGP speakers. 1408 RFC DRAFT November 2003 1410 A BGP speaker that receives a route with the ATOMIC_AGGREGATE 1411 attribute needs to be aware of the fact that the actual path to des- 1412 tinations, as specified in the NLRI of the route, while having the 1413 loop-free property, may not be the path specified in the AS_PATH 1414 attribute of the route. 1416 5.1.7 AGGREGATOR 1418 AGGREGATOR is an optional transitive attribute which MAY be included 1419 in updates which are formed by aggregation (see Section 9.2.2.2). A 1420 BGP speaker which performs route aggregation MAY add the AGGREGATOR 1421 attribute which SHALL contain its own AS number and IP address. The 1422 IP address SHOULD be the same as the BGP Identifier of the speaker. 1424 6. BGP Error Handling. 1426 This section describes actions to be taken when errors are detected 1427 while processing BGP messages. 1429 When any of the conditions described here are detected, a NOTIFICA- 1430 TION message with the indicated Error Code, Error Subcode, and Data 1431 fields is sent, and the BGP connection is closed, unless it is 1432 explicitly stated that no NOTIFICATION message is to be sent and the 1433 BGP connection is not to be closed. If no Error Subcode is specified, 1434 then a zero MUST be used. 1436 The phrase "the BGP connection is closed" means that the TCP connec- 1437 tion has been closed, the associated Adj-RIB-In has been cleared, and 1438 that all resources for that BGP connection have been deallocated. 1439 Entries in the Loc-RIB associated with the remote peer are marked as 1440 invalid. The local system recalculates its best routes for the des- 1441 tinations of the routes marked as invalid, and before the invalid 1442 routes are deleted from the system advertises to its peers either 1443 withdraws for the routes marked as invalid, or the new best routes 1444 before the invalid routes are deleted from the system. 1446 Unless specified explicitly, the Data field of the NOTIFICATION mes- 1447 sage that is sent to indicate an error is empty. 1449 6.1 Message Header error handling. 1451 All errors detected while processing the Message Header MUST be 1452 RFC DRAFT November 2003 1454 indicated by sending the NOTIFICATION message with Error Code Message 1455 Header Error. The Error Subcode elaborates on the specific nature of 1456 the error. 1458 The expected value of the Marker field of the message header is all 1459 ones. If the Marker field of the message header is not as expected, 1460 then a synchronization error has occurred and the Error Subcode MUST 1461 be set to Connection Not Synchronized. 1463 If at least one of the following is true: 1465 - if the Length field of the message header is less than 19 or 1466 greater than 4096, or 1468 - if the Length field of an OPEN message is less than the minimum 1469 length of the OPEN message, or 1471 - if the Length field of an UPDATE message is less than the mini- 1472 mum length of the UPDATE message, or 1474 - if the Length field of a KEEPALIVE message is not equal to 19, 1475 or 1477 - if the Length field of a NOTIFICATION message is less than the 1478 minimum length of the NOTIFICATION message, 1480 then the Error Subcode MUST be set to Bad Message Length. The Data 1481 field MUST contain the erroneous Length field. 1483 If the Type field of the message header is not recognized, then the 1484 Error Subcode MUST be set to Bad Message Type. The Data field MUST 1485 contain the erroneous Type field. 1487 6.2 OPEN message error handling. 1489 All errors detected while processing the OPEN message MUST be indi- 1490 cated by sending the NOTIFICATION message with Error Code OPEN Mes- 1491 sage Error. The Error Subcode elaborates on the specific nature of 1492 the error. 1494 If the version number contained in the Version field of the received 1495 OPEN message is not supported, then the Error Subcode MUST be set to 1496 Unsupported Version Number. The Data field is a 2-octets unsigned 1497 integer, which indicates the largest locally supported version number 1498 less than the version the remote BGP peer bid (as indicated in the 1499 received OPEN message), or if the smallest locally supported version 1500 RFC DRAFT November 2003 1502 number is greater than the version the remote BGP peer bid, then the 1503 smallest locally supported version number. 1505 If the Autonomous System field of the OPEN message is unacceptable, 1506 then the Error Subcode MUST be set to Bad Peer AS. The determination 1507 of acceptable Autonomous System numbers is outside the scope of this 1508 protocol. 1510 If the Hold Time field of the OPEN message is unacceptable, then the 1511 Error Subcode MUST be set to Unacceptable Hold Time. An implementa- 1512 tion MUST reject Hold Time values of one or two seconds. An imple- 1513 mentation MAY reject any proposed Hold Time. An implementation which 1514 accepts a Hold Time MUST use the negotiated value for the Hold Time. 1516 If the BGP Identifier field of the OPEN message is syntactically 1517 incorrect, then the Error Subcode MUST be set to Bad BGP Identifier. 1518 Syntactic correctness means that the BGP Identifier field represents 1519 a valid unicast IP host address. 1521 If one of the Optional Parameters in the OPEN message is not recog- 1522 nized, then the Error Subcode MUST be set to Unsupported Optional 1523 Parameters. 1525 If one of the Optional Parameters in the OPEN message is recognized, 1526 but is malformed, then the Error Subcode MUST be set to 0 (Unspe- 1527 cific). 1529 6.3 UPDATE message error handling. 1531 All errors detected while processing the UPDATE message MUST be indi- 1532 cated by sending the NOTIFICATION message with Error Code UPDATE Mes- 1533 sage Error. The error subcode elaborates on the specific nature of 1534 the error. 1536 Error checking of an UPDATE message begins by examining the path 1537 attributes. If the Withdrawn Routes Length or Total Attribute Length 1538 is too large (i.e., if Withdrawn Routes Length + Total Attribute 1539 Length + 23 exceeds the message Length), then the Error Subcode MUST 1540 be set to Malformed Attribute List. 1542 If any recognized attribute has Attribute Flags that conflict with 1543 the Attribute Type Code, then the Error Subcode MUST be set to 1544 Attribute Flags Error. The Data field MUST contain the erroneous 1545 attribute (type, length and value). 1547 If any recognized attribute has Attribute Length that conflicts with 1548 RFC DRAFT November 2003 1550 the expected length (based on the attribute type code), then the 1551 Error Subcode MUST be set to Attribute Length Error. The Data field 1552 MUST contain the erroneous attribute (type, length and value). 1554 If any of the mandatory well-known attributes are not present, then 1555 the Error Subcode MUST be set to Missing Well-known Attribute. The 1556 Data field MUST contain the Attribute Type Code of the missing well- 1557 known attribute. 1559 If any of the mandatory well-known attributes are not recognized, 1560 then the Error Subcode MUST be set to Unrecognized Well-known 1561 Attribute. The Data field MUST contain the unrecognized attribute 1562 (type, length and value). 1564 If the ORIGIN attribute has an undefined value, then the Error Sub- 1565 code MUST be set to Invalid Origin Attribute. The Data field MUST 1566 contain the unrecognized attribute (type, length and value). 1568 If the NEXT_HOP attribute field is syntactically incorrect, then the 1569 Error Subcode MUST be set to Invalid NEXT_HOP Attribute. The Data 1570 field MUST contain the incorrect attribute (type, length and value). 1571 Syntactic correctness means that the NEXT_HOP attribute represents a 1572 valid IP host address. 1574 The IP address in the NEXT_HOP MUST meet the following criteria to be 1575 considered semantically correct: 1577 a) It MUST NOT be the IP address of the receiving speaker 1579 b) In the case of an EBGP where the sender and receiver are one IP 1580 hop away from each other, either the IP address in the NEXT_HOP 1581 MUST be the sender's IP address (that is used to establish the BGP 1582 connection), or the interface associated with the NEXT_HOP IP 1583 address MUST share a common subnet with the receiving BGP speaker. 1585 If the NEXT_HOP attribute is semantically incorrect, the error SHOULD 1586 be logged, and the route SHOULD be ignored. In this case, a NOTIFICA- 1587 TION message SHOULD NOT be sent, and connection SHOULD NOT be closed. 1589 The AS_PATH attribute is checked for syntactic correctness. If the 1590 path is syntactically incorrect, then the Error Subcode MUST be set 1591 to Malformed AS_PATH. 1593 If the UPDATE message is received from an external peer, the local 1594 system MAY check whether the leftmost (with respect to the position 1595 of octets in the protocol message) AS in the AS_PATH attribute is 1596 equal to the autonomous system number of the peer that sent the mes- 1597 sage. If the check determines that this is not the case, the Error 1598 RFC DRAFT November 2003 1600 Subcode MUST be set to Malformed AS_PATH. 1602 If an optional attribute is recognized, then the value of this 1603 attribute MUST be checked. If an error is detected, the attribute 1604 MUST be discarded, and the Error Subcode MUST be set to Optional 1605 Attribute Error. The Data field MUST contain the attribute (type, 1606 length and value). 1608 If any attribute appears more than once in the UPDATE message, then 1609 the Error Subcode MUST be set to Malformed Attribute List. 1611 The NLRI field in the UPDATE message is checked for syntactic valid- 1612 ity. If the field is syntactically incorrect, then the Error Subcode 1613 MUST be set to Invalid Network Field. 1615 If a prefix in the NLRI field is semantically incorrect (e.g., an 1616 unexpected multicast IP address), an error SHOULD be logged locally, 1617 and the prefix SHOULD be ignored. 1619 An UPDATE message that contains correct path attributes, but no NLRI, 1620 SHALL be treated as a valid UPDATE message. 1622 6.4 NOTIFICATION message error handling. 1624 If a peer sends a NOTIFICATION message, and the receiver of the mes- 1625 sage detects an error in that message, the receiver can not use a 1626 NOTIFICATION message to report this error back to the peer. Any such 1627 error, such as an unrecognized Error Code or Error Subcode, SHOULD be 1628 noticed, logged locally, and brought to the attention of the adminis- 1629 tration of the peer. The means to do this, however, lies outside the 1630 scope of this document. 1632 6.5 Hold Timer Expired error handling. 1634 If a system does not receive successive KEEPALIVE and/or UPDATE 1635 and/or NOTIFICATION messages within the period specified in the Hold 1636 Time field of the OPEN message, then the NOTIFICATION message with 1637 Hold Timer Expired Error Code is sent and the BGP connection is 1638 closed. 1640 RFC DRAFT November 2003 1642 6.6 Finite State Machine error handling. 1644 Any error detected by the BGP Finite State Machine (e.g., receipt of 1645 an unexpected event) is indicated by sending the NOTIFICATION message 1646 with Error Code Finite State Machine Error. 1648 6.7 Cease. 1650 In absence of any fatal errors (that are indicated in this section), 1651 a BGP peer MAY choose at any given time to close its BGP connection 1652 by sending the NOTIFICATION message with Error Code Cease. However, 1653 the Cease NOTIFICATION message MUST NOT be used when a fatal error 1654 indicated by this section does exist. 1656 A BGP speaker MAY support the ability to impose an (locally config- 1657 ured) upper bound on the number of address prefixes the speaker is 1658 willing to accept from a neighbor. When the upper bound is reached, 1659 the speaker (under control of local configuration) either (a) dis- 1660 cards new address prefixes from the neighbor (while maintaining BGP 1661 connection with the neighbor), or (b) terminates the BGP connection 1662 with the neighbor. If the BGP speaker decides to terminate its BGP 1663 connection with a neighbor because the number of address prefixes 1664 received from the neighbor exceeds the locally configured upper 1665 bound, then the speaker MUST send to the neighbor a NOTIFICATION mes- 1666 sage with the Error Code Cease. The speaker MAY also log this 1667 locally. 1669 6.8 BGP connection collision detection. 1671 If a pair of BGP speakers try simultaneously to establish a BGP con- 1672 nection to each other, then two parallel connections between this 1673 pair of speakers might well be formed. If the source IP address used 1674 by one of these connections is the same as the destination IP address 1675 used by the other, and the destination IP address used by the first 1676 connection is the same as the source IP address used by the other, we 1677 refer to this situation as connection collision. Clearly in the 1678 presence of connection collision, one of these connections MUST be 1679 closed. 1681 Based on the value of the BGP Identifier a convention is established 1682 for detecting which BGP connection is to be preserved when a colli- 1683 sion does occur. The convention is to compare the BGP Identifiers of 1684 the peers involved in the collision and to retain only the connection 1685 RFC DRAFT November 2003 1687 initiated by the BGP speaker with the higher-valued BGP Identifier. 1689 Upon receipt of an OPEN message, the local system MUST examine all of 1690 its connections that are in the OpenConfirm state. A BGP speaker MAY 1691 also examine connections in an OpenSent state if it knows the BGP 1692 Identifier of the peer by means outside of the protocol. If among 1693 these connections there is a connection to a remote BGP speaker whose 1694 BGP Identifier equals the one in the OPEN message, and this connec- 1695 tion collides with the connection over which the OPEN message is 1696 received then the local system performs the following collision reso- 1697 lution procedure: 1699 1. The BGP Identifier of the local system is compared to the BGP 1700 Identifier of the remote system (as specified in the OPEN mes- 1701 sage). Comparing BGP Identifiers is done by converting them to 1702 host byte order and treating them as (4-octet long) unsigned inte- 1703 gers. 1705 2. If the value of the local BGP Identifier is less than the 1706 remote one, the local system closes the BGP connection that 1707 already exists (the one that is already in the OpenConfirm state), 1708 and accepts the BGP connection initiated by the remote system. 1710 3. Otherwise, the local system closes newly created BGP connection 1711 (the one associated with the newly received OPEN message), and 1712 continues to use the existing one (the one that is already in the 1713 OpenConfirm state). 1715 Unless allowed via configuration, a connection collision with an 1716 existing BGP connection that is in Established state causes closing 1717 of the newly created connection. 1719 Note that a connection collision can not be detected with connections 1720 that are in Idle, or Connect, or Active states. 1722 Closing the BGP connection (that results from the collision resolu- 1723 tion procedure) is accomplished by sending the NOTIFICATION message 1724 with the Error Code Cease. 1726 7. BGP Version Negotiation 1728 BGP speakers MAY negotiate the version of the protocol by making mul- 1729 tiple attempts to open a BGP connection, starting with the highest 1730 version number each supports. If an open attempt fails with an Error 1731 Code OPEN Message Error, and an Error Subcode Unsupported Version 1732 Number, then the BGP speaker has available the version number it 1733 RFC DRAFT November 2003 1735 tried, the version number its peer tried, the version number passed 1736 by its peer in the NOTIFICATION message, and the version numbers that 1737 it supports. If the two peers do support one or more common versions, 1738 then this will allow them to rapidly determine the highest common 1739 version. In order to support BGP version negotiation, future versions 1740 of BGP MUST retain the format of the OPEN and NOTIFICATION messages. 1742 8. BGP Finite State machine (FSM) 1744 The data structures and FSM described in this document are 1745 conceptual and do not have to be implemented precisely as described 1746 here, as long as the implementations support the described 1747 functionality and their externally visible behavior is the same. 1749 This section specifies the BGP operation in terms of a Finite State 1750 Machine (FSM). The section falls into 2 parts: 1752 1) Description of Events for the State machine (Section 8.1) 1753 2) Description of the FSM (Section 8.2) 1755 Session attributes required (mandatory) for each connection are: 1757 1) State 1758 2) ConnectRetryCounter 1759 3) ConnectRetryTimer 1760 4) ConnectRetryTime 1761 5) HoldTimer 1762 6) HoldTime 1763 7) KeepaliveTimer 1764 8) KeepaliveTime 1766 The state session attribute indicates what state the BGP FSM 1767 is in. The ConnectRetryCounter indicates the number of times 1768 a BGP peer has tried to establish a peer session. 1770 The mandatory attributes related to timers are described in 1771 section 10. Each timer has a "timer" and a "time" (the initial 1772 value). 1774 The optional Session attributes are listed below. These optional 1775 attributes may be supported either per connection or per local sys- 1776 tem: 1778 1) AcceptConnectionsUnconfiguredPeers 1779 2) AllowAutomaticStart 1780 3) AllowAutomaticStop 1781 RFC DRAFT November 2003 1783 4) CollisionDetectEstablishedState 1784 5) DampPeerOscillations 1785 6) DelayOpen 1786 7) DelayOpenTime 1787 8) DelayOpenTimer 1788 9) IdleHoldTime 1789 10) IdleHoldTimer 1790 11) PassiveTcpEstablishment 1791 12) SendNOTIFICATIONwithoutOPEN 1792 13) TrackTcpState 1794 The optional session attributes support different features of the BGP 1795 functionality that have implications for the BGP FSM state 1796 transitions. Two groups of the attributes which relate to timers are: 1797 group 1: DelayOpen, DelayOpenTime, DelayOpenTimer 1798 group 2: DampPeerOscillations, IdleHoldTime, IdleHoldTimer 1800 The first parameter (DelayOpen, DampPeerOscillations) is an 1801 optional attribute that indicates that the Timer function is 1802 active. The "Time" value specifies the initial value for "Timer" 1803 (DelayOpenTime, IdleHoldTime). The "Timer" specifies the actual timer. 1805 Please refer to section 8.1.1 for an explanation 1806 of the interaction between these optional attributes and the events 1807 signaled to the state machine. Section 8.2.1.3 also provides 1808 a short overview of the different types of optional attributes 1809 (flags or timers). 1811 8.1 Events for the BGP FSM 1813 8.1.1 Optional Events linked to Optional Session attributes 1815 The Inputs to the BGP FSM are events. Events can either be 1816 mandatory or optional. Some optional events are linked to 1817 optional session attributes. Optional session attributes enable 1818 several groups of FSM functionality. 1820 The description below describes the linkage between FSM 1821 functionality, events and the optional session attributes. 1823 RFC DRAFT November 2003 1825 Group 1: Automatic Administrative Events (Start/Stop) 1827 Optional Session Attributes: AllowAutomaticStart, AllowAutomaticStop, 1828 DampPeerOscillations, IdleHoldTime, 1829 IdleHoldTimer 1831 Option 1: AllowAutomaticStart 1833 Description: A BGP peer connection can be started and stopped 1834 by administrative control. This administrative 1835 control can either be manual, based on 1836 operator intervention, or under the control 1837 of logic specific to a BGP implementation. 1838 The term "automatic" refers to a start being 1839 issued to the BGP peer connection FSM when 1840 such logic determines that the BGP peer 1841 connection should be restarted. 1843 The AllowAutomaticStart attribute specifies 1844 that this BGP connection supports automatic 1845 starting of the BGP connection. 1847 If the BGP implementation supports 1848 AllowAutomaticStart, the peer may be 1849 repeatedly restarted. Three other options 1850 control the rate at which the automatic 1851 restart occurs: DampPeerOscillations, 1852 IdleHoldTime, and the IdleHoldTimer. 1854 The DampPeerOscillations option specifies 1855 that the implementation engages additional 1856 logic to damp the oscillations of BGP peers 1857 in the face of sequences of automatic start 1858 and automatic stop. IdleHoldTime specifies 1859 how long the BGP peer is held in the Idle 1860 state prior to allowing the next automatic 1861 restart. The IdleHoldTimer is the timer 1862 that runs to hold the peer in Idle state. 1864 An example of DampPeerOscillations logic 1865 is an increase of the IdleHoldTime value 1866 if a BGP peer oscillates connectivity 1867 (connected/disconnected) repeatedly 1868 within a time period. To engage this 1869 logic, a peer could connect and disconnect 1870 10 times within 5 minutes. The IdleHoldTime 1871 value would be reset from 0 to 120 seconds. 1873 RFC DRAFT November 2003 1875 Values: TRUE or FALSE 1877 Option 2: AllowAutomaticStop 1879 Description: This BGP peer session optional attribute 1880 indicates that the BGP connection allows 1881 "automatic" stopping of the BGP connection. 1882 An "automatic" stop is defined as a stop under 1883 the control of implementation specific logic. 1884 The implementation specific logic is outside 1885 the scope of this specification. 1887 Values: TRUE or FALSE 1889 Option 3: DampPeerOscillations 1891 Description: The DampPeerOscillations optional session 1892 attribute indicates that this BGP connection 1893 is using logic that damps BGP peer oscillations 1894 in the Idle State. 1896 Value: TRUE or FALSE 1898 Option 4: IdleHoldTime 1900 Description: The IdleHoldTime is the value 1901 that is set in the IdleHoldTimer. 1903 Values: Time in seconds 1905 Option 5: IdleHoldTimer 1907 Description: The IdleHoldTimer aids in controlling BGP peer 1908 oscillation. The IdleHoldTimer is used to keep 1909 the BGP peer in Idle for a particular duration. 1910 The IdleHoldTimer_Expires event is described 1911 in section 8.1.3. 1913 Values: Time in seconds 1915 Group 2: Unconfigured Peers 1917 Optional Session Attributes: AcceptConnectionsUnconfiguredPeers 1918 RFC DRAFT November 2003 1920 Option 1: AcceptConnectionsUnconfiguredPeers 1922 Description: The BGP FSM optionally allows the acceptance of BGP 1923 peer connections from neighbors that are not 1924 pre-configured. The 1925 "AcceptConnectionsUnconfiguredPeers" optional 1926 session attribute allows the FSM to support 1927 the state transitions that allow the 1928 implementation to accept or reject these 1929 unconfigured peers. 1931 The AcceptConnectionsUnconfiguredPeers has 1932 security implications. Please refer to the 1933 BGP Vulnerabilities document[BGP_VULN] for 1934 details. 1936 Value: True or False 1938 Group 3: TCP processing 1940 Optional Session Attributes: PassiveTcpEstablishment, TrackTcpState 1942 Option 1: PassiveTcpEstablishment 1944 Description: This option indicates that the BGP FSM will passively 1945 wait for the remote BGP peer to establish the BGP 1946 TCP connection. 1948 value: TRUE or FALSE 1950 Option 2: TrackTcpState 1952 Description: The BGP FSM normally tracks the end result of a TCP 1953 connection attempt rather than individual TCP messages. 1954 Optionally, the BGP FSM can support additional 1955 interaction with the TCP connection negotiation. The 1956 interaction with the TCP events may increase the 1957 amount of logging the BGP peer connection 1958 requires and the number of BGP FSM changes. 1960 Value: TRUE or FALSE 1962 Group 4: BGP Message Processing 1964 Optional Session Attributes: DelayOpen, DelayOpenTime, 1965 DelayOpenTimer, 1966 RFC DRAFT November 2003 1968 SendNOTIFICATIONwithoutOPEN, 1969 CollisionDetectEstablishedState 1971 Option 1: DelayOpen 1973 Description: The DelayOpen optional session attribute allows 1974 implementations to be configured to delay 1975 sending an OPEN message for a specific time 1976 period (DelayOpenTime). The delay allows 1977 the remote BGP Peer time to send the first 1978 OPEN message. 1980 Value: TRUE or FALSE 1982 Option 2: DelayOpenTime 1984 Description: The DelayOpenTime is the initial value that is 1985 set in the DelayOpenTimer. 1987 Value: Time in seconds 1989 Option 3: DelayOpenTimer 1991 Description: The DelayOpenTimer optional session attribute 1992 is used to delay the sending of an OPEN message 1993 on a connection. The DelayOpenTimer_Expires event 1994 (Event 12) is described in section 8.1.3. 1996 Value: Time in seconds 1998 Option 4: SendNOTIFICATIONwithoutOPEN 2000 Description: The SendNOTIFICATIONwithoutOPEN allows a peer to 2001 send a NOTIFICATION without first sending an 2002 OPEN message. Without this optional session 2003 attribute, the BGP connection assumes that an 2004 OPEN message must be sent by a peer prior 2005 to the peer sending a NOTIFICATION message. 2007 Value: True or False 2009 Option 5: CollisionDetectEstablishedState 2011 Description: Normally, a Detect Collision (6.8) will 2012 be ignored in the Established state. This 2013 RFC DRAFT November 2003 2015 optional session attribute indicates that 2016 this BGP connection processes 2017 collisions in the Established state. 2019 Value: True or False 2021 Note: The optional session attributes clarify the BGP FSM description 2022 for existing features of BGP implementations. The optional 2023 session attributes may be pre-defined for an implementation 2024 and not readable via management interfaces for existing 2025 correct implementations. As newer BGP MIBs (version 2 2026 and beyond) are supported, these fields will be accessible 2027 via a management interface. 2029 8.1.2 Administrative Events 2031 An administrative event is an event in which the operator interface 2032 and BGP Policy engine signal the BGP finite state machine to start or 2033 stop the BGP state machine. The basic start and stop indication are 2034 augmented by optional connection attributes to signal a certain type 2035 of start or stop mechanism to the BGP FSM. An example of this combi- 2036 nation is Event 5, AutomaticStart_with_PassiveTcpEstablishment. With 2037 this event, the BGP implementation signals to the BGP FSM that the 2038 implementation is using an Automatic Start with option to use a Pas- 2039 sive TCP Establishment. The Passive TCP establishment signals that 2040 this BGP FSM will wait for the remote side to start the TCP estab- 2041 lishment. 2043 Please note that only Event 1 (ManualStart) and Event 2 (ManualStop) 2044 are mandatory administrative events. All other administrative events 2045 are optional (Events 3-8). Each event below has a name, definition, 2046 status (mandatory or optional), and what optional session attributes 2047 SHOULD be set at each stage. When generating Event 1 through Event 8 2048 for the BGP FSM, the conditions specified in the "Optional Attribute 2049 Status" section are verified. If any of these conditions are not 2050 satisfied, then the local system should log a FSM error. 2052 The settings of optional session attributes may be implicit in some 2053 implementations and therefore may not be set explicitly by an exter- 2054 nal operator action. Section 8.2.1.5 describes these implicit set- 2055 tings of the optional session attributes. The administrative states 2056 described below may also be implicit in some implementations and not 2057 directly configurable by an external operator. 2059 RFC DRAFT November 2003 2061 Event 1: ManualStart 2063 Definition: Local system administrator manually starts peer 2064 connection. 2066 Status: Mandatory 2068 Optional 2069 Attribute 2070 Status: The PassiveTcpEstablishment attribute SHOULD be 2071 set to FALSE. 2073 Event 2: ManualStop 2075 Definition: Local system administrator manually 2076 stops the peer connection. 2078 Status: Mandatory 2080 Optional 2081 Attribute 2082 Status: No interaction with any optional attributes. 2084 Event 3: AutomaticStart 2086 Definition: Local system automatically starts the 2087 BGP connection. 2089 Status: Optional, depending on local system 2091 Optional 2092 Attribute 2093 Status: 1) The AllowAutomaticStart attribute SHOULD be set 2094 to TRUE if this event occurs. 2095 2) If the PassiveTcpEstablishment optional session 2096 attribute is supported, it SHOULD be set to FALSE. 2097 3) If the DampPeerOscillations is supported, it 2098 SHOULD be set to FALSE when this event occurs. 2100 Event 4: ManualStart_with_PassiveTcpEstablishment 2102 Definition: Local system administrator manually starts peer 2103 connection, but has PassiveTcpEstablishment 2104 enabled. The PassiveTcpEstablishment optional 2105 attribute indicates that the peer will listen prior 2106 to establishing the connection. 2108 RFC DRAFT November 2003 2110 Status: Optional, depending on local system 2112 Optional 2113 Attribute 2114 Status: 1) The PassiveTcpEstablishment attribute SHOULD 2115 be set to TRUE if this event occurs. 2116 2) The DampPeerOscillations attribute SHOULD be 2117 set to FALSE when this event occurs. 2119 Event 5: AutomaticStart_with_PassiveTcpEstablishment 2121 Definition: Local system automatically starts the 2122 BGP connection with the PassiveTcpEstablishment 2123 enabled. The PassiveTcpEstablishment 2124 optional attribute indicates 2125 that the peer will listen prior to 2126 establishing a connection. 2128 Status: Optional, depending on local system 2130 Optional 2131 Attribute 2132 Status: 1) The AllowAutomaticStart attribute SHOULD 2133 be set to TRUE. 2134 2) The PassiveTcpEstablishment attribute SHOULD 2135 be set to TRUE 2136 3) If the DampPeerOscillations attribute is 2137 supported, the DampPeerOscillations SHOULD 2138 be set to FALSE. 2140 Event 6: AutomaticStart_with_DampPeerOscillations 2142 Definition: Local system automatically starts the 2143 BGP peer connection with peer oscillation 2144 damping enabled. The exact method of damping 2145 persistent peer oscillations is left up to the 2146 implementation and is outside the scope of 2147 this document. 2149 Status: Optional, depending on local system. 2151 Optional 2152 Attribute 2153 Status: 1) The AllowAutomaticStart attribute SHOULD 2154 be set to TRUE. 2156 RFC DRAFT November 2003 2158 2) The DampPeerOscillations attribute SHOULD 2159 be set to TRUE. 2160 3) The PassiveTcpEstablishment attribute 2161 SHOULD be set to FALSE. 2163 Event 7: AutomaticStart_with_DampPeerOscillations_and_ 2164 PassiveTcpEstablishment 2166 Definition: Local system automatically starts the 2167 BGP peer connection with peer oscillation 2168 damping enabled and PassiveTcpEstablishment 2169 enabled. The exact method of damping 2170 persistent peer oscillations is left up to the 2171 implementation and is outside the scope of 2172 this document. 2174 Status: Optional, depending on local system 2176 Optional 2177 Attributes 2178 Status: 1) The AllowAutomaticStart attribute 2179 SHOULD be set to TRUE. 2180 2) The DampPeerOscillations attribute SHOULD 2181 be set to TRUE. 2182 3) The PassiveTcpEstablishment attribute 2183 SHOULD be set to TRUE. 2185 Event 8: AutomaticStop 2187 Definition: Local system automatically stops the 2188 BGP connection. 2190 An example of an automatic stop event is 2191 exceeding the number of prefixes for a given 2192 peer and the local system automatically 2193 disconnecting the peer. 2195 Status: Optional, depending on local system 2197 Optional 2198 Attribute 2199 Status: 1) The AllowAutomaticStop attribute 2200 SHOULD be TRUE 2201 RFC DRAFT November 2003 2203 8.1.3 Timer Events 2205 Event 9: ConnectRetryTimer_Expires 2207 Definition: An event generated when the ConnectRetryTimer 2208 expires. 2210 Status: Mandatory 2212 Event 10: HoldTimer_Expires 2214 Definition: An event generated when the HoldTimer expires. 2216 Status: Mandatory 2218 Event 11: KeepaliveTimer_Expires 2220 Definition: An event generated when the KeepaliveTimer expires. 2221 Status: Mandatory 2223 Event 12: DelayOpenTimer_Expires 2225 Definition: An event generated when the DelayOpenTimer expires. 2227 Status: Optional 2229 Optional 2230 Attribute 2231 Status: If this event occurs, 2232 1) DelayOpen attribute SHOULD be set to TRUE, 2233 2) DelayOpenTime attribute SHOULD be supported, 2234 3) DelayOpenTimer SHOULD be supported, 2236 Event 13: IdleHoldTimer_Expires 2238 Definition: An event generated when the IdleHoldTimer 2239 expires indicating that the BGP connection has 2240 completed waiting for the back-off period 2241 to prevent BGP peer oscillation. 2243 The IdleHoldTimer is only used when the 2244 persistent peer oscillation damping 2245 function is enabled by setting the 2246 DampPeerOscillations optional attribute 2247 RFC DRAFT November 2003 2249 to TRUE. 2251 Implementations not implementing the 2252 persistent peer oscillation damping 2253 function may not have the IdleHoldTimer. 2255 Status: Optional 2257 Optional 2258 Attribute 2259 Status: If this event occurs: 2260 1) DampPeerOscillations attribute SHOULD be set 2261 to TRUE. 2262 2) IdleHoldTimer SHOULD have just expired. 2264 8.1.4 TCP Connection based Events 2266 Event 14: TcpConnection_Valid 2268 Definition: Event indicating the local system reception of 2269 a TCP connection request with a valid 2270 source IP address and TCP port and a valid 2271 destination IP address and TCP Port. The 2272 definition of invalid source and invalid 2273 destination IP address is left to the 2274 implementation. 2276 BGP's destination port SHOULD be port 179 2277 as defined by IANA. 2279 TCP connection request is denoted by the 2280 local system receiving a TCP SYN. 2282 Status: Optional 2284 Optional 2285 Attribute 2286 Status: 1) The TrackTcpState attribute SHOULD be set to 2287 TRUE if this event occurs. 2289 Event 15: Tcp_CR_Invalid 2291 Definition: Event indicating the local system reception 2292 of a TCP connection request with either 2293 RFC DRAFT November 2003 2295 an invalid source address or port 2296 number or an invalid destination 2297 address or port number. 2299 BGP destination port number SHOULD be 179 2300 as defined by IANA. 2302 A TCP connection request occurs when 2303 the local system receives a TCP 2304 SYN. 2306 Status: Optional 2308 Optional 2309 Attribute 2310 Status: 1) The TrackTcpState attribute should be set to 2311 TRUE if this event occurs. 2313 Event 16: Tcp_CR_Acked 2315 Definition: Event indicating the local system's request 2316 to establish a TCP connection to the remote 2317 peer. 2319 The local system's TCP connection sent a TCP 2320 SYN, and received a TCP SYN/ACK message, 2321 and sent a TCP ACK. 2323 Status: Mandatory 2325 Event 17: TcpConnectionConfirmed 2327 Definition: Event indicating that the local system has 2328 received a confirmation that the TCP 2329 connection has been established by the 2330 remote site. 2332 The remote peer's TCP engine sent a TCP SYN. 2333 The local peer's TCP engine sent a SYN, ACK 2334 message and now has received a final ACK. 2336 Status: Mandatory 2338 Event 18: TcpConnectionFails 2340 Definition: Event indicating that the local system has 2341 received a TCP connection failure notice. 2343 RFC DRAFT November 2003 2345 The remote BGP peer's TCP machine could have 2346 sent a FIN. The local peer would respond 2347 with a FIN-ACK. Another alternative is that 2348 the local peer indicated a timeout in the 2349 TCP connection and downed the connection. 2351 Status: Mandatory 2353 8.1.5 BGP Message-based Events 2355 Event 19: BGPOpen 2357 Definition: An event is generated when a valid OPEN 2358 message has been received. 2360 Status: Mandatory 2362 Optional 2363 Attribute 2364 Status: 1) The DelayOpen optional attribute SHOULD 2365 be set to FALSE. 2366 2) The DelayOpenTimer SHOULD not be running. 2368 Event 20: BGPOpen with DelayOpenTimer running 2370 Definition: An event is generated when a valid OPEN 2371 message has been received for a peer 2372 that has a successfully established 2373 transport connection and is currently 2374 delaying the sending of a BGP open 2375 message. 2377 Status: Optional 2379 Optional 2380 Attribute 2381 Status: 1) The DelayOpen attribute SHOULD be 2382 set to TRUE. 2383 2) The DelayOpenTimer SHOULD be running. 2385 Event 21: BGPHeaderErr 2386 RFC DRAFT November 2003 2388 Definition: An event is generated when a received 2389 BGP message header is not valid. 2391 Status: Mandatory 2393 Event 22: BGPOpenMsgErr 2395 Definition: An event is generated when an OPEN message 2396 has been received with errors. 2398 Status: Mandatory 2400 Event 23: OpenCollisionDump 2402 Definition: An event generated administratively 2403 when a connection collision has been 2404 detected while processing an incoming 2405 OPEN message and this connection has been 2406 selected to be disconnected. See section 2407 6.8 for more information on collision 2408 detection. 2410 Event 23 is an administrative action 2411 generated by implementation logic 2412 that determines that this connection 2413 needs to be dropped per the rules in 2414 section 6.8. This event may occur if the FSM 2415 is implemented as two linked state machines. 2417 Status: Optional 2419 Optional 2420 Attribute 2421 Status: If the state machine is to process this 2422 event in Established state, 2423 1) CollisionDetectEstablishedState 2424 optional attribute SHOULD be set to TRUE 2426 Please note: The OpenCollisionDump event can occur 2427 in Idle, Connect, Active, OpenSent, OpenConfirm 2428 without any optional attributes being set. 2430 Event 24: NotifMsgVerErr 2432 Definition: An event is generated when a 2433 RFC DRAFT November 2003 2435 NOTIFICATION message with "version 2436 error" is received. 2438 Status: Mandatory 2440 Event 25: NotifMsg 2442 Definition: An event is generated when a 2443 NOTIFICATION message is received and 2444 the error code is anything but 2445 "version error". 2447 Status: Mandatory 2449 Event 26: KeepAliveMsg 2451 Definition: An event is generated when a KEEPALIVE 2452 message is received. 2454 Status: Mandatory 2456 Event 27: UpdateMsg 2458 Definition: An event is generated when a valid 2459 UPDATE message is received. 2461 Status: Mandatory 2463 Event 28: UpdateMsgErr 2465 Definition: An event is generated when an invalid 2466 UPDATE message is received. 2468 Status: Mandatory 2470 8.2 Description of FSM 2472 8.2.1 FSM Definition 2474 BGP MUST maintain a separate FSM for each configured peer. Each BGP 2475 peer paired in a potential connection, unless configured to remain in 2476 the idle state, or configured to remain passive, will attempt to con- 2477 nect to the other. For the purpose of this discussion, the active or 2478 RFC DRAFT November 2003 2480 connecting side of the TCP connection (the side of a TCP connection 2481 sending the first TCP SYN packet) is called outgoing. The passive or 2482 listening side (the sender of the first SYN/ACK) is called an incom- 2483 ing connection. (See Section 8.2.1.1 for information on the terms 2484 active and passive used below.) 2486 A BGP implementation MUST connect to and listen on TCP port 179 for 2487 incoming connections in addition to trying to connect to peers. For 2488 each incoming connection, a state machine MUST be instantiated. 2489 There exists a period in which the identity of the peer on the other 2490 end of an incoming connection is known, but the BGP identifier is not 2491 known. During this time, both an incoming and an outgoing connection 2492 for the same configured peering may exist. This is referred to as a 2493 connection collision. (See Section 6.8.) 2495 A BGP implementation will have at most one FSM for each configured 2496 peering plus one FSM for each incoming TCP connection for which the 2497 peer has not yet been identified. Each FSM corresponds to exactly one 2498 TCP connection. 2500 There may be more than one connection between a pair of peers if the 2501 connections are configured to use a different pair of IP addresses. 2502 This is referred to as multiple "configured peerings" to the same 2503 peer. 2505 8.2.1.1 Terms "active" and "passive" 2507 The terms active and passive have been in the Internet operator's 2508 vocabulary for almost a decade and have proven useful. The words 2509 active and passive have slightly different meanings applied to a TCP 2510 connection or applied to a peer. There is only one active side and 2511 one passive side to any one TCP connection per the definition above 2512 and the state machine below. When a BGP speaker is configured active, 2513 it may end up on either the active or passive side of the connection 2514 that eventually gets established. Once the TCP connection is com- 2515 pleted, it doesn't matter which end was active and which end was pas- 2516 sive. The only difference is which side of the TCP connection has 2517 port number 179. 2519 8.2.1.2 FSM and collision detection 2521 There is one FSM per BGP connection. When the connection collision 2522 occurs prior to determining what peer a connection is associated 2523 RFC DRAFT November 2003 2525 with, there may be two connections for one peer. After the connec- 2526 tion collision is resolved (see Section 6.8) the FSM for the connec- 2527 tion that is closed SHOULD be disposed of. 2529 8.2.1.3 FSM and Optional Session Attributes 2531 Optional Session Attributes specify either attributes that act 2532 as flags (TRUE or FALSE) or optional timers. For optional 2533 attributes that act as flags, if the optional session attribute 2534 can be set to TRUE on the system, the corresponding the BGP FSM 2535 actions must be supported. For example, if the following options 2536 can be set in a BGP implementation: AutoStart and 2537 PassiveTcpEstablishment, then the Events 3, 4 and 5 must be 2538 supported. If an Optional Session attribute cannot be set to 2539 TRUE, the events supporting that set of options do not have to 2540 be supported. 2542 Each of the optional timers (DelayOpenTimer and IdleHoldTimer), 2543 has a group of attributes that are: 2545 - flag indicating support, 2546 - Time set in Timer 2547 - Timer. 2549 The two optional timers show this format: 2551 DelayOpenTimer: DelayOpen, DelayOpenTime, DelayOpenTimer 2552 IdleHoldTimer: DampPeerOscillations, IdleHoldTime, 2553 IdleHoldTimer 2555 If the flag indicating support for an optional timer 2556 (DelayOpen or DampPeerOscillations), cannot be set to TRUE, 2557 the timers and events supporting that 2558 option do not have to be supported. 2560 8.2.1.4 FSM Event numbers 2562 The Event numbers (1-28) utilized in this state machine description 2563 aid in specifying the behavior of the BGP state machine. Implementa- 2564 tions MAY use these numbers to provide network management informa- 2565 tion. The exact form of a FSM or the FSM events are specific to each 2566 implementation. 2568 RFC DRAFT November 2003 2570 8.2.1.5 FSM actions that are implementation dependent. 2572 The BGP FSM specifies at certain points that BGP initialization will 2573 occur or that BGP resources will be deleted. The initialization of 2574 the BGP FSM and the associated resources depend on the policy portion 2575 of the BGP implementation. The details of these actions are outside 2576 the scope of the FSM document. 2578 8.2.2 Finite State Machine 2580 Idle state: 2582 Initially the BGP peer FSM is in the Idle state. (Hereafter 2583 the BGP peer FSM will be shortened to BGP FSM.) 2585 In this state BGP FSM refuses all incoming BGP 2586 connections for this peer. No resources are allocated to the peer. 2587 In response to a ManualStart event (Event 1) or an 2588 AutomaticStart event (Event 3), the local system: 2589 - initializes all BGP resources for the peer connection, 2590 - sets ConnectRetryCounter to zero, 2591 - starts the ConnectRetryTimer with initial value, 2592 - initiates a TCP connection to the other BGP peer, 2593 - listens for a connection that may be initiated by 2594 the remote BGP peer, and 2595 - changes its state to Connect. 2597 The ManualStop event (Event 2) and AutomaticStop (Event 8) event 2598 are ignored in the Idle state. 2600 In response to a ManualStart_with_PassiveTcpEstablishment event 2601 (Event 4) or AutomaticStart_with_PassiveTcpEstablishment event 2602 (Event 5), the local system: 2603 - initializes all BGP resources, 2604 - sets the ConnectRetryCounter to zero, 2605 - starts the ConnectRetryTimer with initial value, 2606 - listens for a connection that may be initiated by 2607 the remote peer, and 2608 - changes its state to Active. 2610 The exact value of the ConnectRetryTimer is a local 2611 matter, but it SHOULD be sufficiently large to allow TCP 2612 initialization. 2614 If the DampPeerOscillations attribute is set to TRUE, 2615 RFC DRAFT November 2003 2617 the following three additional events may occur 2618 within Idle state: 2619 - AutomaticStart_with_DampPeerOscillations (Event 6), 2620 - AutomaticStart_with_DampPeerOscillations_and_ 2621 PassiveTcpEstablishment (Event 7), 2622 - IdleHoldTimer_Expires (Event 13). 2624 Upon receiving these 3 events, the local system will 2625 use these events to prevent peer oscillations. 2626 The method of preventing persistent peer oscillation is 2627 outside the scope of this document. 2629 Any other event (Events 9-12, 15-28) received in the Idle state 2630 does not cause change in the state of the local system. 2632 Connect State: 2634 In this state, BGP FSM is waiting for the TCP connection to 2635 be completed. 2637 The start events (Events 1, 3-7) are ignored in connect 2638 state. 2640 In response to a ManualStop event (Event 2), the local system: 2641 - drops the TCP connection, 2642 - releases all BGP resources, 2643 - sets ConnectRetryCounter to zero, 2644 - stops the ConnectRetryTimer and sets ConnectRetryTimer 2645 to zero, and 2646 - changes its state to Idle. 2648 In response to the ConnectRetryTimer_Expires event (Event 9), 2649 the local system: 2650 - drops the TCP connection, 2651 - restarts the ConnectRetryTimer, 2652 - stops the DelayOpenTimer and resets the timer to zero, 2653 - initiates a TCP connection to the other BGP peer, 2654 - continues to listen for a connection that may be 2655 initiated by the remote BGP peer, and 2656 - stays in Connect state. 2658 If the DelayOpenTimer_Expires event (Event 12) occurs in the 2659 Connect state, the local system: 2660 - sends an OPEN message to its peer, 2661 - sets the HoldTimer to a large value, and 2662 RFC DRAFT November 2003 2664 - changes its state to OpenSent. 2666 If the BGP FSM receives a TcpConnection_Valid event 2667 (Event 14), the TCP connection is processed, and 2668 the connection remains in the Connect state. 2670 If the BGP FSM receives a Tcp_CR_Invalid event (Event 15), 2671 the local system rejects the TCP connection, and the connection 2672 remains in the Connect state. 2674 If the TCP connection succeeds (Event 16 or Event 17), 2675 the local system checks the DelayOpen attribute prior 2676 to processing. If the DelayOpen attribute is set to TRUE, 2677 the local system: 2678 - stops the ConnectRetryTimer (if running) and sets the 2679 ConnectRetryTimer to zero, 2680 - sets the DelayOpenTimer to the initial value, and 2681 - stays in the Connect state. 2682 If the DelayOpen attribute is set to FALSE, the local system: 2683 - stops the ConnectRetryTimer (if running) and sets the 2684 ConnectRetryTimer to zero, 2685 - completes BGP initialization 2686 - sends an OPEN message to its peer, 2687 - sets HoldTimer to a large value, and 2688 - changes its state to OpenSent. 2690 A HoldTimer value of 4 minutes is suggested. 2692 If the TCP connection fails (Event 18), the local system 2693 checks the DelayOpenTimer. If the DelayOpenTimer is running, 2694 the local system: 2695 - restarts the ConnectRetryTimer with initial value, 2696 - stops the DelayOpenTimer and resets its value to zero, 2697 - continues to listen for a connection that may be 2698 initiated by the remote BGP peer, and 2699 - changes its state to Active. 2701 If the DelayOpenTimer is not running, the local system: 2702 - stops the ConnectRetryTimer to zero, 2703 - drops the TCP connection, 2704 - releases all BGP resources, and 2705 - changes its state to Idle. 2707 If an OPEN message is received while the DelayOpenTimer is 2708 running (Event 20), the local system: 2710 - stops the ConnectRetryTimer (if running) and 2711 sets the ConnectRetryTimer to zero, 2712 RFC DRAFT November 2003 2714 - completes the BGP initialization, 2715 - stops and clears the DelayOpenTimer 2716 (sets the value to zero), 2717 - sends an OPEN message, 2718 - sends a KEEPALIVE message, 2719 - if the HoldTimer initial value is non-zero, 2720 - starts the KeepaliveTimer with the initial value and 2721 - resets the HoldTimer to the negotiated value, 2722 else if HoldTimer initial value is zero, 2723 - resets the KeepaliveTimer and 2724 - resets the HoldTimer value to zero, 2725 - and changes its state to OpenConfirm. 2727 If the value of the autonomous system field is the same as the local 2728 Autonomous System number, set the connection status to an internal 2729 connection; otherwise it is "external". 2731 If BGP message header checking detects an error (Event 21) or 2732 OPEN message checking detects an error (Event 22) (see section 2733 6.2), the local system: 2734 - (optionally) If the SendNOTIFICATIONwithoutOPEN attribute 2735 is set to TRUE, then the local system first sends 2736 a NOTIFICATION message with the appropriate error 2737 code, and then 2739 - stops the ConnectRetryTimer (if running) 2740 and sets the ConnectRetryTimer to zero, 2741 - releases all BGP resources, 2742 - drops the TCP connection, 2743 - increments the ConnectRetryCounter by 1, 2744 - (optionally) performs peer oscillation damping 2745 if the DampPeerOscillations attribute is set to TRUE, and 2746 - changes its state to Idle. 2748 If a NOTIFICATION message is received with a version 2749 error (Event 24), the local system checks the DelayOpenTimer. 2750 If the DelayOpenTimer is running, the local system: 2751 - stops the ConnectRetryTimer (if running) 2752 and sets the ConnectRetryTimer to zero, 2753 - stops and resets the DelayOpenTimer (sets to zero), 2754 - releases all BGP resources, 2755 - drops the TCP connection, and 2756 - changes its state to Idle. 2758 If the DelayOpenTimer is not running, the local system: 2759 - stops the ConnectRetryTimer and sets the 2760 ConnectRetryTimer to zero, 2761 - releases all BGP resources, 2762 RFC DRAFT November 2003 2764 - drops the TCP connection, 2765 - increments the ConnectRetryCounter by 1, 2766 - performs peer oscillation damping if the 2767 DampPeerOscillations attribute is set to True, and 2768 - changes its state to Idle. 2770 In response to any other events (Events 8,10-11,13,19,23, 2771 25-28) the local system: 2772 - if the ConnectRetryTimer is running, 2773 stops and resets the ConnectRetryTimer (sets to zero), 2774 - if the DelayOpenTimer is running, 2775 stops and resets the DelayOpenTimer (sets to zero), 2776 - releases all BGP resources, 2777 - drops the TCP connection, 2778 - increments the ConnectRetryCounter by 1, 2779 - performs peer oscillation damping if the 2780 DampPeerOscillations attribute is set to True, and 2781 - changes its state to Idle. 2783 Active State: 2785 In this state BGP FSM is trying to acquire a peer by listening 2786 for and accepting a TCP connection. 2788 The start events (Events 1, 3-7) are ignored in the Active 2789 state. 2791 In response to a ManualStop event (Event 2), the local system: 2792 - If the DelayOpenTimer is running and the 2793 SendNOTIFICATIONwithoutOPEN session attribute is set, 2794 the local system sends a NOTIFICATION with a Cease, 2795 - releases all BGP resources including 2796 stopping the DelayOpenTimer 2797 - drops the TCP connection, 2798 - sets ConnectRetryCounter to zero, 2799 - stops the ConnectRetryTimer and sets the 2800 ConnectRetryTimer to zero, and 2801 - changes its state to Idle. 2803 In response to a ConnectRetryTimer_Expires event (Event 9), 2804 the local system: 2805 - restarts the ConnectRetryTimer (with initial value), 2806 - initiates a TCP connection to the other BGP peer, 2807 - continues to listen for TCP connection that may be 2808 initiated by remote BGP peer, and 2809 RFC DRAFT November 2003 2811 - changes its state to Connect. 2813 If the local system receives a DelayOpenTimer_Expires event 2814 (Event 12), the local system: 2815 - sets the ConnectRetryTimer to zero, 2816 - stops and clears the DelayOpenTimer (set to zero), 2817 - completes the BGP initialization, 2818 - sends the OPEN message to its remote peer, 2819 - sets its hold timer to a large value, and 2820 - changes its state to OpenSent. 2822 A HoldTimer value of 4 minutes is also suggested for this 2823 state transition. 2825 If the local system receives a TcpConnection_Valid event 2826 (Event 14), the local system processes the TCP connection 2827 flags and stays in Active state. 2829 If the local system receives an Tcp_CR_Invalid event (Event 15): 2830 the local system rejects the TCP connection and stays in 2831 the Active State. 2833 In response to a TCP connection succeeding (Event 16 or Event 17), 2834 the local system checks the DelayOpen optional attribute prior to 2835 processing. 2836 If the DelayOpen attribute is set to TRUE, the local 2837 system: 2838 - stops the ConnectRetryTimer and sets the 2839 ConnectRetryTimer to zero, 2840 - sets the DelayOpenTimer to the initial value 2841 (DelayOpenTime), and 2842 - stays in the Active state. 2843 If the DelayOpen attribute is set to FALSE, the local 2844 system: 2845 - sets the ConnectRetryTimer to zero, 2846 - completes the BGP initialization, 2847 - sends the OPEN message to its peer, 2848 - sets its HoldTimer to a large value, and 2849 - changes its state to OpenSent. 2851 A HoldTimer value of 4 minutes is suggested as a "large value" for 2852 the HoldTimer. 2854 If the local system receives a TcpConnectionFails event (Event 18), 2855 the local system: 2857 RFC DRAFT November 2003 2859 - restarts ConnectRetryTimer (with initial value), 2860 - stops and clears the DelayOpenTimer (sets the value to zero), 2861 - releases all BGP resource, 2862 - increments ConnectRetryCounter by 1, 2863 - optionally performs peer oscillation damping if 2864 the DampPeerOscillations attribute is set to TRUE, and 2865 - changes its state to Idle. 2867 If an OPEN message is received and the DelayOpenTimer is 2868 running (Event 20), the local system: 2869 - stops ConnectRetryTimer (if running) and sets 2870 the ConnectRetryTimer to zero, 2871 - stops and clears DelayOpenTimer (sets to zero), 2872 - completes the BGP initialization, 2873 - sends an OPEN message, 2874 - sends a KEEPALIVE message, 2875 - if the HoldTimer value is non-zero, 2876 - starts the KeepaliveTimer to initial value, 2877 - resets the HoldTimer to the negotiated value, 2878 else if the HoldTimer is zero 2879 - resets the KeepaliveTimer (set to zero), 2880 - resets the HoldTimer to zero, and 2881 - changes its state to OpenConfirm. 2883 If the value of the autonomous system field is the same as 2884 the local Autonomous System number, set the connection status 2885 to an internal connection; otherwise it is external. 2887 If BGP message header checking detects an error (Event 21) 2888 or OPEN message checking detects an error (Event 22) (see 2889 section 6.2), the local system: 2890 - (optionally) sends a NOTIFICATION message with the 2891 appropriate error code if the SendNOTIFICATIONwithoutOPEN 2892 attribute is set to TRUE, 2893 - sets the ConnectRetryTimer to zero, 2894 - releases all BGP resources, 2895 - drops the TCP connection, 2896 - increments the ConnectRetryCounter by 1, 2897 - (optionally) performs peer oscillation damping if the 2898 DampPeerOscillations attribute is set to TRUE, and 2899 - changes its state to Idle. 2901 If a NOTIFICATION message is received with a version 2902 error (Event 24), the local system checks the DelayOpenTimer. 2903 If the DelayOpenTimer is running, the local system: 2904 - stops the ConnectRetryTimer (if running) and 2905 sets the ConnectRetryTimer to zero, 2906 RFC DRAFT November 2003 2908 - stops and resets the DelayOpenTimer (sets to zero), 2909 - releases all BGP resources, 2910 - drops the TCP connection, and 2911 - changes its state to Idle. 2912 If the DelayOpenTimer is not running, the local system: 2913 - sets the ConnectRetryTimer to zero, 2914 - releases all BGP resources, 2915 - drops the TCP connection, 2916 - increments the ConnectRetryCounter by 1, 2917 - (optionally) performs peer oscillation damping 2918 if the DampPeerOscillations attribute is set to TRUE, and 2919 - changes its state to Idle. 2921 In response to any other event (Events 8,10-11,13,19,23,25-28), 2922 the local system: 2923 - sets the ConnectRetryTimer to zero, 2924 - releases all BGP resources, 2925 - drops the TCP connection, 2926 - increments the ConnectRetryCounter by one, 2927 - (optionally) performs peer oscillation damping if 2928 the DampPeerOscillations attribute is set to TRUE, and 2929 - changes its state to Idle. 2931 OpenSent: 2933 In this state BGP FSM waits for an OPEN message from its peer. 2935 The start events (Events 1, 3-7) are ignored in the OpenSent 2936 state. 2938 If a ManualStop event (Event 2) is issued in OpenSent 2939 state, the local system: 2940 - sends the NOTIFICATION with a cease, 2941 - sets the ConnectRetryTimer to zero, 2942 - releases all BGP resources, 2943 - drops the TCP connection, 2944 - sets the ConnectRetryCounter to zero, and 2945 - changes its state to Idle. 2947 If an AutomaticStop event (Event 8) is issued in OpenSent 2948 state, the local system: 2949 - sends the NOTIFICATION with a cease, 2950 - sets the ConnectRetryTimer to zero, 2951 - releases all the BGP resources, 2952 - drops the TCP connection, 2953 - increments the ConnectRetryCounter by 1, 2954 - (optionally) performs peer oscillation damping if the 2955 RFC DRAFT November 2003 2957 DampPeerOscillations attribute is set to TRUE, and 2958 - changes its state to Idle. 2960 If the HoldTimer_Expires (Event 10), the local system: 2961 - sends a NOTIFICATION message with error code Hold 2962 Timer Expired, 2963 - sets the ConnectRetryTimer to zero, 2964 - releases all BGP resources, 2965 - drops the TCP connection, 2966 - increments the ConnectRetryCounter, 2967 - (optionally) performs peer oscillation damping if the 2968 DampPeerOscillations attribute is set to TRUE, and 2969 - changes its state to Idle. 2971 If a TcpConnection_Valid (Event 14) or Tcp_CR_Acked (Event 16) 2972 is received, or a TcpConnectionConfirmed event (Event 17) is 2973 received, a second TCP connection may be in progress. This 2974 second TCP connection is tracked per Connection Collision 2975 processing (Section 6.8) until an OPEN message is received. 2977 A TCP Connection Request for an Invalid port 2978 (Tcp_CR_Invalid (Event 15)) is ignored. 2980 If a TcpConnectionFails event (Event 18) is received, 2981 the local system: 2982 - closes the BGP connection, 2983 - restarts the ConnectRetryTimer, 2984 - continues to listen for a connection that may be 2985 initiated by the remote BGP peer, and 2986 - changes its state to Active. 2988 When an OPEN message is received, all fields are checked 2989 for correctness. If there are no errors in the OPEN message 2990 (Event 19), the local system: 2991 - resets the DelayOpenTimer to zero, 2992 - sets the BGP ConnectRetryTimer to zero, 2993 - sends a KEEPALIVE message, and 2994 - sets a KeepaliveTimer (via the text below) 2995 - sets the HoldTimer according to the negotiated value 2996 (see Section 4.2), 2997 - changes its state to OpenConfirm. 2999 If the negotiated hold time value is zero, then the HoldTimer and 3000 KeepaliveTimer are not started. If the value of the Autonomous 3001 System field is the same as the local Autonomous System number, 3002 then the connection is an "internal" connection; otherwise, it 3003 is an "external" connection. (This will impact UPDATE processing 3004 RFC DRAFT November 2003 3006 as described below.) 3008 If the BGP message header checking (Event 21) or OPEN message 3009 check detects an error (Event 22)(see Section 6.2), the local system: 3010 - sends a NOTIFICATION message with appropriate error 3011 code, 3012 - sets the ConnectRetryTimer to zero, 3013 - releases all BGP resources, 3014 - drops the TCP connection, 3015 - increments the ConnectRetryCounter by 1, 3016 - (optionally) performs peer oscillation damping if the 3017 DampPeerOscillations attribute is TRUE, and 3018 - changes its state to Idle. 3020 Collision detection mechanisms (Section 6.8) need to be 3021 applied when a valid BGP OPEN message is received (Event 19 or 3022 Event 20). Please refer to Section 6.8 for the details of 3023 the comparison. A CollisionDetectDump event occurs when the 3024 BGP implementation determines, by a means outside the scope of 3025 this document, that a connection collision has occurred. 3027 If a connection in OpenSent state is determined to be the 3028 connection that must be closed, an OpenCollisionDump (Event 23) 3029 is signaled to the state machine. If such an event is 3030 received in OpenSent state, the local system: 3031 - sends a NOTIFICATION with a Cease 3032 - sets the ConnectRetryTimer to zero, 3033 - releases all BGP resources, 3034 - drops the TCP connection, 3035 - increments ConnectRetryCounter by 1, 3036 - (optionally) performs peer oscillation damping if the 3037 DampPeerOscillations attribute is set to TRUE, and 3038 - changes its state to Idle. 3040 If a NOTIFICATION message is received with a version 3041 error (Event 24), the local system: 3042 - sets the ConnectRetryTimer to zero, 3043 - releases all BGP resources, 3044 - drops the TCP connection, and 3045 - changes its state to Idle. 3047 In response to any other event (Events 9, 11-13,20,25-28), 3048 the local system: 3049 - sends the NOTIFICATION with the Error Code Finite 3050 state machine error, 3051 - sets the ConnectRetryTimer to zero, 3052 RFC DRAFT November 2003 3054 - releases all BGP resources, 3055 - drops the TCP connection, 3056 - increments the ConnectRetryCounter by 1, 3057 - (optionally) performs peer oscillation damping if the 3058 DampPeerOscillations attribute is set to TRUE, and 3059 - changes its state to Idle. 3061 OpenConfirm State: 3063 In this state BGP waits for a KEEPALIVE or NOTIFICATION 3064 message. 3066 Any start event (Events 1, 3-7) is ignored in the OpenConfirm 3067 state. 3069 In response to a ManualStop event (Event 2) initiated by 3070 the operator, the local system: 3071 - sends the NOTIFICATION message with Cease, 3072 - releases all BGP resources, 3073 - drops the TCP connection, 3074 - sets the ConnectRetryCounter to zero, 3075 - sets the ConnectRetryTimer to zero, and 3076 - changes its state to Idle. 3078 In response to the AutomaticStop event initiated by the 3079 system (Event 8), the local system: 3080 - sends the NOTIFICATION message with Cease, 3081 - sets the ConnectRetryTimer to zero, 3082 - releases all BGP resources, 3083 - drops the TCP connection, 3084 - increments the ConnectRetryCounter by 1, 3085 - (optionally) performs peer oscillation damping 3086 if the DampPeerOscillations attribute is set to TRUE, 3087 and 3088 - changes its state to Idle. 3090 If the HoldTimer_Expires event (Event 10) occurs before a KEEPALIVE 3091 message is received, the local system: 3092 - sends the NOTIFICATION message with the error code, 3093 - sets the ConnectRetryTimer to zero, 3094 - releases all BGP resources, 3095 - drops the TCP connection, 3096 - increments the ConnectRetryCounter by 1, 3097 - (optionally) performs peer oscillation damping if 3098 RFC DRAFT November 2003 3100 the DampPeerOscillations attribute is set to TRUE, and 3101 - changes its state to Idle. 3103 If the local system receives a KeepaliveTimer_Expires 3104 event (Event 11), the system: 3105 - sends a KEEPALIVE message, 3106 - restarts the KeepaliveTimer, and 3107 - remains in OpenConfirmed state. 3109 In the event of TcpConnection_Valid event (Event 14), or TCP 3110 connection succeeding (Event 16 or Event 17) while in OpenConfirm, 3111 the local system needs to track the second connection. 3113 If a TCP connection is attempted to an invalid port (Event 15), 3114 the local system will ignore the second connection 3115 attempt. 3117 If the local system receives a TcpConnectionFails event 3118 (Event 18) from the underlying TCP or a NOTIFICATION 3119 message (Event 25), the local system: 3120 - sets the ConnectRetryTimer to zero, 3121 - releases all BGP resources, 3122 - drops the TCP connection, 3123 - increments the ConnectRetryCounter by 1, 3124 - (optionally) performs peer oscillation damping if the 3125 DampPeerOscillations attribute is set to TRUE, and 3126 - changes its state to Idle. 3128 If the local system receives a NOTIFICATION message with a 3129 version error (NotifMsgVerErr (Event 24)), the local system: 3130 - sets the ConnectRetryTimer to zero, 3131 - releases all BGP resources, 3132 - drops the TCP connection, and 3133 - changes its state to Idle. 3135 If the local system receives a valid OPEN message 3136 (BGPOpen (Event 19)), the collision detect function is 3137 processed per Section 6.8. If this connection is to be 3138 dropped due to connection collision, the local system: 3139 - sends a NOTIFICATION with a Cease, 3140 - sets the ConnectRetryTimer to zero, 3141 - releases all BGP resources, 3142 - drops the TCP connection (send TCP FIN), 3143 - increments the ConnectRetryCounter by 1, 3144 - (optionally) performs peer oscillation damping if the 3145 RFC DRAFT November 2003 3147 DampPeerOscillations attribute is set to TRUE, and 3148 - changes its state to Idle. 3150 If an OPEN message is received, all fields are checked for 3151 correctness. If the BGP message header checking 3152 (BGPHeaderErr (Event 21)) or OPEN message check detects 3153 an error (see Section 6.2) (BGPOpenMsgErr (Event 22)), the 3154 local system: 3155 - sends a NOTIFICATION message with appropriate error 3156 code, 3157 - sets the ConnectRetryTimer to zero, 3158 - releases all BGP resources, 3159 - drops the TCP connection, 3160 - increments the ConnectRetryCounter by 1, 3161 - (optionally) performs peer oscillation damping if the 3162 DampPeerOscillations attribute is set to TRUE, and 3163 - changes its state to Idle. 3165 If during the processing of another OPEN message, the BGP 3166 implementation determines by a means outside the scope of 3167 this document that a connection collision has occurred and 3168 this connection is to be closed, the local system will 3169 issue an OpenCollisionDump event (Event 23). When the local 3170 system receives an OpenCollisionDump event (Event 23), the 3171 local system: 3172 - sends a NOTIFICATION with a Cease 3173 - sets the ConnectRetryTimer to zero, 3174 - releases all BGP resources 3175 - drops the TCP connection, 3176 - increments the ConnectRetryCounter by 1, 3177 - (optionally) performs peer oscillation damping if the 3178 DampPeerOscillations attribute is set to TRUE, and 3179 - changes its state to Idle. 3181 If the local system receives a KEEPALIVE message 3182 (KeepAliveMsg (Event 26)), the local system: 3183 - restarts the HoldTimer and 3184 - changes its state to Established. 3186 In response to any other event (Events 9, 12-13, 20, 27-28), 3187 the local system: 3188 - sends a NOTIFICATION with a code of Finite State 3189 Machine Error, 3190 - sets the ConnectRetryTimer to zero, 3191 - releases all BGP resources, 3192 RFC DRAFT November 2003 3194 - drops the TCP connection, 3195 - increments the ConnectRetryCounter by 1, 3196 - (optionally) performs peer oscillation damping if the 3197 DampPeerOscillations attribute is set to TRUE, and 3198 - changes its state to Idle. 3200 Established State: 3202 In the Established state, the BGP FSM can exchange UPDATE, 3203 NOTIFICATION, and KEEPALIVE messages with its peer. 3205 Any Start event (Events 1, 3-7) is ignored in the 3206 Established state. 3208 In response to a ManualStop event (initiated by an 3209 operator) (Event 2), the local system: 3210 - sends the NOTIFICATION message with Cease, 3211 - sets the ConnectRetryTimer to zero, 3212 - deletes all routes associated with this connection, 3213 - releases BGP resources, 3214 - drops the TCP connection, 3215 - sets ConnectRetryCounter to zero, and 3216 - changes its state to Idle. 3218 In response to an AutomaticStop event (Event 8), the local system: 3219 - sends a NOTIFICATION with Cease, 3220 - sets the ConnectRetryTimer to zero 3221 - deletes all routes associated with this connection, 3222 - releases all BGP resources, 3223 - drops the TCP connection, 3224 - increments the ConnectRetryCounter by 1, 3225 - (optionally) performs peer oscillation damping if the 3226 DampPeerOscillations attribute is set to TRUE, and 3227 - changes its state to Idle. 3229 One reason for an AutomaticStop event is: A BGP receives 3230 UPDATE messages with number of prefixes for a given 3231 peer so that the total prefixes received exceeds the 3232 maximum number of prefixes configured. The local system 3233 automatically disconnects the peer. 3235 If the HoldTimer_Expires event occurs (Event 10), the 3236 local system: 3237 - sends a NOTIFICATION message with Error Code Hold 3238 Timer Expired, 3239 RFC DRAFT November 2003 3241 - sets the ConnectRetryTimer to zero, 3242 - releases all BGP resources, 3243 - drops the TCP connection, 3244 - increments the ConnectRetryCounter by 1, 3245 - (optionally) performs peer oscillation damping if the 3246 DampPeerOscillations attribute is set to TRUE, and 3247 - changes its state to Idle. 3249 If the KeepaliveTimer_Expires event occurs (Event 11), 3250 the local system: 3251 - sends a KEEPALIVE message, and 3252 - restarts its KeepaliveTimer unless the negotiated 3253 HoldTime value is zero. 3255 Each time the local system sends a KEEPALIVE or UPDATE 3256 message, it restarts its KeepaliveTimer, unless the 3257 negotiated HoldTime value is zero. 3259 A TcpConnection_Valid (Event 14) received for a 3260 valid port will cause the second connection to be 3261 tracked. 3263 An invalid TCP connection (Tcp_CR_Invalid event 3264 (Event 15)), will be ignored. 3266 In response to an indication that the TCP connection 3267 is successfully established (Event 16 or Event 17), 3268 the second connection SHALL be tracked until 3269 it sends an OPEN message. 3271 If a valid OPEN message (BGPOpen (Event 19)) is received, 3272 and if the CollisionDetectEstablishedState optional 3273 attribute is TRUE, the OPEN message will be checked 3274 to see if it collides (Section 6.8) with any other connection. 3275 If the BGP implementation determines that this connection 3276 needs to be terminated, it will process an OpenCollisionDump 3277 event (Event 23). If this connection needs to be 3278 terminated, the local system: 3279 - sends a NOTIFICATION with a Cease, 3280 - sets the ConnectRetryTimer to zero, 3281 - deletes all routes associated with this connection, 3282 - releases all BGP resources, 3283 - drops the TCP connection, 3284 - increments ConnectRetryCounter by 1, 3285 - (optionally) performs peer oscillation damping if the 3286 DampPeerOscillations is set to TRUE, and 3287 - changes its state to Idle. 3289 RFC DRAFT November 2003 3291 If the local system receives a NOTIFICATION message 3292 (Event 24 or Event 25) or a TcpConnectionFails (Event 18) 3293 from the underlying TCP, it: 3294 - sets the ConnectRetryTimer to zero, 3295 - deletes all routes associated with this connection, 3296 - releases all the BGP resources, 3297 - drops the TCP connection, 3298 - increments the ConnectRetryCounter by 1, 3299 - changes its state to Idle. 3301 If the local system receives a KEEPALIVE message 3302 (Event 26), the local system: 3303 - restarts its HoldTimer, if the negotiated HoldTime 3304 value is non-zero, and 3305 - remains in the Established state. 3307 If the local system receives an UPDATE message (Event 27), 3308 the local system: 3309 - processes the message, 3310 - restarts its HoldTimer if the negotiated HoldTime 3311 value is non-zero, and 3312 - remains in the Established state. 3314 If the local system receives an UPDATE message, and the 3315 UPDATE message error handling procedure (see Section 6.3) 3316 detects an error (Event 28), the local system: 3317 - sends a NOTIFICATION message with Update error, 3318 - sets the ConnectRetryTimer to zero, 3319 - deletes all routes associated with this connection, 3320 - releases all BGP resources, 3321 - drops the TCP connection, 3322 - increments the ConnectRetryCounter by 1, 3323 - (optionally) performs peer oscillation damping if the 3324 DampPeerOscillations attribute is set to TRUE, and 3325 - changes its state to Idle. 3327 In response to any other event (Events 9, 12-13, 20-22) the 3328 local system: 3329 - sends a NOTIFICATION message with Error Code Finite 3330 State Machine Error, 3331 - deletes all routes associated with this connection, 3332 - sets the ConnectRetryTimer to zero, 3333 - releases all BGP resources, 3334 - drops the TCP connection, 3335 RFC DRAFT November 2003 3337 - increments the ConnectRetryCounter by 1, 3338 - (optionally) performs peer oscillation damping if the 3339 DampPeerOscillations attribute is set to TRUE, and 3340 - changes its state to Idle. 3342 9. UPDATE Message Handling 3344 An UPDATE message may be received only in the Established state. 3345 Receiving an UPDATE message in any other state is an error. When an 3346 UPDATE message is received, each field is checked for validity as 3347 specified in Section 6.3. 3349 If an optional non-transitive attribute is unrecognized, it is qui- 3350 etly ignored. If an optional transitive attribute is unrecognized, 3351 the Partial bit (the third high-order bit) in the attribute flags 3352 octet is set to 1, and the attribute is retained for propagation to 3353 other BGP speakers. 3355 If an optional attribute is recognized, and has a valid value, then, 3356 depending on the type of the optional attribute, it is processed 3357 locally, retained, and updated, if necessary, for possible propaga- 3358 tion to other BGP speakers. 3360 If the UPDATE message contains a non-empty WITHDRAWN ROUTES field, 3361 the previously advertised routes whose destinations (expressed as IP 3362 prefixes) contained in this field SHALL be removed from the Adj-RIB- 3363 In. This BGP speaker SHALL run its Decision Process since the previ- 3364 ously advertised route is no longer available for use. 3366 If the UPDATE message contains a feasible route, the Adj-RIB-In will 3367 be updated with this route as follows: if the NLRI of the new route 3368 is identical to the one of the route currently stored in the Adj-RIB- 3369 In, then the new route SHALL replace the older route in the Adj-RIB- 3370 In, thus implicitly withdrawing the older route from service. Other- 3371 wise, if the Adj-RIB-In has no route with NLRI identical to the new 3372 route, the new route SHALL be placed in the Adj-RIB-In. 3374 Once the BGP speaker updates the Adj-RIB-In, the speaker SHALL run 3375 its Decision Process. 3377 RFC DRAFT November 2003 3379 9.1 Decision Process 3381 The Decision Process selects routes for subsequent advertisement by 3382 applying the policies in the local Policy Information Base (PIB) to 3383 the routes stored in its Adj-RIBs-In. The output of the Decision Pro- 3384 cess is the set of routes that will be advertised to peers; the 3385 selected routes will be stored in the local speaker's Adj-RIBs-Out 3386 according to policy. 3388 The BGP Decision Process described here is conceptual, and does not 3389 have to be implemented precisely as described here, as long as the 3390 implementations support the described functionality and their exter- 3391 nally visible behavior is the same. 3393 The selection process is formalized by defining a function that takes 3394 the attribute of a given route as an argument and returns either (a) 3395 a non-negative integer denoting the degree of preference for the 3396 route, or (b) a value denoting that this route is ineligible to be 3397 installed in Loc-RIB and will be excluded from the next phase of 3398 route selection. 3400 The function that calculates the degree of preference for a given 3401 route SHALL NOT use as its inputs any of the following: the existence 3402 of other routes, the non-existence of other routes, or the path 3403 attributes of other routes. Route selection then consists of individ- 3404 ual application of the degree of preference function to each feasible 3405 route, followed by the choice of the one with the highest degree of 3406 preference. 3408 The Decision Process operates on routes contained in the Adj-RIBs-In, 3409 and is responsible for: 3411 - selection of routes to be used locally by the speaker 3413 - selection of routes to be advertised to other BGP peers 3415 - route aggregation and route information reduction 3417 The Decision Process takes place in three distinct phases, each trig- 3418 gered by a different event: 3420 a) Phase 1 is responsible for calculating the degree of preference 3421 for each route received from a peer. 3423 b) Phase 2 is invoked on completion of phase 1. It is responsible 3424 for choosing the best route out of all those available for each 3425 distinct destination, and for installing each chosen route into 3426 RFC DRAFT November 2003 3428 the Loc-RIB. 3430 c) Phase 3 is invoked after the Loc-RIB has been modified. It is 3431 responsible for disseminating routes in the Loc-RIB to each peer, 3432 according to the policies contained in the PIB. Route aggregation 3433 and information reduction can optionally be performed within this 3434 phase. 3436 9.1.1 Phase 1: Calculation of Degree of Preference 3438 The Phase 1 decision function is invoked whenever the local BGP 3439 speaker receives from a peer an UPDATE message that advertises a new 3440 route, a replacement route, or withdrawn routes. 3442 The Phase 1 decision function is a separate process which completes 3443 when it has no further work to do. 3445 The Phase 1 decision function locks an Adj-RIB-In prior to operating 3446 on any route contained within it, and unlocks it after operating on 3447 all new or unfeasible routes contained within it. 3449 For each newly received or replacement feasible route, the local BGP 3450 speaker determines a degree of preference as follows: 3452 If the route is learned from an internal peer, either the value of 3453 the LOCAL_PREF attribute is taken as the degree of preference, or 3454 the local system computes the degree of preference of the route 3455 based on preconfigured policy information. Note that the latter 3456 (computing the degree of preference based on preconfigured policy 3457 information) may result in formation of persistent routing loops. 3459 If the route is learned from an external peer, then the local BGP 3460 speaker computes the degree of preference based on preconfigured 3461 policy information. If the return value indicates that the route 3462 is ineligible, the route MAY NOT serve as an input to the next 3463 phase of route selection; otherwise the return value MUST be used 3464 as the LOCAL_PREF value in any IBGP readvertisement. 3466 The exact nature of this policy information and the computation 3467 involved is a local matter. 3469 9.1.2 Phase 2: Route Selection 3471 The Phase 2 decision function is invoked on completion of Phase 1. 3473 RFC DRAFT November 2003 3475 The Phase 2 function is a separate process which completes when it 3476 has no further work to do. The Phase 2 process considers all routes 3477 that are eligible in the Adj-RIBs-In. 3479 The Phase 2 decision function is blocked from running while the Phase 3480 3 decision function is in process. The Phase 2 function locks all 3481 Adj-RIBs-In prior to commencing its function, and unlocks them on 3482 completion. 3484 If the NEXT_HOP attribute of a BGP route depicts an address that is 3485 not resolvable, or it would become unresolvable if the route was 3486 installed in the routing table the BGP route MUST be excluded from 3487 the Phase 2 decision function. 3489 If the AS_PATH attribute of a BGP route contains an AS loop, the BGP 3490 route should be excluded from the Phase 2 decision function. AS loop 3491 detection is done by scanning the full AS path (as specified in the 3492 AS_PATH attribute), and checking that the autonomous system number of 3493 the local system does not appear in the AS path. Operations of a BGP 3494 speaker that is configured to accept routes with its own autonomous 3495 system number in the AS path are outside the scope of this document. 3497 It is critical that BGP speakers within an AS do not make conflicting 3498 decisions regarding route selection that would cause forwarding loops 3499 to occur. 3501 For each set of destinations for which a feasible route exists in the 3502 Adj-RIBs-In, the local BGP speaker identifies the route that has: 3504 a) the highest degree of preference of any route to the same set 3505 of destinations, or 3507 b) is the only route to that destination, or 3509 c) is selected as a result of the Phase 2 tie breaking rules spec- 3510 ified in 9.1.2.2. 3512 The local speaker SHALL then install that route in the Loc-RIB, 3513 replacing any route to the same destination that is currently being 3514 held in the Loc-RIB. When the new BGP route is installed in the Rout- 3515 ing Table, care must be taken to ensure that existing routes to the 3516 same destination that are now considered invalid are removed from the 3517 Routing Table. Whether or not the new BGP route replaces an existing 3518 non-BGP route in the Routing Table depends on the policy configured 3519 on the BGP speaker. 3521 The local speaker MUST determine the immediate next-hop address from 3522 the NEXT_HOP attribute of the selected route (see Section 5.1.3). If 3523 RFC DRAFT November 2003 3525 either the immediate next hop or the IGP cost to the NEXT_HOP (where 3526 the NEXT_HOP is resolved through an IGP route) changes, Phase 2 Route 3527 Selection MUST be performed again. 3529 Notice that even though BGP routes do not have to be installed in the 3530 Routing Table with the immediate next hop(s), implementations MUST 3531 take care that before any packets are forwarded along a BGP route, 3532 its associated NEXT_HOP address is resolved to the immediate 3533 (directly connected) next-hop address and this address (or multiple 3534 addresses) is finally used for actual packet forwarding. 3536 Unresolvable routes SHALL be removed from the Loc-RIB and the routing 3537 table. However, corresponding unresolvable routes SHOULD be kept in 3538 the Adj-RIBs-In (in case they become resolvable). 3540 9.1.2.1 Route Resolvability Condition 3542 As indicated in Section 9.1.2, BGP speakers SHOULD exclude unresolv- 3543 able routes from the Phase 2 decision. This ensures that only valid 3544 routes are installed in Loc-RIB and the Routing Table. 3546 The route resolvability condition is defined as follows. 3548 1. A route Rte1, referencing only the intermediate network 3549 address, is considered resolvable if the Routing Table contains at 3550 least one resolvable route Rte2 that matches Rte1's intermediate 3551 network address and is not recursively resolved (directly or indi- 3552 rectly) through Rte1. If multiple matching routes are available, 3553 only the longest matching route SHOULD be considered. 3555 2. Routes referencing interfaces (with or without intermediate 3556 addresses) are considered resolvable if the state of the refer- 3557 enced interface is up and IP processing is enabled on this inter- 3558 face. 3560 BGP routes do not refer to interfaces, but can be resolved through 3561 the routes in the Routing Table that can be of both types (those that 3562 specify interfaces or those that do not). IGP routes and routes to 3563 directly connected networks are expected to specify the outbound 3564 interface. Static routes can specify the outbound interface, or the 3565 intermediate address, or both. 3567 Note that a BGP route is considered unresolvable not only in situa- 3568 tions where the BGP speaker's Routing Table contains no route match- 3569 ing the BGP route's NEXT_HOP. Mutually recursive routes (routes 3570 resolving each other or themselves), also fail the resolvability 3571 RFC DRAFT November 2003 3573 check. 3575 It is also important that implementations do not consider feasible 3576 routes that would become unresolvable if they were installed in the 3577 Routing Table even if their NEXT_HOPs are resolvable using the cur- 3578 rent contents of the Routing Table (an example of such routes would 3579 be mutually recursive routes). This check ensures that a BGP speaker 3580 does not install in the Routing Table routes that will be removed and 3581 not used by the speaker. Therefore, in addition to local Routing 3582 Table stability, this check also improves behavior of the protocol in 3583 the network. 3585 Whenever a BGP speaker identifies a route that fails the resolvabil- 3586 ity check because of mutual recursion, an error message SHOULD be 3587 logged. 3589 9.1.2.2 Breaking Ties (Phase 2) 3591 In its Adj-RIBs-In a BGP speaker may have several routes to the same 3592 destination that have the same degree of preference. The local 3593 speaker can select only one of these routes for inclusion in the 3594 associated Loc-RIB. The local speaker considers all routes with the 3595 same degrees of preference, both those received from internal peers, 3596 and those received from external peers. 3598 The following tie-breaking procedure assumes that for each candidate 3599 route all the BGP speakers within an autonomous system can ascertain 3600 the cost of a path (interior distance) to the address depicted by the 3601 NEXT_HOP attribute of the route, and follow the same route selection 3602 algorithm. 3604 The tie-breaking algorithm begins by considering all equally prefer- 3605 able routes to the same destination, and then selects routes to be 3606 removed from consideration. The algorithm terminates as soon as only 3607 one route remains in consideration. The criteria MUST be applied in 3608 the order specified. 3610 Several of the criteria are described using pseudo-code. Note that 3611 the pseudo-code shown was chosen for clarity, not efficiency. It is 3612 not intended to specify any particular implementation. BGP implemen- 3613 tations MAY use any algorithm which produces the same results as 3614 those described here. 3616 a) Remove from consideration all routes which are not tied for 3617 having the smallest number of AS numbers present in their AS_PATH 3618 attributes. Note, that when counting this number, an AS_SET counts 3619 RFC DRAFT November 2003 3621 as 1, no matter how many ASs are in the set. 3623 b) Remove from consideration all routes which are not tied for 3624 having the lowest Origin number in their Origin attribute. 3626 c) Remove from consideration routes with less-preferred 3627 MULTI_EXIT_DISC attributes. MULTI_EXIT_DISC is only comparable 3628 between routes learned from the same neighboring AS (the neighbor- 3629 ing AS is determined from the AS_PATH attribute). Routes which do 3630 not have the MULTI_EXIT_DISC attribute are considered to have the 3631 lowest possible MULTI_EXIT_DISC value. 3633 This is also described in the following procedure: 3635 for m = all routes still under consideration 3636 for n = all routes still under consideration 3637 if (neighborAS(m) == neighborAS(n)) and (MED(n) < MED(m)) 3638 remove route m from consideration 3640 In the pseudo-code above, MED(n) is a function which returns the 3641 value of route n's MULTI_EXIT_DISC attribute. If route n has no 3642 MULTI_EXIT_DISC attribute, the function returns the lowest possi- 3643 ble MULTI_EXIT_DISC value, i.e. 0. 3645 Similarly, neighborAS(n) is a function which returns the neighbor 3646 AS from which the route was received. If the route is learned via 3647 IBGP, and the other IBGP speaker didn't originate the route, it is 3648 the neighbor AS from which the other IBGP speaker learned the 3649 route. If the route is learned via IBGP, and the other IBGP 3650 speaker either (a) originated the route, or (b) created the route 3651 by aggregation and the AS_PATH attribute of the aggregate route is 3652 either empty or begins with an AS_SET, it is the local AS. 3654 If a MULTI_EXIT_DISC attribute is removed before re-advertising a 3655 route into IBGP, then comparison based on the received EBGP 3656 MULTI_EXIT_DISC attribute MAY still be performed. If an implemen- 3657 tation chooses to remove MULTI_EXIT_DISC, then the optional com- 3658 parison on MULTI_EXIT_DISC if performed at all MUST be performed 3659 only among EBGP learned routes. The best EBGP learned route may 3660 then be compared with IBGP learned routes after the removal of the 3661 MULTI_EXIT_DISC attribute. If MULTI_EXIT_DISC is removed from a 3662 subset of EBGP learned routes and the selected "best" EBGP learned 3663 route will not have MULTI_EXIT_DISC removed, then the 3664 MULTI_EXIT_DISC must be used in the comparison with IBGP learned 3665 routes. For IBGP learned routes the MULTI_EXIT_DISC MUST be used 3666 in route comparisons which reach this step in the Decision Pro- 3667 cess. Including the MULTI_EXIT_DISC of an EBGP learned route in 3668 the comparison with an IBGP learned route, then removing the 3669 RFC DRAFT November 2003 3671 MULTI_EXIT_DISC attribute and advertising the route has been 3672 proven to cause route loops. 3674 d) If at least one of the candidate routes was received via EBGP, 3675 remove from consideration all routes which were received via IBGP. 3677 e) Remove from consideration any routes with less-preferred inte- 3678 rior cost. The interior cost of a route is determined by calcu- 3679 lating the metric to the NEXT_HOP for the route using the Routing 3680 Table. If the NEXT_HOP hop for a route is reachable, but no cost 3681 can be determined, then this step should be skipped (equivalently, 3682 consider all routes to have equal costs). 3684 This is also described in the following procedure. 3686 for m = all routes still under consideration 3687 for n = all routes in still under consideration 3688 if (cost(n) is lower than cost(m)) 3689 remove m from consideration 3691 In the pseudo-code above, cost(n) is a function which returns the 3692 cost of the path (interior distance) to the address given in the 3693 NEXT_HOP attribute of the route. 3695 f) Remove from consideration all routes other than the route that 3696 was advertised by the BGP speaker whose BGP Identifier has the 3697 lowest value. 3699 g) Prefer the route received from the lowest peer address. 3701 9.1.3 Phase 3: Route Dissemination 3703 The Phase 3 decision function is invoked on completion of Phase 2, or 3704 when any of the following events occur: 3706 a) when routes in the Loc-RIB to local destinations have changed 3708 b) when locally generated routes learned by means outside of BGP 3709 have changed 3711 c) when a new BGP speaker - BGP speaker connection has been estab- 3712 lished 3714 The Phase 3 function is a separate process which completes when it 3715 has no further work to do. The Phase 3 Routing Decision function is 3716 blocked from running while the Phase 2 decision function is in 3717 RFC DRAFT November 2003 3719 process. 3721 All routes in the Loc-RIB are processed into Adj-RIBs-Out according 3722 to configured policy. This policy MAY exclude a route in the Loc-RIB 3723 from being installed in a particular Adj-RIB-Out. A route SHALL NOT 3724 be installed in the Adj-Rib-Out unless the destination and NEXT_HOP 3725 described by this route may be forwarded appropriately by the Routing 3726 Table. If a route in Loc-RIB is excluded from a particular Adj-RIB- 3727 Out the previously advertised route in that Adj-RIB-Out MUST be with- 3728 drawn from service by means of an UPDATE message (see 9.2). 3730 Route aggregation and information reduction techniques (see 9.2.2.1) 3731 may optionally be applied. 3733 Any local policy which results in routes being added to an Adj-RIB- 3734 Out without also being added to the local BGP speaker's forwarding 3735 table, is outside the scope of this document. 3737 When the updating of the Adj-RIBs-Out and the Routing Table is com- 3738 plete, the local BGP speaker runs the Update-Send process of 9.2. 3740 9.1.4 Overlapping Routes 3742 A BGP speaker may transmit routes with overlapping Network Layer 3743 Reachability Information (NLRI) to another BGP speaker. NLRI overlap 3744 occurs when a set of destinations are identified in non-matching mul- 3745 tiple routes. Since BGP encodes NLRI using IP prefixes, overlap will 3746 always exhibit subset relationships. A route describing a smaller 3747 set of destinations (a longer prefix) is said to be more specific 3748 than a route describing a larger set of destinations (a shorter pre- 3749 fix); similarly, a route describing a larger set of destinations is 3750 said to be less specific than a route describing a smaller set of 3751 destinations. 3753 The precedence relationship effectively decomposes less specific 3754 routes into two parts: 3756 - a set of destinations described only by the less specific route, 3757 and 3759 - a set of destinations described by the overlap of the less spe- 3760 cific and the more specific routes 3762 The set of destinations described by the overlap represents a portion 3763 of the less specific route that is feasible, but is not currently in 3764 RFC DRAFT November 2003 3766 use. If a more specific route is later withdrawn, the set of desti- 3767 nations described by the overlap will still be reachable using the 3768 less specific route. 3770 If a BGP speaker receives overlapping routes, the Decision Process 3771 MUST consider both routes based on the configured acceptance policy. 3772 If both a less and a more specific route are accepted, then the Deci- 3773 sion Process MUST install in Loc-RIB either both the less and the 3774 more specific routes or aggregate the two routes and install in Loc- 3775 RIB the aggregated route, provided that both routes have the same 3776 value of the NEXT_HOP attribute. 3778 If a BGP speaker chooses to aggregate, then it SHOULD either include 3779 all AS used to form the aggregate in an AS_SET or add the 3780 ATOMIC_AGGREGATE attribute to the route. This attribute is now pri- 3781 marily informational. With the elimination of IP routing protocols 3782 that do not support classless routing and the elimination of router 3783 and host implementations that do not support classless routing, there 3784 is no longer a need to de-aggregate. Routes SHOULD NOT be de-aggre- 3785 gated. A route that carries ATOMIC_AGGREGATE attribute in particular 3786 MUST NOT be de-aggregated. That is, the NLRI of this route can not be 3787 made more specific. Forwarding along such a route does not guarantee 3788 that IP packets will actually traverse only ASs listed in the AS_PATH 3789 attribute of the route. 3791 9.2 Update-Send Process 3793 The Update-Send process is responsible for advertising UPDATE mes- 3794 sages to all peers. For example, it distributes the routes chosen by 3795 the Decision Process to other BGP speakers which may be located in 3796 either the same autonomous system or a neighboring autonomous system. 3798 When a BGP speaker receives an UPDATE message from an internal peer, 3799 the receiving BGP speaker SHALL NOT re-distribute the routing infor- 3800 mation contained in that UPDATE message to other internal peers 3801 (unless the speaker acts as a BGP Route Reflector [RFC2796]). 3803 As part of Phase 3 of the route selection process, the BGP speaker 3804 has updated its Adj-RIBs-Out. All newly installed routes and all 3805 newly unfeasible routes for which there is no replacement route SHALL 3806 be advertised to its peers by means of an UPDATE message. 3808 A BGP speaker SHOULD NOT advertise a given feasible BGP route from 3809 its Adj-RIB-Out if it would produce an UPDATE message containing the 3810 same BGP route as was previously advertised. 3812 RFC DRAFT November 2003 3814 Any routes in the Loc-RIB marked as unfeasible SHALL be removed. 3815 Changes to the reachable destinations within its own autonomous sys- 3816 tem SHALL also be advertised in an UPDATE message. 3818 If due to the limits on the maximum size of an UPDATE message (see 3819 Section 4) a single route doesn't fit into the message, the BGP 3820 speaker MUST not advertise the route to its peers and MAY choose to 3821 log an error locally. 3823 9.2.1 Controlling Routing Traffic Overhead 3825 The BGP protocol constrains the amount of routing traffic (that is, 3826 UPDATE messages) in order to limit both the link bandwidth needed to 3827 advertise UPDATE messages and the processing power needed by the 3828 Decision Process to digest the information contained in the UPDATE 3829 messages. 3831 9.2.1.1 Frequency of Route Advertisement 3833 The parameter MinRouteAdvertisementIntervalTimer determines the mini- 3834 mum amount of time that must elapse between advertisement and/or 3835 withdrawal of routes to a particular destination by a BGP speaker to 3836 a peer. This rate limiting procedure applies on a per-destination 3837 basis, although the value of MinRouteAdvertisementIntervalTimer is 3838 set on a per BGP peer basis. 3840 Two UPDATE messages sent by a BGP speaker to a peer that advertise 3841 feasible routes and/or withdrawal of unfeasible routes to some common 3842 set of destinations MUST be separated by at least MinRouteAdvertise- 3843 mentIntervalTimer. Clearly, this can only be achieved precisely by 3844 keeping a separate timer for each common set of destinations. This 3845 would be unwarranted overhead. Any technique which ensures that the 3846 interval between two UPDATE messages sent from a BGP speaker to a 3847 peer that advertise feasible routes and/or withdrawal of unfeasible 3848 routes to some common set of destinations will be at least Min- 3849 RouteAdvertisementIntervalTimer, and will also ensure a constant 3850 upper bound on the interval is acceptable. 3852 Since fast convergence is needed within an autonomous system, either 3853 (a) the MinRouteAdvertisementIntervalTimer used for internal peers 3854 SHOULD be shorter than the MinRouteAdvertisementIntervalTimer used 3855 for external peers, or (b) the procedure describe in this section 3856 RFC DRAFT November 2003 3858 SHOULD NOT apply for routes sent to internal peers. 3860 This procedure does not limit the rate of route selection, but only 3861 the rate of route advertisement. If new routes are selected multiple 3862 times while awaiting the expiration of MinRouteAdvertisementInterval- 3863 Timer, the last route selected SHALL be advertised at the end of Min- 3864 RouteAdvertisementIntervalTimer. 3866 9.2.1.2 Frequency of Route Origination 3868 The parameter MinASOriginationIntervalTimer determines the minimum 3869 amount of time that must elapse between successive advertisements of 3870 UPDATE messages that report changes within the advertising BGP 3871 speaker's own autonomous systems. 3873 9.2.2 Efficient Organization of Routing Information 3875 Having selected the routing information which it will advertise, a 3876 BGP speaker may avail itself of several methods to organize this 3877 information in an efficient manner. 3879 9.2.2.1 Information Reduction 3881 Information reduction may imply a reduction in granularity of policy 3882 control - after information is collapsed, the same policies will 3883 apply to all destinations and paths in the equivalence class. 3885 The Decision Process may optionally reduce the amount of information 3886 that it will place in the Adj-RIBs-Out by any of the following meth- 3887 ods: 3889 a) Network Layer Reachability Information (NLRI): 3891 Destination IP addresses can be represented as IP address pre- 3892 fixes. In cases where there is a correspondence between the 3893 address structure and the systems under control of an autonomous 3894 system administrator, it will be possible to reduce the size of 3895 the NLRI carried in the UPDATE messages. 3897 b) AS_PATHs: 3899 AS path information can be represented as ordered AS_SEQUENCEs or 3900 RFC DRAFT November 2003 3902 unordered AS_SETs. AS_SETs are used in the route aggregation algo- 3903 rithm described in 9.2.2.2. They reduce the size of the AS_PATH 3904 information by listing each AS number only once, regardless of how 3905 many times it may have appeared in multiple AS_PATHs that were 3906 aggregated. 3908 An AS_SET implies that the destinations listed in the NLRI can be 3909 reached through paths that traverse at least some of the con- 3910 stituent autonomous systems. AS_SETs provide sufficient informa- 3911 tion to avoid routing information looping; however their use may 3912 prune potentially feasible paths, since such paths are no longer 3913 listed individually as in the form of AS_SEQUENCEs. In practice 3914 this is not likely to be a problem, since once an IP packet 3915 arrives at the edge of a group of autonomous systems, the BGP 3916 speaker at that point is likely to have more detailed path infor- 3917 mation and can distinguish individual paths to destinations. 3919 9.2.2.2 Aggregating Routing Information 3921 Aggregation is the process of combining the characteristics of sev- 3922 eral different routes in such a way that a single route can be adver- 3923 tised. Aggregation can occur as part of the Decision Process to 3924 reduce the amount of routing information that will be placed in the 3925 Adj-RIBs-Out. 3927 Aggregation reduces the amount of information that a BGP speaker must 3928 store and exchange with other BGP speakers. Routes can be aggregated 3929 by applying the following procedure separately to path attributes of 3930 the same type and to the Network Layer Reachability Information. 3932 Routes that have different MULTI_EXIT_DISC attribute SHALL NOT be 3933 aggregated. 3935 If the aggregated route has an AS_SET as the first element in its 3936 AS_PATH attribute, then the router that originates the route SHOULD 3937 NOT advertise the MULTI_EXIT_DISC attribute with this route. 3939 Path attributes that have different type codes can not be aggregated 3940 together. Path attributes of the same type code may be aggregated, 3941 according to the following rules: 3943 NEXT_HOP: 3944 When aggregating routes that have different NEXT_HOP attribute, 3945 the NEXT_HOP attribute of the aggregated route SHALL identify 3946 an interface on the BGP speaker that performs the aggregation. 3948 RFC DRAFT November 2003 3950 ORIGIN attribute: 3951 If at least one route among routes that are aggregated has ORI- 3952 GIN with the value INCOMPLETE, then the aggregated route MUST 3953 have the ORIGIN attribute with the value INCOMPLETE. Other- 3954 wise, if at least one route among routes that are aggregated 3955 has ORIGIN with the value EGP, then the aggregated route MUST 3956 have the ORIGIN attribute with the value EGP. In all other 3957 cases the value of the ORIGIN attribute of the aggregated route 3958 is IGP. 3960 AS_PATH attribute: 3961 If routes to be aggregated have identical AS_PATH attributes, 3962 then the aggregated route has the same AS_PATH attribute as 3963 each individual route. 3965 For the purpose of aggregating AS_PATH attributes we model each 3966 AS within the AS_PATH attribute as a tuple , where 3967 "type" identifies a type of the path segment the AS belongs to 3968 (e.g. AS_SEQUENCE, AS_SET), and "value" is the AS number. If 3969 the routes to be aggregated have different AS_PATH attributes, 3970 then the aggregated AS_PATH attribute SHALL satisfy all of the 3971 following conditions: 3973 - all tuples of type AS_SEQUENCE in the aggregated AS_PATH 3974 SHALL appear in all of the AS_PATH in the initial set of 3975 routes to be aggregated. 3977 - all tuples of type AS_SET in the aggregated AS_PATH SHALL 3978 appear in at least one of the AS_PATH in the initial set 3979 (they may appear as either AS_SET or AS_SEQUENCE types). 3981 - for any tuple X of type AS_SEQUENCE in the aggregated 3982 AS_PATH which precedes tuple Y in the aggregated AS_PATH, X 3983 precedes Y in each AS_PATH in the initial set which contains 3984 Y, regardless of the type of Y. 3986 - No tuple of type AS_SET with the same value SHALL appear 3987 more than once in the aggregated AS_PATH. 3989 - Multiple tuples of type AS_SEQUENCE with the same value 3990 may appear in the aggregated AS_PATH only when adjacent to 3991 another tuple of the same type and value. 3993 An implementation may choose any algorithm which conforms to 3994 these rules. At a minimum a conformant implementation SHALL be 3995 able to perform the following algorithm that meets all of the 3996 above conditions: 3998 RFC DRAFT November 2003 4000 - determine the longest leading sequence of tuples (as 4001 defined above) common to all the AS_PATH attributes of the 4002 routes to be aggregated. Make this sequence the leading 4003 sequence of the aggregated AS_PATH attribute. 4005 - set the type of the rest of the tuples from the AS_PATH 4006 attributes of the routes to be aggregated to AS_SET, and 4007 append them to the aggregated AS_PATH attribute. 4009 - if the aggregated AS_PATH has more than one tuple with the 4010 same value (regardless of tuple's type), eliminate all, but 4011 one such tuple by deleting tuples of the type AS_SET from 4012 the aggregated AS_PATH attribute. 4014 - for each pair of adjacent tuples in the aggregated 4015 AS_PATH, if both tuples have the same type, merge them 4016 together, as long as doing so will not cause a segment with 4017 length greater than 255 to be generated. 4019 Appendix F, Section F.6 presents another algorithm that satis- 4020 fies the conditions and allows for more complex policy configu- 4021 rations. 4023 ATOMIC_AGGREGATE: 4024 If at least one of the routes to be aggregated has 4025 ATOMIC_AGGREGATE path attribute, then the aggregated route 4026 SHALL have this attribute as well. 4028 AGGREGATOR: 4029 Any AGGREGATOR attributes from the routes to be aggregated MUST 4030 NOT be included in the aggregated route. The BGP speaker per- 4031 forming the route aggregation MAY attach a new AGGREGATOR 4032 attribute (see Section 5.1.7). 4034 9.3 Route Selection Criteria 4036 Generally speaking, additional rules for comparing routes among sev- 4037 eral alternatives are outside the scope of this document. There are 4038 two exceptions: 4040 - If the local AS appears in the AS path of the new route being 4041 considered, then that new route can not be viewed as better than 4042 any other route (provided that the speaker is configured to accept 4043 such routes). If such a route were ever used, a routing loop could 4044 result. 4046 RFC DRAFT November 2003 4048 - In order to achieve successful distributed operation, only 4049 routes with a likelihood of stability can be chosen. Thus, an AS 4050 SHOULD avoid using unstable routes, and it SHOULD NOT make rapid 4051 spontaneous changes to its choice of route. Quantifying the terms 4052 "unstable" and "rapid" in the previous sentence will require expe- 4053 rience, but the principle is clear. Routes that are unstable can 4054 be "penalized" (e.g., by using the procedures described in 4055 [RFC2439]). 4057 9.4 Originating BGP routes 4059 A BGP speaker may originate BGP routes by injecting routing informa- 4060 tion acquired by some other means (e.g. via an IGP) into BGP. A BGP 4061 speaker that originates BGP routes assigns the degree of preference 4062 (e.g., according to local configuration) to these routes by passing 4063 them through the Decision Process (see Section 9.1). These routes MAY 4064 also be distributed to other BGP speakers within the local AS as part 4065 of the update process (see Section 9.2). The decision whether to dis- 4066 tribute non-BGP acquired routes within an AS via BGP or not depends 4067 on the environment within the AS (e.g. type of IGP) and SHOULD be 4068 controlled via configuration. 4070 10 BGP Timers 4072 BGP employs five timers: ConnectRetryTimer (see Section 8), HoldTimer 4073 (see Section 4.2), KeepaliveTimer (see Section 8), MinASOrigination- 4074 IntervalTimer (see Section 9.2.1.2), and MinRouteAdvertisementInter- 4075 valTimer (see Section 9.2.1.1). 4077 Two optional timers MAY be supported: DelayOpenTimer, IdleHoldTimer 4078 by BGP (see section 8). Section 8 describes their use. The full oper- 4079 ation of these optional timers is outside the scope of this document. 4081 ConnectRetryTime is a mandatory FSM attribute that stores the initial 4082 value for the ConnectRetryTimer. The suggested default value for the 4083 ConnectRetryTime is 120 seconds. 4085 HoldTime is a mandatory FSM attribute that stores the initial value 4086 for the HoldTimer. The suggested default value for the HoldTime is 90 4087 seconds. 4089 During some portions of the state machine (see Section 8), the Hold- 4090 Timer is set to a large value. The suggested default for this large 4091 value is 4 minutes. 4093 RFC DRAFT November 2003 4095 The KeepaliveTime is a mandatory FSM attribute that stores the ini- 4096 tial value for the KeepaliveTimer. The suggested default value for 4097 the KeepaliveTime is 1/3 of the HoldTime. 4099 The suggested default value for the MinASOriginationIntervalTimer is 4100 15 seconds. 4102 The suggested default value for the MinRouteAdvertisementInterval- 4103 Timer on EBGP connections is 30 seconds. 4105 The suggested default value for the MinRouteAdvertisementInterval- 4106 Timer on IBGP connections is 5 seconds. 4108 An implementation of BGP MUST allow the HoldTimer to be configurable 4109 on a per peer basis, and MAY allow the other timers to be config- 4110 urable. 4112 To minimize the likelihood that the distribution of BGP messages by a 4113 given BGP speaker will contain peaks, jitter SHOULD be applied to the 4114 timers associated with MinASOriginationIntervalTimer, KeepaliveTimer, 4115 MinRouteAdvertisementIntervalTimer, and ConnectRetryTimer. A given 4116 BGP speaker MAY apply the same jitter to each of these quantities 4117 regardless of the destinations to which the updates are being sent; 4118 that is, jitter need not be configured on a "per peer" basis. 4120 The suggested default amount of jitter SHALL be determined by multi- 4121 plying the base value of the appropriate timer by a random factor 4122 which is uniformly distributed in the range from 0.75 to 1.0. A new 4123 random value SHOULD be picked each time the timer is set. The range 4124 of the jitter random value MAY be configurable. 4126 Appendix A. Comparison with RFC1771 4128 There are numerous editorial changes (too many to list here). 4130 The following list the technical changes: 4132 Changes to reflect the usages of such features as TCP MD5 4133 [RFC2385], BGP Route Reflectors [RFC2796], BGP Confederations 4134 [RFC3065], and BGP Route Refresh [RFC2918]. 4136 Clarification on the use of the BGP Identifier in the AGGREGATOR 4137 attribute. 4139 Procedures for imposing an upper bound on the number of prefixes 4140 that a BGP speaker would accept from a peer. 4142 RFC DRAFT November 2003 4144 The ability of a BGP speaker to include more than one instance of 4145 its own AS in the AS_PATH attribute for the purpose of inter-AS 4146 traffic engineering. 4148 Clarifications on the various types of NEXT_HOPs. 4150 Clarifications to the use of the ATOMIC_AGGREGATE attribute. 4152 The relationship between the immediate next hop, and the next hop 4153 as specified in the NEXT_HOP path attribute. 4155 Clarifications on the tie-breaking procedures. 4157 Clarifications on the frequency of route advertisements. 4159 Optional Parameter Type 1 (Authentication Information) has been 4160 deprecated. 4162 UPDATE Message Error subcode 7 (AS Routing Loop) has been depre- 4163 cated. 4165 OPEN Message Error subcode 5 (Authentication Failure) has been 4166 deprecated. 4168 Use of the Marker field for authentication has been deprecated. 4170 Implementations MUST support TCP MD5 [RFC2385] for authentication. 4172 Clarification of BGP FSM. 4174 Appendix B. Comparison with RFC1267 4176 All the changes listed in Appendix A, plus the following. 4178 BGP-4 is capable of operating in an environment where a set of reach- 4179 able destinations may be expressed via a single IP prefix. The con- 4180 cept of network classes, or subnetting is foreign to BGP-4. To 4181 accommodate these capabilities BGP-4 changes semantics and encoding 4182 associated with the AS_PATH attribute. New text has been added to 4183 define semantics associated with IP prefixes. These abilities allow 4184 BGP-4 to support the proposed supernetting scheme [9]. 4186 To simplify configuration this version introduces a new attribute, 4187 LOCAL_PREF, that facilitates route selection procedures. 4189 The INTER_AS_METRIC attribute has been renamed to be MULTI_EXIT_DISC. 4191 RFC DRAFT November 2003 4193 A new attribute, ATOMIC_AGGREGATE, has been introduced to insure that 4194 certain aggregates are not de-aggregated. Another new attribute, 4195 AGGREGATOR, can be added to aggregate routes in order to advertise 4196 which AS and which BGP speaker within that AS caused the aggregation. 4198 To insure that Hold Timers are symmetric, the Hold Timer is now nego- 4199 tiated on a per-connection basis. Hold Timers of zero are now sup- 4200 ported. 4202 Appendix C. Comparison with RFC 1163 4204 All of the changes listed in Appendices A and B, plus the following. 4206 To detect and recover from BGP connection collision, a new field (BGP 4207 Identifier) has been added to the OPEN message. New text (Section 4208 6.8) has been added to specify the procedure for detecting and recov- 4209 ering from collision. 4211 The new document no longer restricts the router that is passed in the 4212 NEXT_HOP path attribute to be part of the same Autonomous System as 4213 the BGP Speaker. 4215 New document optimizes and simplifies the exchange of the information 4216 about previously reachable routes. 4218 Appendix D. Comparison with RFC 1105 4220 All of the changes listed in Appendices A, B and C, plus the follow- 4221 ing. 4223 Minor changes to the RFC1105 Finite State Machine were necessary to 4224 accommodate the TCP user interface provided by 4.3 BSD. 4226 The notion of Up/Down/Horizontal relations present in RFC1105 has 4227 been removed from the protocol. 4229 The changes in the message format from RFC1105 are as follows: 4231 1. The Hold Time field has been removed from the BGP header and 4232 added to the OPEN message. 4234 2. The version field has been removed from the BGP header and 4235 added to the OPEN message. 4237 3. The Link Type field has been removed from the OPEN message. 4239 RFC DRAFT November 2003 4241 4. The OPEN CONFIRM message has been eliminated and replaced with 4242 implicit confirmation provided by the KEEPALIVE message. 4244 5. The format of the UPDATE message has been changed signifi- 4245 cantly. New fields were added to the UPDATE message to support 4246 multiple path attributes. 4248 6. The Marker field has been expanded and its role broadened to 4249 support authentication. 4251 Note that quite often BGP, as specified in RFC 1105, is referred 4252 to as BGP-1, BGP, as specified in RFC 1163, is referred to as 4253 BGP-2, BGP, as specified in RFC1267 is referred to as BGP-3, and 4254 BGP, as specified in this document is referred to as BGP-4. 4256 Appendix E. TCP options that may be used with BGP 4258 If a local system TCP user interface supports TCP PUSH function, then 4259 each BGP message SHOULD be transmitted with PUSH flag set. Setting 4260 PUSH flag forces BGP messages to be transmitted promptly to the 4261 receiver. 4263 If a local system TCP user interface supports setting of the DSCP 4264 field [RFC2474] for TCP connections, then the TCP connection used by 4265 BGP SHOULD be opened with bits 0-2 of the DSCP field set to 110 4266 (binary). 4268 An implementation MUST support TCP MD5 option [RFC2385]. 4270 Appendix F. Implementation Recommendations 4272 This section presents some implementation recommendations. 4274 Appendix F.1 Multiple Networks Per Message 4276 The BGP protocol allows for multiple address prefixes with the same 4277 path attributes to be specified in one message. Making use of this 4278 capability is highly recommended. With one address prefix per message 4279 there is a substantial increase in overhead in the receiver. Not only 4280 does the system overhead increase due to the reception of multiple 4281 messages, but the overhead of scanning the routing table for updates 4282 to BGP peers and other routing protocols (and sending the associated 4283 messages) is incurred multiple times as well. 4285 RFC DRAFT November 2003 4287 One method of building messages containing many address prefixes per 4288 a path attribute set from a routing table that is not organized on a 4289 per path attribute set basis is to build many messages as the routing 4290 table is scanned. As each address prefix is processed, a message for 4291 the associated set of path attributes is allocated, if it does not 4292 exist, and the new address prefix is added to it. If such a message 4293 exists, the new address prefix is just appended to it. If the message 4294 lacks the space to hold the new address prefix, it is transmitted, a 4295 new message is allocated, and the new address prefix is inserted into 4296 the new message. When the entire routing table has been scanned, all 4297 allocated messages are sent and their resources released. Maximum 4298 compression is achieved when all the destinations covered by the 4299 address prefixes share a common set of path attributes making it pos- 4300 sible to send many address prefixes in one 4096-byte message. 4302 When peering with a BGP implementation that does not compress multi- 4303 ple address prefixes into one message, it may be necessary to take 4304 steps to reduce the overhead from the flood of data received when a 4305 peer is acquired or a significant network topology change occurs. One 4306 method of doing this is to limit the rate of updates. This will 4307 eliminate the redundant scanning of the routing table to provide 4308 flash updates for BGP peers and other routing protocols. A disadvan- 4309 tage of this approach is that it increases the propagation latency of 4310 routing information. By choosing a minimum flash update interval 4311 that is not much greater than the time it takes to process the multi- 4312 ple messages this latency should be minimized. A better method would 4313 be to read all received messages before sending updates. 4315 Appendix F.2 Reducing route flapping 4317 To avoid excessive route flapping a BGP speaker which needs to with- 4318 draw a destination and send an update about a more specific or less 4319 specific route should combine them into the same UPDATE message. 4321 Appendix F.3 Path attribute ordering 4323 Implementations which combine update messages as described above in 4324 6.1 may prefer to see all path attributes presented in a known order. 4325 This permits them to quickly identify sets of attributes from differ- 4326 ent update messages which are semantically identical. To facilitate 4327 this, it is a useful optimization to order the path attributes 4328 according to type code. This optimization is entirely optional. 4330 RFC DRAFT November 2003 4332 Appendix F.4 AS_SET sorting 4334 Another useful optimization that can be done to simplify this situa- 4335 tion is to sort the AS numbers found in an AS_SET. This optimization 4336 is entirely optional. 4338 Appendix F.5 Control over version negotiation 4340 Since BGP-4 is capable of carrying aggregated routes which can not be 4341 properly represented in BGP-3, an implementation which supports BGP-4 4342 and another BGP version should provide the capability to only speak 4343 BGP-4 on a per-peer basis. 4345 Appendix F.6 Complex AS_PATH aggregation 4347 An implementation which chooses to provide a path aggregation algo- 4348 rithm which retains significant amounts of path information may wish 4349 to use the following procedure: 4351 For the purpose of aggregating AS_PATH attributes of two routes, 4352 we model each AS as a tuple , where "type" identifies 4353 a type of the path segment the AS belongs to (e.g. AS_SEQUENCE, 4354 AS_SET), and "value" is the AS number. Two ASs are said to be the 4355 same if their corresponding tuples are the same. 4357 The algorithm to aggregate two AS_PATH attributes works as fol- 4358 lows: 4360 a) Identify the same ASs (as defined above) within each AS_PATH 4361 attribute that are in the same relative order within both 4362 AS_PATH attributes. Two ASs, X and Y, are said to be in the 4363 same order if either: 4364 - X precedes Y in both AS_PATH attributes, or - Y precedes X 4365 in both AS_PATH attributes. 4367 b) The aggregated AS_PATH attribute consists of ASs identified 4368 in (a) in exactly the same order as they appear in the AS_PATH 4369 attributes to be aggregated. If two consecutive ASs identified 4370 in (a) do not immediately follow each other in both of the 4371 AS_PATH attributes to be aggregated, then the intervening ASs 4372 (ASs that are between the two consecutive ASs that are the 4373 same) in both attributes are combined into an AS_SET path seg- 4374 ment that consists of the intervening ASs from both AS_PATH 4375 RFC DRAFT November 2003 4377 attributes; this segment is then placed in between the two con- 4378 secutive ASs identified in (a) of the aggregated attribute. If 4379 two consecutive ASs identified in (a) immediately follow each 4380 other in one attribute, but do not follow in another, then the 4381 intervening ASs of the latter are combined into an AS_SET path 4382 segment; this segment is then placed in between the two consec- 4383 utive ASs identified in (a) of the aggregated attribute. 4385 c) For each pair of adjacent tuples in the aggregated AS_PATH, 4386 if both tuples have the same type, merge them together, as long 4387 as doing so will not cause a segment with length greater than 4388 255 to be generated. 4390 If as a result of the above procedure a given AS number appears 4391 more than once within the aggregated AS_PATH attribute, all, but 4392 the last instance (rightmost occurrence) of that AS number should 4393 be removed from the aggregated AS_PATH attribute. 4395 Security Considerations 4397 The authentication mechanism that an implementation of BGP MUST sup- 4398 port is specified in RFC 2385 [RFC2385]. The authentication provided 4399 by this mechanism could be done on a per peer basis. 4401 BGP makes use of TCP for reliable transport of its traffic between 4402 peer routers. To provide connection-oriented integrity and data ori- 4403 gin authentication, on a point-to-point basis, BGP specifies use of 4404 the mechanism defined in RFC 2385. These services are intended to 4405 detect and reject active wiretapping attacks against the inter-router 4406 TCP connections. Absent use of mechanisms that effect these security 4407 services, attackers can disrupt these TCP connections and/or masquer- 4408 ade as a legitimate peer router. Because the mechanism defined in the 4409 RFC does not provide peer-entity authentication, these connections 4410 may be subject to some forms of replay attacks that will not be 4411 detected at the TCP layer. Such attacks might result in delivery 4412 (from TCP) of "broken" or "spoofed" BGP messages. 4414 The mechanism defined in RFC 2385 augments the normal TCP checksum 4415 with a 16-byte message authentication code (MAC) that is computed 4416 over the same data as the TCP checksum. This MAC is based on a one- 4417 way hash function (MD5) and use of a secret key. The key is shared 4418 between peer routers and is used to generate MAC values that are not 4419 readily computed by an attacker who does not have access to the key. 4420 A compliant implementation must support this mechanism, and must 4421 allow a network administrator to activate it on a per-peer basis. 4423 RFC DRAFT November 2003 4425 RFC 2385 does not specify a means of managing (e.g., generating, dis- 4426 tributing, and replacing) the keys used to compute the MAC. RFC 3562 4427 [RFC3562] (an informational document) provides some guidance in this 4428 area, and provides rationale to support this guidance. It notes that 4429 a distinct key should be used for communication with each protected 4430 peer. If the same key is used for multiple peers, the offered secu- 4431 rity services may be degraded, e.g., due to increased risk of compro- 4432 mise at one router adversely affecting other routers. 4434 The keys used for MAC computation should be changed periodically, to 4435 minimize the impact of a key compromise or successful cryptanalytic 4436 attack. RFC 3562 suggests a crypto period (the interval during which 4437 a key is employed) of at most 90 days. More frequent key changes 4438 reduce the likelihood that replay attacks (as described above) will 4439 be feasible. However, absent a standard mechanism for effecting such 4440 changes in a coordinated fashion between peers, one cannot assume 4441 that BGP-4 implementations complying with this RFC will support fre- 4442 quent key changes. 4444 Obviously, each key also should be chosen so as to be hard for an 4445 attacker to guess. The techniques specified in RFC 1750 for random 4446 number generation provide a guide for generation of values that could 4447 be used as keys. RFC 2385 calls for implementations to support keys 4448 "composed of a string of printable ASCII of 80 bytes or less." RFC 4449 3562 suggests keys used in this context be 12 to 24 bytes of random 4450 (pseudo-random) bits. This is fairly consistent with suggestions for 4451 analogous MAC algorithms, which typically employ keys in the range of 4452 16-20 bytes. RFC 3562 also observes that, to provide enough random 4453 bits at the low end of this range, a typical ACSII text string would 4454 have to be close to the upper bound for key length specified in RFC 4455 2385. 4457 BGP vulnerabilities analysis is discussed in [BGP_VULN]. 4459 IANA Considerations 4461 All new BGP message types, Path Attributes Type codes, Message Header 4462 Error subcodes, OPEN Message Error subcodes, and UPDATE Message Error 4463 subcodes MUST only be made using the Standards Action process defined 4464 in [RFC2434]. 4466 This document defines the following message types: OPEN, UPDATE, 4467 KEEPALIVE, NOTIFICATION. 4469 This document defines the following Path Attributes Type codes: ORI- 4470 GIN, AS_PATH, NEXT_HOP, MULTI_EXIT_DISC, LOCAL_PREF, 4471 RFC DRAFT November 2003 4473 ATOMIC_AGGREGATE, AGGREGATOR. 4475 This document defines the following Message Header Error subcodes: 4476 Connection Not Synchronized, Bad Message Length, Bad Message Type. 4478 This document defines the following OPEN Message Error subcodes: 4479 Unsupported Version Number, Bad Peer AS, Bad BGP Identifier, Unsup- 4480 ported Optional Parameter, Unacceptable Hold Time. 4482 This document defines the following UPDATE Message Error subcodes: 4483 Malformed Attribute List, Unrecognized Well-known Attribute, Missing 4484 Well-known Attribute, Attribute Flags Error, Attribute Length Error, 4485 Invalid ORIGIN Attribute, Invalid NEXT_HOP Attribute, Optional 4486 Attribute Error, Invalid Network Field, Malformed AS_PATH. 4488 IPR Notice 4490 The IETF has been notified of intellectual property rights claimed in 4491 regard to some or all of the specification contained in this docu- 4492 ment. For more information consult the online list of claimed rights. 4494 The IETF takes no position regarding the validity or scope of any 4495 intellectual property or other rights that might be claimed to per- 4496 tain to the implementation or use of the technology described in this 4497 document or the extent to which any license under such rights might 4498 or might not be available; neither does it represent that it has made 4499 any effort to identify any such rights. Information on the IETF's 4500 procedures with respect to rights in standards-track and standards- 4501 related documentation can be found in BCP-11. Copies of claims of 4502 rights made available for publication and any assurances of licenses 4503 to be made available, or the result of an attempt made to obtain a 4504 general license or permission for the use of such proprietary rights 4505 by implementors or users of this specification can be obtained from 4506 the IETF Secretariat. 4508 The IETF invites any interested party to bring to its attention any 4509 copyrights, patents or patent applications, or other proprietary 4510 rights which may cover technology that may be required to practice 4511 this standard. Please address the information to the IETF Executive 4512 Director. 4514 RFC DRAFT November 2003 4516 Full Copyright Notice 4518 Copyright (C) The Internet Society (2003). All Rights Reserved. 4520 This document and translations of it may be copied and furnished to 4521 others, and derivative works that comment on or otherwise explain it 4522 or assist in its implementation may be prepared, copied, published 4523 and distributed, in whole or in part, without restriction of any 4524 kind, provided that the above copyright notice and this paragraph are 4525 included on all such copies and derivative works. However, this doc- 4526 ument itself may not be modified in any way, such as by removing the 4527 copyright notice or references to the Internet Society or other 4528 Internet organizations, except as needed for the purpose of develop- 4529 ing Internet standards in which case the procedures for copyrights 4530 defined in the Internet Standards process must be followed, or as 4531 required to translate it into languages other than English. 4533 The limited permissions granted above are perpetual and will not be 4534 revoked by the Internet Society or its successors or assigns. 4536 This document and the information contained herein is provided on an 4537 "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING 4538 TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING 4539 BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION 4540 HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MER- 4541 CHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE." 4543 Normative References 4545 [RFC791] Postel, J., "Internet Protocol - DARPA Internet Program Pro- 4546 tocol Specification", RFC791, September 1981. 4548 [RFC793] Postel, J., "Transmission Control Protocol - DARPA Internet 4549 Program Protocol Specification", RFC793, September 1981. 4551 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 4552 Requirement Levels", BCP 14, RFC 2119, March 1997. 4554 [RFC2385] Heffernan, A., "Protection of BGP Sessions via the TCP MD5 4555 Signature Option", RFC2385, August 1998. 4557 [RFC2434] Narten, T., Alvestrand, H., "Guidelines for Writing an IANA 4558 Considerations Section in RFCs", RFC2434, October 1998 4560 [RFC2474] Nichols, K., et al.,"Definition of the Differentiated Ser- 4561 vices Field (DS Field) in the IPv4 and IPv6 Headers", RFC2474, 4562 RFC DRAFT November 2003 4564 December 1998 4566 Non-normative References 4568 [RFC904] Mills, D., "Exterior Gateway Protocol Formal Specification", 4569 RFC904, April 1984. 4571 [RFC1092] Rekhter, Y., "EGP and Policy Based Routing in the New 4572 NSFNET Backbone", RFC1092, February 1989. 4574 [RFC1093] Braun, H-W., "The NSFNET Routing Architecture", RFC1093, 4575 February 1989. 4577 [RFC1772] Rekhter, Y., and P. Gross, "Application of the Border Gate- 4578 way Protocol in the Internet", RFC1772, March 1995. 4580 [RFC1518] Rekhter, Y., Li, T., "An Architecture for IP Address Allo- 4581 cation with CIDR", RFC 1518, September 1993. 4583 [RFC1519] Fuller, V., Li, T., Yu, J., and Varadhan, K., ""Classless 4584 Inter-Domain Routing (CIDR): an Address Assignment and Aggregation 4585 Strategy", RFC1519, September 1993. 4587 [RFC1997] R. Chandra, P. Traina, T. Li, "BGP Communities Attribute", 4588 RFC 1997, August 1996. 4590 [RFC2439] C. Villamizar, R. Chandra, R. Govindan, "BGP Route Flap 4591 Damping", RFC2439, November 1998. 4593 [RFC2796] Bates, T., Chandra, R., Chen, E., "BGP Route Reflection - 4594 An Alternative to Full Mesh IBGP", RFC2796, April 2000. 4596 [RFC3392] R. Chandra, J. Scudder, "Capabilities Advertisement with 4597 BGP-4", RFC2842. 4599 [RFC2858] T. Bates, R. Chandra, D. Katz, Y. Rekhter, "Multiprotocol 4600 Extensions for BGP-4", RFC2858. 4602 [RFC2918] Chen, E., "Route Refresh Capability for BGP-4", RFC2918, 4603 September 2000. 4605 [RFC3065] Traina, P, McPherson, D., Scudder, J., "Autonomous System 4606 Confederations for BGP", RFC3065, February 2001. 4608 [RFC3562] Leech, M., "Key Management Considerations for the TCP MD5 4609 Signature Option", RFC3562, July 2003. 4611 RFC DRAFT November 2003 4613 3563 Cooperative Agreement Between the ISOC/IETF and ISO/IEC Joint 4615 [IS10747] "Information Processing Systems - Telecommunications and 4616 Information Exchange between Systems - Protocol for Exchange of 4617 Inter-domain Routeing Information among Intermediate Systems to Sup- 4618 port Forwarding of ISO 8473 PDUs", ISO/IEC IS10747, 1993 4620 [BGP_VULN] Murphy, S., "BGP Security Vulnerabilities Analysis", 4621 draft-ietf-idr-bgp-vuln-00.txt, work in progress 4623 Editors' Addresses 4625 Yakov Rekhter 4626 Juniper Networks 4627 email: yakov@juniper.net 4629 Tony Li 4630 email: tony.li@tony.li 4632 Susan Hares 4633 NextHop Technologies, Inc. 4634 email: skh@nexthop.com