Inter-Domain Routing J. Snijders Internet-Draft Fastly Updates: 4271 (if approved) M. Aelmans Intended status: Standards Track Juniper Networks Expires: 8 August 2023 M. Stucchi Independent 4 February 2023 Inbound BGP Maximum Prefix Limits draft-sas-idr-maxprefix-inbound-05 Abstract This document describes two threshold types to consider when receiving BGP address prefixes from adjacent systems in order to limit the negative impact of route leaks or resource exhaustion in BGP implementations. Requirements Language The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here. Status of This Memo This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at https://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." This Internet-Draft will expire on 8 August 2023. Copyright Notice Copyright (c) 2023 IETF Trust and the persons identified as the document authors. All rights reserved. Snijders, et al. Expires 8 August 2023 [Page 1] Internet-Draft Inbound BGP Maximum Prefix Limits February 2023 This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/ license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 2. Changes to RFC4271 Section 6 . . . . . . . . . . . . . . . . 2 3. Changes to RFC4271 Section 8 . . . . . . . . . . . . . . . . 3 4. Changes to RFC4271 Section 9 . . . . . . . . . . . . . . . . 4 5. Security Considerations . . . . . . . . . . . . . . . . . . . 5 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 5 7. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 5 8. Implementation status - RFC EDITOR: REMOVE BEFORE PUBLICATION . . . . . . . . . . . . . . . . . . . . . . . 5 9. Appendix: Implementation Guidance . . . . . . . . . . . . . . 7 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 7 10.1. Normative References . . . . . . . . . . . . . . . . . . 7 10.2. Informative References . . . . . . . . . . . . . . . . . 7 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 7 1. Introduction This document updates [RFC4271] and describes a revision of the control mechanism which helps limit the negative impact of route leaks [RFC7908] and/or resource exhaustion in Border Gateway Protocol (BGP) implementations. While [RFC4271] described the concept of automatically tearing down BGP sessions or discarding UPDATES after the configured maximum number of prefixes received threshold has been exceeded, operational experience suggests it to be beneficial to recognize two distinct subtypes of this threshold. This document introduces a differentiation between Pre-Policy and Post-Policy maximum prefix limits. 2. Changes to RFC4271 Section 6 This section updates [RFC4271] to specify what events can result in AutomaticStop (Event 8) in the BGP FSM. The following paragraph replaces the second paragraph of Section 6.7 (Cease), which starts with "A BGP speaker MAY support..." and ends with "... The speaker MAY also log this locally.": Snijders, et al. Expires 8 August 2023 [Page 2] Internet-Draft Inbound BGP Maximum Prefix Limits February 2023 A BGP speaker MAY support the ability to impose a locally- configured, upper bound on the number of address prefixes the speaker is willing to accept from a neighbor (inbound maximum prefix limit). Limitations on the prefixes accepted from a neighbor can be applied before policy processing (Pre-Policy) and after policy processing (Post-Policy). When one of the two thresholds is reached, the speaker, under control of local configuration, either: a. Discards new address prefixes from the neighbor, while maintaining the BGP connection in Established state. Note that as these prefixes are discarded, their reachability information is not stored on the local router, which might lead to inconsistent routing behaviour; b. Continues to receives new prefixes while exceeding the threshold and generates a log of the event; c. Terminates the BGP connection with the neighbor. This is the safest option. If the BGP speaker decides to terminate its BGP connection with a neighbor because the number of address prefixes received from the neighbor exceeds the locally-configured threshold, then the speaker MUST send the neighbor a NOTIFICATION message with the Error Code Cease. +=========+=========================================================+ | Subcode | Symbolic Name | +=========+=========================================================+ | 1 | Threshold exceeded: Maximum | | | Number of Prefixes Received | +---------+---------------------------------------------------------+ Table 1 The speaker MAY also log this locally. 3. Changes to RFC4271 Section 8 This section updates Section 8 [RFC4271], the paragraph that starts with "One reason for an AutomaticStop event is ..." and ends with "... The local system automatically disconnects the peer." is replaced with: Snijders, et al. Expires 8 August 2023 [Page 3] Internet-Draft Inbound BGP Maximum Prefix Limits February 2023 Possible reasons for an AutomaticStop event are: A BGP speaker receives an UPDATE messages with a number of prefixes from a given peer such that the total prefixes received exceeds the maximum number of prefixes configured (either "Pre-Policy" or "Post- Policy"). The local system automatically disconnects the peer. 4. Changes to RFC4271 Section 9 This section updates [RFC4271] by adding a subsection after Section 9.4 (Originating BGP routes) to specify various events that can lead up to AutomaticStop (Event 8) in the BGP FSM. 9.5 Maximum Prefix Limits 9.5.1 Pre-Policy Inbound Maximum Prefix Limits The Adj-RIB-In stores routing information learned from inbound UPDATE messages that were received from another BGP speaker Section 3.2 [RFC4271]. A Pre-Policy limit uses the number of NLRIs per Address Family Identifier (AFI) per Subsequent Address Family Identifier (SAFI) as input into its threshold calculation, without having applied any policies from the Policy Information Base. For example, when an operator configures the local system to terminate a given EBGP session when more than 50 IPv4 Unicast NLRIs exist in the Adj-RIB-In, and a given adjacent system announces the 51st IPv4 Unicast NLRI, the session MUST be terminated. Pre-policy limits are particularly useful to help prevent memory exhaustion during full Internet routing table leaks on systems which store all rejected routes. 9.5.2 Post-Policy Inbound Maximum Prefix Limits RFC4271 describes a Policy Information Base (PIB) that contains local policies that can be applied to the information in the Routing Information Base (RIB). The Post-Policy limit uses the number of NLRIs per Address Family Identifier (AFI) per Subsequent Address Family Identifier (SAFI), after application of the Import Policy as input into its threshold comparisons. For example, when an operator configures the Post-Policy limit for IPv4 Unicast to be 50 on a given EBGP session, and the other BGP speaker announces a hundred IPv4 Unicast routes - none of which are accepted as a result of the local import policy (and thus not considered for the Loc-RIB by the local BGP speaker), the session is not terminated. Snijders, et al. Expires 8 August 2023 [Page 4] Internet-Draft Inbound BGP Maximum Prefix Limits February 2023 Post-policy limits are useful to help prevent FIB exhaustion and prevent accidental BGP session teardown due to prefixes not accepted by policy anyway. Operators SHOULD take special care when utilizing methods where the router maintains a table of all the received updates Pre- Policy, as this could still expose control plane to exhaustion if no Pre-Policy limits are available or are not configured. Implementations SHOULD provide means to configure two thresholds for inbound limits: one before policies from the PIB are applied, and one after. This is to prevent exhaustion of control plane resources. A Pre-Policy maximum prefix limit SHOULD equal to or higher than a Post-Policy maximum prefix limit. 5. Security Considerations Maximum Prefix Limits are an essential tool for routing operations and are RECOMMENDED be used to increase stability for the global routing ecosystem. See [RFC7454] section 8 for more guidance. 6. IANA Considerations This memo requests that IANA updates the name of subcode "Maximum Number of Prefixes Reached" to "Threshold exceeded: Maximum Number of Prefixes Received" in the "Cease NOTIFICATION message subcodes" registry under the "Border Gateway Protocol (BGP) Parameters" group. 7. Acknowledgments The authors would like to thank Saku Ytti, John Heasley, Jeff Haas, Colby Barth, John Scudder, Martijn Schmidt, Teun Vink, Sabri Berisha, Martin Pels, Steven Bakker, Aftab Siddiqui, Yu Tianpeng, Ruediger Volk, Robert Raszuk, Jakob Heitz, Warren Kumari, Ben Maddison, Randy Bush, Brian Dickson, and Gyan Mishra for their support, insightful reviews, and comments. 8. Implementation status - RFC EDITOR: REMOVE BEFORE PUBLICATION This section records the status of known implementations of the protocol defined by this specification at the time of posting of this Internet-Draft, and is based on a proposal described in RFC7942. The description of implementations in this section is intended to assist the IETF in its decision processes in progressing drafts to RFCs. Please note that the listing of any individual implementation here does not imply endorsement by the IETF. Furthermore, no effort has been spent to verify the information presented here that was supplied by IETF contributors. This is not intended as, and must not be Snijders, et al. Expires 8 August 2023 [Page 5] Internet-Draft Inbound BGP Maximum Prefix Limits February 2023 construed to be, a catalog of available implementations or their features. Readers are advised to note that other implementations may exist. The below table provides an overview (as of the moment of writing) of which vendors have produced implementation of inbound prefix limits. Each table cell shows the applicable configuration keywords if the vendor implemented the feature. +==========+======================+==========================+ | Vendor | Type A Pre-Policy | Type B Post-Policy | +==========+======================+==========================+ | Cisco | | maximum-prefix | | IOS XR | | | +----------+----------------------+--------------------------+ | Cisco | | maximum-prefix | | IOS XE | | | +----------+----------------------+--------------------------+ | Juniper | prefix-limit | accepted-prefix-limit, | | Junos OS | | or prefix-limit combined | | | | with 'keep none' | +----------+----------------------+--------------------------+ | Nokia SR | prefix-limit | | | OS | | | +----------+----------------------+--------------------------+ | NIC.CZ | 'import keep | 'import limit' or | | BIRD | filtered' combined | 'receive limit' | | | with 'receive limit' | | +----------+----------------------+--------------------------+ | OpenBSD | max-prefix | | | OpenBGPD | | | +----------+----------------------+--------------------------+ | Arista | maximum-routes | maximum-accepted-routes | | EOS | | | +----------+----------------------+--------------------------+ | Huawei | peer route-limit | | | VRPv5 | | | +----------+----------------------+--------------------------+ | Huawei | peer route-limit | peer route-limit accept- | | VRPv8 | | prefix | +----------+----------------------+--------------------------+ Table 2: Maximum prefix limits capabilities per implementation First presented by Snijders at [RIPE77] Snijders, et al. Expires 8 August 2023 [Page 6] Internet-Draft Inbound BGP Maximum Prefix Limits February 2023 9. Appendix: Implementation Guidance TBD 10. References 10.1. Normative References [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, . [RFC4271] Rekhter, Y., Ed., Li, T., Ed., and S. Hares, Ed., "A Border Gateway Protocol 4 (BGP-4)", RFC 4271, DOI 10.17487/RFC4271, January 2006, . [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, . 10.2. Informative References [RFC7454] Durand, J., Pepelnjak, I., and G. Doering, "BGP Operations and Security", BCP 194, RFC 7454, DOI 10.17487/RFC7454, February 2015, . [RFC7908] Sriram, K., Montgomery, D., McPherson, D., Osterweil, E., and B. Dickson, "Problem Definition and Classification of BGP Route Leaks", RFC 7908, DOI 10.17487/RFC7908, June 2016, . [RIPE77] Snijders, J., "Robust Routing Policy Architecture", May 2018, . Authors' Addresses Job Snijders Fastly Amsterdam Netherlands Email: job@fastly.com Snijders, et al. Expires 8 August 2023 [Page 7] Internet-Draft Inbound BGP Maximum Prefix Limits February 2023 Melchior Aelmans Juniper Networks Boeing Avenue 240 1119 PZ Schiphol-Rijk Netherlands Email: maelmans@juniper.net Massimiliano Stucchi Independent Email: max@stucchi.ch Snijders, et al. Expires 8 August 2023 [Page 8]