RFC 7454
BGP Operations and Security
BGP Operations and Security ๐
Okay bestie, let's start with the basics ๐ . This is RFC 7454, called BGP Operations and Security. It's a Best Current Practice (that's BCP: 194 ๐ธ), and it was published in February 2015. The authors are J. Durand from Cisco Systems, Inc., I. Pepelnjak (no affiliation, so it says NIL), and G. Doering from SpaceNet. It's from the IETF, and its ISSN is 2070-1721. The header doesn't list anything it obsoletes or updates, so it's standing on its own, no cap ๐ง.
Abstract โจ
BGP is basically the protocol the whole Internet uses to swap routing info between network domains ๐. Because it's so central, you really need to know which security measures you can and should use to stop accidental or intentional routing chaos ๐.
This doc covers ways to protect the BGP sessions themselves, like Time to Live (TTL), the TCP Authentication Option (TCP-AO), and control-plane filtering ๐ฅ. It also covers how to control the flow of routing information better, using prefix filtering and automating prefix filters, max-prefix filtering, Autonomous System (AS) path filtering, route flap dampening, and BGP community scrubbing ๐ซถ.
Status of This Memo
This memo documents an Internet Best Current Practice ๐.
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community, got public review, and was approved for publication by the Internet Engineering Steering Group (IESG). More info on BCPs is in Section 2 of RFC 5741 ๐.
For the current status, any errata, and how to send feedback, check http://www.rfc-editor.org/info/rfc7454 ๐ฆ.
Copyright Notice
Copyright (c) 2015 IETF Trust and the persons identified as the document authors. All rights reserved โจ.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the publication date. Please read these carefully, because they spell out your rights and restrictions for this document ๐. Code Components pulled from this document must include Simplified BSD License text, as described in Section 4.e of the Trust Legal Provisions, and they come with no warranty, as described in the Simplified BSD License ๐.
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1. Requirements Language . . . . . . . . . . . . . . . . . . 4
2. Scope of the Document . . . . . . . . . . . . . . . . . . . . 4
3. Definitions and Acronyms . . . . . . . . . . . . . . . . . . 4
4. Protection of the BGP Speaker . . . . . . . . . . . . . . . . 5
5. Protection of BGP Sessions . . . . . . . . . . . . . . . . . 6
5.1. Protection of TCP Sessions Used by BGP . . . . . . . . . 6
5.2. BGP TTL Security (GTSM) . . . . . . . . . . . . . . . . . 6
6. Prefix Filtering . . . . . . . . . . . . . . . . . . . . . . 7
6.1. Definition of Prefix Filters . . . . . . . . . . . . . . 7
6.1.1. Special-Purpose Prefixes . . . . . . . . . . . . . . 7
6.1.2. Unallocated Prefixes . . . . . . . . . . . . . . . . 8
6.1.3. Prefixes That Are Too Specific . . . . . . . . . . . 12
6.1.4. Filtering Prefixes Belonging to the Local AS and
Downstreams . . . . . . . . . . . . . . . . . . . . . 12
6.1.5. IXP LAN Prefixes . . . . . . . . . . . . . . . . . . 12
6.1.6. The Default Route . . . . . . . . . . . . . . . . . . 13
6.2. Prefix Filtering Recommendations in Full Routing Networks 14
6.2.1. Filters with Internet Peers . . . . . . . . . . . . . 14
6.2.2. Filters with Customers . . . . . . . . . . . . . . . 16
6.2.3. Filters with Upstream Providers . . . . . . . . . . . 16
6.3. Prefix Filtering Recommendations for Leaf Networks . . . 17
6.3.1. Inbound Filtering . . . . . . . . . . . . . . . . . . 17
6.3.2. Outbound Filtering . . . . . . . . . . . . . . . . . 17
7. BGP Route Flap Dampening . . . . . . . . . . . . . . . . . . 17
8. Maximum Prefixes on a Peering . . . . . . . . . . . . . . . . 18
9. AS Path Filtering . . . . . . . . . . . . . . . . . . . . . . 18
10. Next-Hop Filtering . . . . . . . . . . . . . . . . . . . . . 20
11. BGP Community Scrubbing . . . . . . . . . . . . . . . . . . . 21
12. Security Considerations . . . . . . . . . . . . . . . . . . . 21
13. References . . . . . . . . . . . . . . . . . . . . . . . . . 21
13.1. Normative References . . . . . . . . . . . . . . . . . . 21
13.2. Informative References . . . . . . . . . . . . . . . . . 22
Appendix A. IXP LAN Prefix Filtering - Example . . . . . . . . . 25
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 25
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 26
1. Introduction โจ
BGP, which is specified in RFC 4271 [2], is the protocol the Internet uses to exchange routing information between network domains ๐ธ. BGP doesn't directly have mechanisms that check whether the routes being swapped follow the various guidelines the Internet community has defined ๐. This doc wants to do two things: sum up the common guidelines that already exist, and help network admins apply BGP policies that actually make sense together ๐ง.
1.1. Requirements Language ๐ฆ
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [1] ๐.
2. Scope of the Document ๐
These guidelines are meant for generic Internet BGP peerings ๐. The Internet is set up so that Autonomous Systems can always agree on exceptions to a common framework for their local needs, so they can configure a BGP session differently from what this doc recommends ๐ซถ. That's perfectly fine, but every exception you configure could affect the entire inter-domain routing environment, so network administrators SHOULD carefully appraise this impact before implementation ๐.
3. Definitions and Acronyms ๐
Here's the acronym list ๐ :
- ACL: Access Control List
- ASN: Autonomous System Number
- IRR: Internet Routing Registry
- IXP: Internet Exchange Point
- LIR: Local Internet Registry
- PMTUD: Path MTU Discovery
- RIR: Regional Internet Registry
- Tier 1 transit provider: an IP transit provider that can reach any network on the Internet without purchasing transit services.
- uRPF: Unicast Reverse Path Forwarding
Besides that list, these terms have a specific meaning in this doc ๐ฆ:
- Downstream: any network that is downstream; it can be a provider or a customer network.
- Upstream: any network that is upstream.
4. Protection of the BGP Speaker ๐ก๏ธ
The BGP speaker needs protection from anyone trying to mess with the BGP session ๐ญ. This protection SHOULD be achieved with an Access Control List (ACL) that discards all packets aimed at TCP port 179 on the local device and sourced from an address that isn't known or permitted to become a BGP neighbor ๐ฅ. Experience has shown that the natural protection TCP should offer isn't always enough, since it's sometimes run in control-plane software ๐. Without ACLs, an attacker can hit a BGP speaker just by sending a huge volume of connection requests to it ๐.
If the router supports it, an ACL specific to its control plane SHOULD be used (receive-ACL, control-plane policing, etc.) ๐. That way you don't have to configure data-plane filters for packets just passing through the router, which never reach the control plane anyway โจ. If the hardware can't do that, interface ACLs can block packets addressed to the local router ๐ซถ.
Some routers set up this kind of ACL automatically when you configure BGP ๐ง. On other devices, this ACL should be configured and maintained manually or with scripts ๐.
On top of strict filtering, rate-limiting MAY be configured for accepted BGP traffic ๐ธ. Rate-limiting means only letting a certain number of bits per second (or packets per second) of BGP traffic reach the control plane ๐ฅ. That protects the BGP router's control plane in case the BGP traffic goes over what the platform can handle ๐.
Filtering and rate-limiting control-plane traffic is a bigger topic than just BGP ๐. (If a network admin takes down a router by overloading some other protocol remotely, BGP gets hurt too ๐ญ.) For a more detailed guide on protecting the router's control plane, see RFC 6192 [11] ๐.
5. Protection of BGP Sessions ๐
The current security issues with TCP-based protocols (so that includes BGP) are documented in RFC 6952 [14] ๐ฆ. The subsections below list the major points that RFC raises and give the best practices for TCP session protection in BGP operations โจ.
5.1. Protection of TCP Sessions Used by BGP ๐
Attacks on the TCP sessions BGP uses (aka BGP sessions) can bring a BGP peering down, for example by sending spoofed TCP RST packets ๐. After a successful ARP spoofing attack (or a similar man-in-the-middle attack), an attacker might even be able to inject packets into the TCP stream, which means routing attacks ๐ฑ.
There are a bunch of ways to secure BGP sessions ๐. MD5 protection of the TCP session header, described in RFC 2385 [7], was the first one ๐ธ. It's been obsoleted by the TCP Authentication Option (TCP-AO; RFC 5925 [4]), which offers stronger protection ๐ . MD5 is still the most-used option because vendors' equipment has it, but TCP-AO SHOULD be preferred when it's implemented ๐.
IPsec could also be used for session protection ๐ง. At the time of publication, there wasn't enough experience with IPsec for BGP peerings to know its impact, so more analysis is needed before guidelines can be defined ๐.
The downside of TCP session protection is the extra configuration and management overhead of maintaining authentication info (like MD5 passwords) ๐ญ. So protecting TCP sessions used by BGP is NOT REQUIRED, even when peerings run over shared networks where spoofing is possible (like IXPs) ๐ซถ. Operators are RECOMMENDED to weigh the trade-offs and apply TCP session protection where it makes sense ๐.
Also, network administrators SHOULD block spoofed packets (packets with a source IP address from their own IP address space) at all edges of their network (see RFC 2827 [8] and RFC 3704 [9]) โจ. That protects the TCP session used by Internal BGP (IBGP) from attackers outside the Autonomous System ๐๐ฅ.
5.2. BGP TTL Security (GTSM) ๐
okay bestie, BGP sessions can be made way harder to spoof with the Generalized TTL Security Mechanisms (GTSM aka TTL security), which are defined in RFC 5082 [3] ๐ . Instead of sending TCP packets with a TTL value of 1, the BGP speakers send them with a TTL value of 255, and the receiver checks that the TTL value equals 255 โจ. It's impossible to send an IP packet with a TTL of 255 to an IP host that isn't directly connected, so BGP TTL security effectively blocks all spoofing attacks from third parties that aren't directly connected to the same subnet as the BGP-speaking routers ๐. Network administrators SHOULD implement TTL security on directly connected BGP peerings ๐ซถ.
GTSM could also be applied to multi-hop BGP peering ๐ธ. To make it work, you need to configure the TTL with a proper value based on the distance between the BGP speakers (using the principle we just went over) ๐ง. Honestly, it's not as effective, because anyone inside the TTL diameter could spoof the TTL ๐ญ.
Like MD5 protection, TTL security has to be configured on both ends of a BGP session ๐ฆ.
6. Prefix Filtering ๐
the main thing about securing BGP is controlling which prefixes get received and advertised on the BGP peerings ๐. Prefixes exchanged between BGP peers are controlled with inbound and outbound filters. These can match on IP prefixes (as described in this section), AS paths (as described in Section 9), or any other attributes of a BGP prefix, like BGP communities (as described in Section 11) ๐.
6.1. Definition of Prefix Filters ๐
this section lists the most commonly used prefix filters. The following sections will clarify where these filters should be applied ๐ฆ.
6.1.1. Special-Purpose Prefixes โจ
6.1.1.1. IPv4 Special-Purpose Prefixes
the IANA IPv4 Special-Purpose Address Registry [23] maintains the list of IPv4 special-purpose prefixes and their routing scope, and it SHOULD be used for prefix-filter configuration ๐ . Prefixes with the value "False" in the column "Global" SHOULD be discarded on Internet BGP peerings ๐ซ.
6.1.1.2. IPv6 Special-Purpose Prefixes
the IANA IPv6 Special-Purpose Address Registry [24] maintains the list of IPv6 special-purpose prefixes and their routing scope, and it SHOULD be used for prefix-filter configuration ๐ง. Only prefixes with the value "False" in the column "Global" SHOULD be discarded on Internet BGP peerings ๐ธ.
6.1.2. Unallocated Prefixes ๐
okay so IANA allocates prefixes to RIRs, and those RIRs allocate prefixes to LIRs (Local Internet Registries) ๐. It is wise not to accept routing table prefixes that weren't allocated by IANA and/or RIRs ๐ง . This section details the options for building a list of allocated prefixes at every level. It's really important to understand that filtering unallocated prefixes needs constant updates, since prefixes keep getting allocated ๐ฉ. So automating these prefix filters is key for this approach to work ๐ค. Network administrators SHOULD NOT consider the solutions in this section if they aren't capable of maintaining updated prefix filters, because the damage would probably be worse than the intended security policy ๐.
6.1.2.1. IANA-Allocated Prefix Filters ๐
IANA has allocated all the available IPv4 space ๐ฅฒ. There's no reason for network administrators to keep checking that the prefixes they receive from BGP peers are in the IANA-allocated IPv4 address space [25]. Administrators who want to make sure the IPv4 prefixes they receive in BGP updates were allocated by IANA don't need to put any specific filters in place ๐โโ๏ธ.
For IPv6, given how big the address space is, it can be seen as wise to accept only prefixes derived from those allocated by IANA ๐. Administrators can dynamically build this list from the IANA-allocated IPv6 space [26]. Since IANA keeps allocating prefixes to RIRs, the list above should be checked regularly for changes. If changes happen, prefix filters should be computed and pushed onto network devices ๐. The list could also be pulled directly by routers, if they implement such mechanisms ๐ซถ. There's a delay between the time a RIR receives a new prefix and the moment it starts allocating portions of it to its LIRs, so there's no need to do this step quickly and frequently ๐ข. However, network administrators SHOULD ensure that all IPv6 prefix filters are updated within a maximum of one month after any change in the list of IPv6 prefixes allocated by IANA ๐ .
If the process in place (whether manual or automatic) can't guarantee that the list is updated regularly, then it's better not to configure any filters based on allocated networks ๐ โโ๏ธ. The IPv4 experience showed that many network operators implemented filters for prefixes not allocated by IANA but didn't update them on a regular basis ๐ฌ. This created problems for the latest allocations, and it required extra work for RIRs, who had to "de-bogonize" the newly allocated prefixes (see [18] for information on de-bogonizing) ๐งน.
6.1.2.2. RIR-Allocated Prefix Filters ๐ท
a more precise check can be performed when you want to make sure the prefixes you receive are being originated or transited by Autonomous Systems (ASes) that are entitled to do so ๐ต๏ธโโ๏ธ. It has been observed in the past that an AS could easily advertise someone else's prefix (or more specific prefixes) and create black holes or security threats ๐ณ๏ธ. To partially mitigate this risk, administrators need to make sure BGP advertisements correspond to the information in the existing registries ๐. At this stage, two options can be considered: short- and long-term options. They are described in the following subsections ๐ .
6.1.2.2.1. Prefix Filters Created from Internet Routing Registries (IRRs) ๐๏ธ
an Internet Routing Registry (IRR) is a database containing Internet routing information, described using Routing Policy Specification Language objects as described in RFC 4012 [10] ๐ญ. Network administrators are given privileges to describe the routing policies of their own networks in the IRR, and that information is published, usually publicly ๐ข. A majority of Regional Internet Registries also operate an IRR, and they can control whether registered routes conform to the prefixes that are allocated or directly assigned ๐ฏ. However, it should be noted that the list of such prefixes isn't necessarily complete, so the list of routes in an IRR isn't the same as the set of RIR-allocated prefixes ๐ค.
it's possible to use the IRR information to build, for a given neighbor AS, a list of originated or transited prefixes that you may accept โจ. This can be done relatively easily with scripts and existing tools that retrieve this information from the registries ๐ ๏ธ. This approach is exactly the same for both IPv4 and IPv6 ๐ฏโโ๏ธ.
Here's the macro-algorithm for the script ๐ง . For the peer being considered, the distant network administrator has provided the AS and may be able to provide an AS-SET object (aka AS-MACRO). An AS-SET is an object that contains AS numbers or other AS-SETs ๐ช. An operator may create an AS-SET defining all the AS numbers of its customers. A Tier 1 transit provider might create an AS-SET describing the AS-SETs of connected operators, which in turn describe the AS numbers of their customers ๐ข. Using recursion, it's possible to retrieve from an AS-SET the complete list of AS numbers that the peer is likely to announce ๐. For each of these AS numbers, it's also easy to look in the corresponding IRR for all associated prefixes ๐. With these two mechanisms, a script can build, for a given peer, the list of allowed prefixes and the AS number they should be originated from ๐. You could also decide not to use the origin information and only build monolithic prefix filters from the fetched data ๐งฑ.
As prefixes, AS numbers, and AS-SETs may not all be under the same RIR authority, it's difficult to choose the appropriate IRR to poll for each object ๐ตโ๐ซ. Some IRRs have been created that aren't restricted to a given region or authoritative RIR ๐. They allow RIRs to publish the information contained in their IRR in a common place. They also make it possible for any subscriber (probably under contract) to publish information too ๐. When making requests inside such an IRR, you can specify the source of information to get the most reliable data ๐ฏ. You could check a popular IRR containing many sources (such as RADb [27], the Routing Assets Database) and only select as sources some desired RIRs and trusted major ISPs (Internet Service Providers) ๐ก๏ธ.
Objects in IRRs can change frequently over time, so it's important that prefix filters computed this way are refreshed regularly โฐ. Refreshing the filters on a daily basis SHOULD be considered, because routing changes sometimes have to be made in an emergency, and registries may be updated at the very last moment ๐จ. Be warned: this approach significantly increases the complexity of router configurations, since it can quickly add tens of thousands of configuration lines for some important peers ๐. To manage this complexity, network administrators could use, for example, IRRToolSet [30], a set of tools that simplifies creating automated filter configuration from policies stored in an IRR ๐งฐ.
Last but not least, network administrators SHOULD publish and maintain their resources properly in the IRR database maintained by their RIR, when one is available ๐.
6.1.2.2.2. SIDR - Secure Inter-Domain Routing โจ
okay so there's this whole infrastructure called SIDR (Secure Inter-Domain Routing), described in RFC 6480 [12], and it was built to lock down Internet advertisements ๐. when this was written, a bunch of documents were already out there, and a full framework of protocols was being proposed so advertisements can get checked against signed routing objects held by RIRs. SIDR basically gives you two services ๐
- Origin validation, described in RFC 6811 [5], is all about making sure the attributes on routes are legit. (the big one is checking that the AS number originating a route is the right one ๐) Origin validation is operational now (registries, protocols, and implementations on some routers are all live ๐). In theory you can implement it, even though the number of signed resources was still pretty low when this was written ๐ฅบ
- Path validation, provided by BGPsec [29], is there to make sure nobody announces fake or wrong BGP paths that would pull traffic toward a destination. see RFC 7132 [16] for that ๐ต๏ธโโ๏ธ. BGPsec was still an ongoing work item when this was written, so it could not be implemented yet ๐ง
implementing SIDR mechanisms is expected to fix a lot of BGP routing security problems in the long run โณ, but deployments and signed objects can take a minute to show up ๐ซ . also, SIDR is complementing the security best practices in this document, not replacing them ๐. so network administrators SHOULD implement any SIDR-proposed mechanism (route origin validation, for example) on top of the other existing mechanisms, even if they seem to be going after the same goal ๐ซถ.
if you do implement route origin validation, the reader SHOULD refer to the rules in RFC 7115 [15]. the short version: each external route received on a router SHOULD be checked against the Resource Public Key Infrastructure (RPKI) data set ๐
- if a corresponding ROA (Route Origin Authorization) is found and is valid, then the prefix SHOULD be accepted โ
- if the ROA is found and is INVALID, then the prefix SHOULD be discarded ๐๏ธ
- if a ROA is not found, then the prefix SHOULD be accepted, but the corresponding route SHOULD be given a low preference ๐ฅ
on top of all that, network administrators SHOULD sign their routing objects so other networks running origin validation can validate their routes ๐โจ
ngl the RPKI model brings some new and genuinely interesting challenges ๐คฏ. the paper "On the Risk of Misbehaving RPKI Authorities" [31] explains how the RPKI model can affect the Internet if authorities don't behave the way they're supposed to ๐ฌ. more analysis on RPKI is definitely needed, since it carries part of BGP security ๐ง.
6.1.3. Prefixes That Are Too Specific ๐
most ISPs won't accept advertisements past a certain level of specificity, and in return they don't announce prefixes they consider too specific ๐ค. that acceptable specificity is decided for each peering between the two BGP peers. some ISP communities have tried to write this down. this document doesn't judge what the best approach is ๐ โโ๏ธ. it just notes that there are existing practices on the Internet and recommends that the reader look at them ๐. for example, the RIPE community documented that, when this was written, IPv4 prefixes longer than /24 and IPv6 prefixes longer than /48 are generally neither announced nor accepted on the Internet [20] [21] ๐. those values may change in the future ๐.
6.1.4. Filtering Prefixes Belonging to the Local AS and Downstreams ๐
a network SHOULD filter its own prefixes on peerings with all of its peers (inbound direction) ๐. this stops local traffic (from a local source to a local destination) from leaking out over an external peering, in case someone else is announcing that prefix over the Internet ๐ค. it also protects the infrastructure that could directly suffer if the backbone's prefix suddenly gets preferred over the Internet ๐ซฃ.
in some cases, like multihoming scenarios, such filters SHOULD NOT be applied, since that would break the redundancy you want ๐ โโ๏ธ๐.
to an extent, these filters can also be set up on a network for its downstreams' prefixes to protect them too ๐ก๏ธ. but they have to be defined with caution, because they can break existing redundancy mechanisms โ ๏ธ. for example, when an operator has a multihomed customer, it should keep accepting the customer's prefix from its peers and upstreams ๐. that way the customer can keep reaching the operator network (and other customers) via the Internet even if the BGP peering between the customer and the operator is down ๐.
6.1.5. IXP LAN Prefixes ๐
6.1.5.1. Network Security ๐
when a network is present on an IXP and peers with other IXP members over a common subnet (IXP LAN prefix), it SHOULD NOT accept more-specific prefixes for the IXP LAN prefix from any of its external BGP peers ๐ซ. accepting those routes may create a black hole for connectivity to the IXP LAN ๐ณ๏ธ.
if the IXP LAN prefix is accepted as an "exact match", you have to be careful that other routers in the network don't send IXP traffic toward the externally learned IXP LAN prefix (a recursive route lookup pointing the wrong way ๐). this can be handled by preferring IGP routes over External BGP (EBGP), or by using "BGP next-hop-self" on all routes learned on that IXP ๐งญ.
if the IXP LAN prefix is accepted at all, it SHOULD only be accepted from the ASes that the IXP authorizes to announce it. this usually happens automatically when you filter announcements using the IRR database ๐ช.
6.1.5.2. PMTUD and the Loose uRPF Problem ๐ฆ
to get PMTUD working with loose uRPF, all the networks that may source traffic that could flow through the IXP (IXP members and their downstreams) need a route for the IXP LAN prefix ๐บ๏ธ. this matters because "packet too big" ICMP messages sent by IXP members' routers may be sourced from an address in the IXP LAN prefix. with loose uRPF, that ICMP packet gets dropped if there's no route for the IXP LAN prefix, or for a less specific route covering it ๐ฅ.
in that case, any IXP member SHOULD make sure it has a route for the IXP LAN prefix (or a less specific prefix) on all of its routers, and that it announces the IXP LAN prefix or the less specific route (up to a default route) to its downstreams ๐ฃ. the announcements done for this purpose SHOULD pass the IRR-generated filters described in Section 6.1.2.2.1, as well as the "prefixes that are too specific" filters described in Section 6.1.3 โ . the easiest way to do this is for the IXP itself to originate its prefix and advertise it to all IXP members through a BGP peering ๐. most likely, BGP route servers would be used for this, and the IXP would send its entire prefix, which is equal to or less specific than the IXP LAN prefix ๐ฅ๏ธ.
Appendix A gives an example of guidelines for the IXP LAN prefix ๐.
6.1.6. The Default Route ๐ฃ๏ธ
6.1.6.1. IPv4
typically, the 0.0.0.0/0 prefix isn't meant to be accepted or advertised, except in specific customer/provider configurations. general filtering outside of those is RECOMMENDED ๐งน.
6.1.6.2. IPv6
typically, the ::/0 prefix isn't meant to be accepted or advertised, except in specific customer/provider configurations. general filtering outside of those is RECOMMENDED ๐งน.
6.2. Prefix Filtering Recommendations in Full Routing Networks ๐
for networks that carry the full Internet BGP table, some policies should be applied on each BGP peer for received and advertised routes ๐. it is RECOMMENDED that each Autonomous System configures rules for advertised and received routes at all of its borders, since this protects the network and its peer even if there's a misconfiguration ๐ก๏ธ๐. the most commonly used filtering policy is proposed in this section, and it uses the prefix filters defined in Section 6.1 ๐ง.
6.2.1. Filters with Internet Peers ๐
6.2.1.1. Inbound Filtering ๐ฅ
there are basically two options. the loose one doesn't check anything against RIR allocations, and the strict one verifies that announcements strictly conform to what's declared in routing registries ๐ง.
6.2.1.1.1. Inbound Filtering Loose Option ๐
in this case, the following prefixes received from a BGP peer will be filtered:
- prefixes that are not globally routable (Section 6.1.1)
- prefixes not allocated by IANA (IPv6 only) (Section 6.1.2.1)
- routes that are too specific (Section 6.1.3)
- prefixes belonging to the local AS (Section 6.1.4)
- IXP LAN prefixes (Section 6.1.5)
- the default route (Section 6.1.6)
6.2.1.1.2. Inbound Filtering Strict Option ๐ง
in this case, filters are applied to make sure advertisements strictly conform to what's declared in routing registries (Section 6.1.2.2). โ ๏ธ heads up: registries aren't always accurate (prefixes missing, wrong information, etc.), and this varies across registries and regions of the Internet ๐. before applying a strict policy, the reader SHOULD check the impact on the filter and make sure the solution isn't worse than the problem ๐ฌ.
also, if the script fails, each administrator may decide whether all routes are accepted or rejected, depending on routing policy ๐คทโโ๏ธ. accepting routes during that time frame could break BGP routing security, but rejecting them might re-route too much traffic over transit peers and cause more harm than a loose policy would have ๐ตโ๐ซ.
in addition, network administrators could apply the following filters beforehand, in case the routing registry the script uses as its source of information isn't fully trusted ๐ซก:
- prefixes that are not globally routable (Section 6.1.1)
- routes that are too specific (Section 6.1.3)
- prefixes belonging to the local AS (Section 6.1.4)
- IXP LAN prefixes (Section 6.1.5)
- the default route (Section 6.1.6)
6.2.1.2. Outbound Filtering ๐ค
the configuration should make sure only appropriate prefixes are sent ๐. these can be, for example, prefixes belonging to both the network in question and its downstreams. you can do this with BGP communities, AS paths, or both ๐ท๏ธ. it may also be desirable to add the following filters before any policy, to avoid unwanted route announcements caused by bad configuration ๐:
- Prefixes that are not globally routable (Section 6.1.1)
- Routes that are too specific (Section 6.1.3)
- IXP LAN prefixes (Section 6.1.5)
- The default route (Section 6.1.6)
if it's possible to list the prefixes to be advertised, then just configuring the list of allowed prefixes and denying the rest is sufficient ๐ฏ.
6.2.2. Filters with Customers ๐ผ
6.2.2.1. Inbound Filtering ๐
okay so the inbound policy with end customers is seriously simple, bestie ๐ โโ๏ธ: only customer prefixes SHOULD be accepted, and all the others SHOULD be discarded. You can write the accepted list out by hand, but only after you've verified the prefixes are valid. That check happens with the appropriate IP address management authorities ๐ง.
The same rules apply when the customer is a network that connects other customers, like a Tier 1 transit provider linking up service providers ๐ฆ. The exception is when the customer network applies strict inbound/outbound prefix filtering and announces too many prefixes to list in the router config. In that case, filters as in Section 6.2.1.1 can be applied ๐ .
6.2.2.2. Outbound Filtering โจ
The outbound policy with customers depends on which routes the customer wants to get ๐. The simplest case is when they only want the default route. That's easy: apply a filter with the default route only ๐.
If the customer wants the full routing table (maybe because they're multihomed, or they just want to see the whole Internet table ๐), these filters can go on the BGP peering:
- prefixes that are not globally routable (Section 6.1.1)
- routes that are too specific (Section 6.1.3)
- the default route (Section 6.1.6)
Sometimes the customer wants the default route on top of the full BGP table. The provider can do that by simply removing the filter for the default route ๐. Heads up, though: the default route might not be in the routing table, so network admins may choose to originate it only for the peerings where it has to be advertised ๐ง.
6.2.3. Filters with Upstream Providers ๐ท
6.2.3.1. Inbound Filtering ๐ฏ
If you want the full routing table from your upstream, the prefix filtering is the same as the one for peers (Section 6.2.1.1), except for the default route. Sometimes the default route (on top of the full BGP table) is desired from an upstream provider. If that upstream is supposed to announce only the default route, a simple filter does the job: accept only the default prefix and nothing else ๐ง.
6.2.3.2. Outbound Filtering ๐
The filters would most likely not look that different from the ones used for Internet peers (Section 6.2.1.2). Still, different policies could be applied if a particular upstream should not provide transit to all the prefixes ๐ฆ.
6.3. Prefix Filtering Recommendations for Leaf Networks ๐ธ
6.3.1. Inbound Filtering ๐
The leaf network will deploy the filters that match the routes it's requesting from its upstream. If it requests a default route, a simple inbound filter can accept only the default route (Section 6.1.6). If the leaf network can't list the prefixes because there are too many (for example, if it needs the full Internet routing table), then it should configure the following filters to avoid receiving bad announcements from its upstream ๐ก๏ธ:
- prefixes not routable (Section 6.1.1)
- routes that are too specific (Section 6.1.3)
- prefixes belonging to local AS (Section 6.1.4)
- the default route (Section 6.1.6) depending on whether or not the route is requested
6.3.2. Outbound Filtering ๐ค
A leaf network will most likely have a super straightforward policy: it only announces its local routes ๐ก. It can also configure the prefix filters described in Section 6.2.1.2 so it doesn't announce invalid routes to its upstream provider.
7. BGP Route Flap Dampening ๐ฅ
The BGP route flap dampening mechanism gives penalties to routes every time they change in the BGP routing table ๐. It was originally created to protect the entire Internet from the many events that hit a single network. Studies have shown that implementations of BGP route flap dampening could do more harm than good, so in the past the RIPE community recommended against using it [19] ๐ฌ. Later on, studies were done to propose new dampening thresholds to make it "usable" (see RFC 7196 [6] and [22], where RIPE reviewed its own recommendations) ๐ง . This document RECOMMENDS following the IETF and RIPE recommendations and using BGP route flap dampening with the adjusted, configured thresholds โจ.
8. Maximum Prefixes on a Peering ๐ง
It is RECOMMENDED to configure a limit on the number of routes accepted from a peer ๐. The following rules are generally RECOMMENDED:
- From peers, it is RECOMMENDED to have a limit lower than the number of routes in the Internet. This will shut down the BGP peering if the peer suddenly advertises the full table ๐ โโ๏ธ. Network administrators can also configure different limits for each peer, based on the number of routes they're supposed to advertise, plus some headroom to allow for growth ๐.
- From upstreams that provide full routing, it is RECOMMENDED to have a limit higher than the number of routes in the Internet. A limit is still useful to protect the network (and in particular, the routers' memory) if too many routes are sent by the upstream ๐พ. The limit should be chosen according to the number of routes that routers can actually handle.
It's important to review the limits regularly because the Internet can change fast ๐โโ๏ธ๐จ. Some vendors offer two thresholds: the higher number shuts down the peering, while the first threshold only triggers a log. You can use that log to passively adjust limits based on what you observe on the network ๐.
9. AS Path Filtering ๐ฃ๏ธ
This section lists the RECOMMENDED practices for processing BGP AS paths ๐ .
- Network administrators SHOULD accept from customers only 2-byte or 4-byte AS paths containing ASNs that belong to (or are authorized to transit through) the customer ๐ชช. If network administrators can't build and generate filtering expressions to do this, they SHOULD consider accepting only the path lengths that fit the type of customer they have (like whether those customers are a leaf or have customers of their own), and they SHOULD try to discourage excessive prepending in such paths ๐. This loose policy could be combined with filters for specific 2-byte or 4-byte AS paths that must not be accepted if the customer advertises them, such as upstream transit providers or peer ASNs ๐ซ.
- Network administrators SHOULD NOT accept prefixes with private AS numbers in the AS path unless the prefixes come from customers ๐. There's an exception: when an upstream offers a particular service like black-hole origination based on a private AS number, prefixes SHOULD be accepted in that case ๐ณ๏ธ. Customers should be informed by their upstream so they can set up ad hoc policy to use those services ๐ฃ.
- Network administrators SHOULD NOT accept prefixes when the first AS number in the AS path isn't the peer's own, unless the peering is done toward a BGP route server [17] (for example, at an IXP) with transparent AS path handling ๐ค. In that case, this verification needs to be turned off, because the first AS number will belong to an IXP member, while the peer AS number will belong to the BGP route server ๐งฉ.
- Network administrators SHOULD NOT advertise prefixes with a nonempty AS path unless they intend to provide transit for those prefixes ๐.
- Network administrators SHOULD NOT advertise prefixes with upstream AS numbers in the AS path to their peering AS unless they intend to provide transit for those prefixes ๐ โโ๏ธ.
- Private AS numbers are conventionally used in "private" contexts. They SHOULD NOT be used in advertisements to BGP peers that aren't party to those private arrangements, and they SHOULD be stripped when received from BGP peers that aren't party to those private arrangements ๐คซ.
- Network administrators SHOULD NOT override BGP's default behavior, i.e., they should not accept their own AS number in the AS path ๐ โโ๏ธ. If they're thinking about an exception, the impact (which may be severe on routing) should be studied carefully โ ๏ธ.
AS path filtering should be analyzed further when ASN renumbering happens. It's a super common operation, and there are mechanisms for smooth ASN migration [28] ๐ฆ. The usual migration technique, local to a router, changes the AS path so it's presented to a peer with the previous ASN, as if no renumbering happened ๐ช. That makes it possible to change a router's ASN without reconfiguring all EBGP peers at the same time (which would otherwise require synchronizing with every peer attached to that router) ๐ซถ. During this renumbering, the rules described above may be adjusted ๐.
10. Next-Hop Filtering ๐
If you're peering on a shared network like an IXP, BGP can advertise prefixes with a third-party next hop, which sends packets somewhere other than the peer that announced the prefix ๐บ๏ธ.
This is a desirable property for BGP route-server setups [17], where the route server relays routing information but has neither the capacity nor the desire to receive the actual data packets ๐. So the BGP route server announces prefixes with a next-hop setting that points to the router that originally announced the prefix to the route server ๐ฎ.
In direct peerings between ISPs, though, this is undesirable ๐ค. One peer could trick the other into sending packets into a black hole (an unreachable next hop) or to an unsuspecting third party who then has to carry the traffic ๐. Especially for black-holing, the root cause is hard to spot without inspecting BGP prefixes at the receiving router of the IXP ๐.
So, an inbound route policy SHOULD be applied on IXP peerings to set the next hop for accepted prefixes to the BGP peer IP address (on the IXP LAN) that sent the prefix. That's what "next-hop-self" would enforce on the sending side ๐ง.
This policy SHOULD NOT be used on route-server peerings, or on peerings where network administrators intentionally let the other side send third-party next hops ๐ โโ๏ธ.
This policy also SHOULD be adjusted if the best practice of Remote Triggered Black Holing (aka RTBH, as described in RFC 6666 [13]) is implemented ๐ณ๏ธ. In that case, network administrators would apply a well-known BGP next hop to routes they want to filter (for example, if an Internet threat is observed from or to that route) ๐จ. That well-known next hop is statically routed to a null interface. Combined with a unicast RPF check, this discards traffic from and toward the prefix ๐งน. Peers can exchange black-hole information using, for example, particular BGP communities ๐ฌ. Network administrators could also propagate black-hole information to their peers using an agreed-upon BGP community: when a route with that community is received, a configured policy could change the next hop to create the black hole ๐ค.
That's the whole vibe, bestie! ๐
11. BGP Community Scrubbing ๐งนโจ
okay so bestie, this section is basically about being a tidy little neighbor with your communities ๐ . "Optionally" means you can think about these rules on BGP AS paths, no pressure ๐ธ.
- Network administrators SHOULD scrub inbound communities with their number in the high-order bits, and allow only those communities that customers/peers can use as a signaling mechanism ๐งผ๐
- Networks administrators SHOULD NOT remove other communities applied on received routes (communities not removed after application of the previous statement). In particular, they SHOULD keep original communities when they apply a community. Customers might need them to communicate with upstream providers ๐ซถ. In particular, network administrators SHOULD NOT (generally) remove the no-export community, as it is usually announced by their peer for a certain purpose ๐๐.
12. Security Considerations ๐๐
okay this one is SERIOUS bestie, but also iconic ๐ญ๐ฅ. This document is entirely about BGP operational security. It depicts best practices that one should adopt to secure BGP infrastructure: protecting BGP router and BGP sessions, adopting consistent BGP prefix and AS path filters, and configuring other options to secure the BGP network ๐.
This document does not aim to describe existing BGP implementations, their potential vulnerabilities, or ways they handle errors. It does not detail how protection could be enforced against attack techniques using crafted packets ๐ฆ.
13. References ๐๐
13.1. Normative References ๐
- [1] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", RFC 2119, March 1997, <http://www.rfc-editor.org/info/rfc2119>.
- [2] Rekhter,, Y., Li,, T., and S. Hares,, "A Border Gateway Protocol 4 (BGP-4)", RFC 4271, January 2006, <http://www.rfc-editor.org/info/rfc4271>.
- [3] Gill, V., Heasley, J., Meyer, D., Savola,, P., and C. Pignataro, "The Generalized TTL Security Mechanism (GTSM)", RFC 5082, October 2007, <http://www.rfc-editor.org/info/rfc5082>.
- [4] Touch, J., Mankin, A., and R. Bonica, "The TCP Authentication Option", RFC 5925, June 2010, <http://www.rfc-editor.org/info/rfc5925>.
- [5] Mohapatra, P., Scudder, J., Ward, D., Bush, R., and R. Austein, "BGP Prefix Origin Validation", RFC 6811, January 2013, <http://www.rfc-editor.org/info/rfc6811>.
- [6] Pelsser, C., Bush, R., Patel, K., Mohapatra, P., and O. Maennel, "Making Route Flap Damping Usable", RFC 7196, May 2014, <http://www.rfc-editor.org/info/rfc7196>.
13.2. Informative References ๐ธ
- [7] Heffernan, A., "Protection of BGP Sessions via the TCP MD5 Signature Option", RFC 2385, August 1998, <http://www.rfc-editor.org/info/rfc2385>.
- [8] Ferguson, P. and D. Senie, "Network Ingress Filtering: Defeating Denial of Service Attacks which employ IP Source Address Spoofing", RFC 2827, May 2000, <http://www.rfc-editor.org/info/rfc2827>.
- [9] Baker, F. and P. Savola, "Ingress Filtering for Multihomed Networks", RFC 3704, March 2004, <http://www.rfc-editor.org/info/rfc3704>.
- [10] Blunk, L., Damas, J., Parent, F., and A. Robachevsky, "Routing Policy Specification Language next generation (RPSLng)", RFC 4012, March 2005, <http://www.rfc-editor.org/info/rfc4012>.
- [11] Dugal, D., Pignataro, C., and R. Dunn, "Protecting the Router Control Plane", RFC 6192, March 2011, <http://www.rfc-editor.org/info/rfc6192>.
- [12] Lepinski, M. and S. Kent, "An Infrastructure to Support Secure Internet Routing", RFC 6480, February 2012, <http://www.rfc-editor.org/info/rfc6480>.
- [13] Hilliard, N. and D. Freedman, "A Discard Prefix for IPv6", RFC 6666, August 2012, <http://www.rfc-editor.org/info/rfc6666>.
- [14] Jethanandani, M., Patel, K., and L. Zheng, "Analysis of BGP, LDP, PCEP, and MSDP Issues According to the Keying and Authentication for Routing Protocols (KARP) Design Guide", RFC 6952, May 2013, <http://www.rfc-editor.org/info/rfc6952>.
- [15] Bush, R., "Origin Validation Operation Based on the Resource Public Key Infrastructure (RPKI)", RFC 7115, January 2014, <http://www.rfc-editor.org/info/rfc7115>.
- [16] Kent, S. and A. Chi, "Threat Model for BGP Path Security", RFC 7132, February 2014, <http://www.rfc-editor.org/info/rfc7132>.
- [17] Jasinska, E., Hilliard, N., Raszuk, R., and N. Bakker, "Internet Exchange Route Server", Work in Progress, draft-ietf-idr-ix-bgp-route-server-06, December 2014.
- [18] Karrenberg, D., "RIPE-351 - De-Bogonising New Address Blocks", October 2005.
- [19] Smith, P. and C. Panigl, "RIPE-378 - RIPE Routing Working Group Recommendations On Route-flap Damping", May 2006.
- [20] Smith, P., Evans, R., and M. Hughes, "RIPE-399 - RIPE Routing Working Group Recommendations on Route Aggregation", December 2006.
- [21] Smith, P. and R. Evans, "RIPE-532 - RIPE Routing Working Group Recommendations on IPv6 Route Aggregation", November 2011.
- [22] Smith, P., Bush, R., Kuhne, M., Pelsser, C., Maennel, O., Patel, K., Mohapatra, P., and R. Evans, "RIPE-580 - RIPE Routing Working Group Recommendations On Route-flap Damping", January 2013.
- [23] IANA, "IANA IPv4 Special-Purpose Address Registry", <http://www.iana.org/assignments/iana-ipv4-special-registry>.
- [24] IANA, "IANA IPv6 Special-Purpose Address Registry", <http://www.iana.org/assignments/iana-ipv6-special-registry>.
- [25] IANA, "IANA IPv4 Address Space Registry", <http://www.iana.org/assignments/ipv4-address-space>.
- [26] IANA, "Internet Protocol Version 6 Address Space", <http://www.iana.org/assignments/ipv6-address-space>.
- [27] Merit Network Inc., "Merit RADb", <http://www.radb.net>.
- [28] George, W. and S. Amante, "Autonomous System (AS) Migration Features and Their Effects on the BGP AS_PATH Attribute", Work in Progress, draft-ga-idr-as-migration-03, January 2014.
- [29] Bellovin, S., Bush, R., and D. Ward, "Security Requirements for BGP Path Validation", RFC 7353, August 2014, <http://www.rfc-editor.org/info/rfc7353>.
- [30] "IRRToolSet project page", <http://irrtoolset.isc.org>.
- [31] Cooper, D., Heilman, E., Brogle, K., Reyzin, L., and S. Goldberg, "On the Risk of Misbehaving RPKI Authorities", <http://www.cs.bu.edu/~goldbe/papers/hotRPKI.pdf>.
Appendix A. IXP LAN Prefix Filtering - Example ๐๐ฆ
okay bestie, this example is giving real-world vibes ๐โจ. An IXP in the RIPE region is allocated an IPv4 /22 prefix by RIPE NCC (X.Y.0.0/22 in this example) and uses a /23 of this /22 for the IXP LAN (let say X.Y.0.0/23). This IXP LAN prefix is the one used by IXP members to configure EBGP peerings. The IXP could also be allocated an AS number (AS64496 in our example).
Any IXP member SHOULD make sure it filters prefixes more specific than X.Y.0.0/23 from all its EBGP peers. If it received X.Y.0.0/24 or X.Y.1.0/24 this could seriously impact its routing ๐ญ๐.
The IXP SHOULD originate X.Y.0.0/22 and advertise it to its members through an EBGP peering (most likely from its BGP route servers, configured with AS64496) ๐.
The IXP members SHOULD accept the IXP prefix only if it passes the IRR generated filters (see Section 6.1.2.2.1) ๐ง.
IXP members SHOULD then advertise X.Y.0.0/22 prefix to their downstreams. This announce would pass IRR based filters as it is originated by the IXP ๐๐.
Acknowledgements ๐ซถ๐
okay the authors wanna thank everyone who helped out, so here's the squad ๐: Marc Blanchet, Ron Bonica, Randy Bush, David Freedman, Wesley George, Daniel Ginsburg, David Groves, Mike Hugues, Joel Jaeggli, Tim Kleefass, Warren Kumari, Jacques Latour, Lionel Morand, Jerome Nicolle, Hagen Paul Pfeifer, Thomas Pinaud, Carlos Pignataro, Jean Rebiffe, Donald Smith, Kotikalapudi Sriram, Matjaz Straus, Tony Tauber, Gunter Van de Velde, Sebastian Wiesinger, and Matsuzaki Yoshinobu.
The authors would also like to thank once again Gunter Van de Velde for presenting the document at several IETF meetings in various working groups, indeed helping dissemination of this document and gathering of precious feedback ๐ธโจ.
Authors' Addresses ๐ฎ
- Jerome Durand Cisco Systems, Inc. 11 rue Camille Desmoulins Issy-les-Moulineaux 92782 CEDEX France EMail: jerduran@cisco.com
- Ivan Pepelnjak NIL Data Communications Tivolska 48 Ljubljana 1000 Slovenia EMail: ip@ipspace.net
- Gert Doering SpaceNet AG Joseph-Dollinger-Bogen 14 Muenchen D-80807 Germany EMail: gert@space.net
That's the whole RFC, bestie! ๐๐ BGP operational security, all wrapped up ๐โจ
๐ฆ where this page comes from
- ietf: rfc7454 2015-02
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms