BGP Communities Guide: Standard, Extended, Large (RFC 8092)
BGP communities are optional tags attached to a route that tell other routers what to do with it: prefer it, prepend it, withhold it from certain peers, or drop traffic to it. Standard, extended and large communities (RFC 8092) all work the same way: you attach a tag, and a routing policy somewhere matches on it.
This guide covers the three community types, how to read an upstream's community documentation, and how to apply the tags in practice on Cisco, Juniper, FRR and BIRD. It ends with how communities connect to RTBH and DDoS mitigation.
All ASNs and prefixes below are documentation values. We are AS64496 with 192.0.2.0/24, and our upstream is AS64500.
The three community types
| Type | RFC | Size | Format | Typical use |
|---|---|---|---|---|
| Standard | RFC 1997 | 32 bits | ASN:value (16 + 16 bits) |
Upstream action tags, no-export, blackhole |
| Extended | RFC 4360 | 64 bits | type/subtype + value | Route targets (VPNs), FlowSpec actions |
| Large | RFC 8092 | 96 bits | Global:Local1:Local2 (32 + 32 + 32) |
4-byte ASN schemes, structured policy |
Standard communities are the ones you will use most. The limit is that the ASN half is only 16 bits. A network with a 4-byte ASN cannot put its own ASN in the first half, so many operators use a private or alternate value instead.
Extended communities are mostly invisible to day-to-day transit policy. You will meet them in MPLS VPNs (route targets) and in BGP FlowSpec, where the action (rate-limit, redirect, mark) is encoded in an extended community.
Large communities fix the 4-byte ASN problem. The first field is the global administrator (your ASN), and the other two 32-bit fields are free-form. A common convention is ASN:function:parameter, for example 64496:100:80 meaning "function 100 (local-pref), parameter 80".
Well-known communities
| Name | Value | Meaning |
|---|---|---|
| NO_EXPORT | 65535:65281 | Do not advertise outside the AS (or confederation) |
| NO_ADVERTISE | 65535:65282 | Do not advertise to any BGP peer |
| NO_EXPORT_SUBCONFED | 65535:65283 | Do not advertise outside the local sub-AS |
| BLACKHOLE | 65535:666 | Drop traffic to this prefix (RFC 7999) |
How to read an upstream's community documentation
Most transit providers publish a community table, usually on a web page, in their IRR aut-num object remarks, or in a PeeringDB record. The tables look similar but differ in details. A hypothetical example:
| Community | Action |
|---|---|
| 64500:70 | Set local-pref 70 (backup) |
| 64500:80 | Set local-pref 80 |
| 64500:1001 | Prepend 1x to all peers |
| 64500:1002 | Prepend 2x to all peers |
| 64500:2001 | Do not announce to peers in Europe |
| 64500:3000 | Do not announce to any peer (customers only) |
| 64500:666 | Blackhole |
Before using any table, check these points:
- Direction. These communities are set by you on routes you send to the upstream. They change how the upstream treats your route, and therefore how inbound traffic reaches you. Local-pref set in your own router only changes your outbound traffic.
- Scope. Does "prepend" apply to every peer or only to specific ones? Is "do not announce to Europe" based on location of the peer or of the route?
- Format. Does the provider accept standard, large, or both? Some only act on standard communities.
- Order of operations. Providers typically evaluate action communities after route validation. A prefix that fails IRR or RPKI filtering will be rejected whatever tags it carries.
- Informational tags. Many providers also tag routes they send you with where and from whom they learned them (customer, peer, IX, region). These are useful for your own policy.
Use case 1: Local-pref control
Two jobs share this name.
- Inbound policy from your customers. You define your own communities so customers can request backup treatment. For example, a customer sends
64496:100:80and your edge sets local-pref 80 on that route. - Influencing your upstream. You send
64500:70to an upstream so it treats your announcement on that link as backup.
FRR
bgp large-community-list standard CUST-BACKUP seq 5 permit 64496:100:80
!
route-map FROM-CUSTOMER permit 10
match large-community CUST-BACKUP
set local-preference 80
route-map FROM-CUSTOMER permit 20
set local-preference 200
BIRD 2
filter from_customer {
if (64496, 100, 80) ~ bgp_large_community then bgp_local_pref = 80;
else bgp_local_pref = 200;
accept;
}
Use case 2: Selective prepending
Prepending makes the AS path longer on one link so remote networks prefer another. Doing it with a community means the upstream does it for you, and you do not change your own outbound path.
Cisco IOS-XE
ip prefix-list OUR-PREFIXES seq 5 permit 192.0.2.0/24
!
route-map TO-UPSTREAM-A permit 10
match ip address prefix-list OUR-PREFIXES
set community 64500:1001 additive
!
router bgp 64496
neighbor 192.0.2.1 remote-as 64500
neighbor 192.0.2.1 send-community both
neighbor 192.0.2.1 route-map TO-UPSTREAM-A out
send-community is required on IOS. Without it, the tag is silently stripped.
Juniper Junos
policy-options {
prefix-list OUR-PREFIXES {
192.0.2.0/24;
}
community UP-A-PREPEND1 members 64500:1001;
policy-statement TO-UPSTREAM-A {
term ours {
from {
prefix-list OUR-PREFIXES;
}
then {
community add UP-A-PREPEND1;
accept;
}
}
term rest {
then reject;
}
}
}
protocols {
bgp {
group UPSTREAM-A {
export TO-UPSTREAM-A;
}
}
}
Junos sends communities by default. Large communities use the large: prefix, for example members large:64496:100:80;.
Use case 3: NO_EXPORT and regional announcements
NO_EXPORT is useful when you announce a more-specific prefix to one upstream for traffic engineering but do not want it to propagate into the global table. A caveat: it only stops the neighbor AS from re-advertising it to external peers. Your upstream's own transit relationships are the thing you want to control, and for that you need their action communities.
For regional announcements, use the upstream's geographic tags. Typical goals are limiting a prefix to a region (for example, a local service) or keeping a backup path from attracting traffic from a continent where you have no capacity.
FRR example with several tags
route-map TO-UPSTREAM-A permit 10
match ip address prefix-list OUR-PREFIXES
set community 64500:2001 no-export additive
!
router bgp 64496
address-family ipv4 unicast
neighbor 192.0.2.1 route-map TO-UPSTREAM-A out
exit-address-family
BIRD 2 example
filter to_upstream_a {
if net ~ [192.0.2.0/24] then {
bgp_community.add((64500, 2001));
bgp_community.add((65535, 65281)); # NO_EXPORT
accept;
}
reject;
}
Designing your own community scheme
If you have customers who multihome or peer with you, publish your own table. Keep it small:
- Use large communities with a consistent layout, such as
64496:function:parameter. - Group functions by hundreds: 100 = local-pref, 200 = prepend, 300 = selective announce, 666 = blackhole.
- Tag routes on ingress to record origin (customer, peer, transit, IX) with an informational function, such as
64496:1:1for customer routes. - Document it in your
aut-numremarks and PeeringDB entry.
Security: scrub what you do not own
Communities are not authenticated. If you accept a customer's route with 64496:100:80 and also honor 64500:666 forwarded to the upstream, that customer can influence your routing or blackhole prefixes. Follow these rules (see also RFC 7454):
- Accept action communities from customers only for prefixes they own, verified by prefix filters built from their AS-SET.
- Strip communities that match your own action namespace from peers and transit routes on ingress.
- Remove internal tags on egress unless the neighbor documents them.
- Do not forward blackhole communities unless you mean to.
How communities relate to RTBH and DDoS mitigation
RTBH is just a route with a community. When an attack targets 192.0.2.10, you announce 192.0.2.10/32 with the BLACKHOLE community (65535:666) and, where documented, the provider-specific community. The upstream sets the next hop to a discard route, and the attack traffic is dropped before your links.
Practical points:
- Prefix length. Normal filters reject IPv4 prefixes longer than /24. Blackhole routes need an explicit exception for /32 (and /128 for IPv6) tied to the blackhole community.
- Scope. Add NO_EXPORT to the blackhole route so it does not leak. Also confirm the upstream limits propagation.
- Ownership check. Only accept blackhole requests for prefixes the sender owns.
- Cost of RTBH. The victim IP goes offline completely. That is why many operators prefer finer-grained responses first.
FlowSpec is the finer-grained option. Its actions travel as extended communities, for instance a traffic-rate of zero to drop, or a redirect to a VRF. It requires support on both sides of the session, and rules should be tested carefully before use.
Another approach is to move the whole prefix through scrubbing. With NixGuard Edge, networks with their own ASN and at least one /24 have their prefixes announced from the scrubbing edge, and clean traffic returns over a GRE tunnel with a BGP session inside. It can run always-on or on-demand.
NixMon detects attacks from NetFlow v5/v9, IPFIX or sFlow using per-IP and per-prefix bps/pps thresholds, then triggers BGP blackhole or FlowSpec announcements. The communities you define for each upstream are what make those announcements correct, so it pays to test them in advance. You can try it with the 15-day free trial, no credit card required.
Common mistakes
- Missing
send-communityon Cisco, so tags never leave the router. - Using the wrong format. Sending a large community to an upstream that only reads standard ones.
- Replacing instead of adding. On Cisco,
set communitywithoutadditiveremoves existing tags. - No prefix-length exception for blackholes, so RTBH announcements are filtered by your own export policy.
- Trusting customer-supplied communities without checking prefix ownership.
- Never testing. Verify with a looking glass or
show route advertising-protocol bgp/show ip bgp neighbors X advertised-routesthat the tag is attached and that the upstream's effect is visible. - Leaking blackhole routes because NO_EXPORT or a propagation limit is missing.
Quick verification commands
# Cisco
show ip bgp 192.0.2.0/24
show ip bgp neighbors 192.0.2.1 advertised-routes
# Juniper
show route advertising-protocol bgp 192.0.2.1 192.0.2.0/24 detail
# FRR
show bgp ipv4 unicast 192.0.2.0/24
If you need a second opinion on a community scheme or multihoming design, our network consulting page describes what we can help with.
Frequently asked questions
What is the difference between standard and large BGP communities?
Standard communities (RFC 1997) are 32 bits in an ASN:value format with 16 bits each, so they cannot carry a 4-byte ASN. Large communities (RFC 8092) are 96 bits, with three 32-bit fields: global administrator, local data 1 and local data 2.
Do BGP communities work across all networks?
No. Communities are optional and transitive only if the neighbor passes them on. Action communities are only honored by the network that defines them, so you must follow each upstream's documentation.
What is the standard BGP blackhole community?
RFC 7999 defines BLACKHOLE as 65535:666. Many providers also publish their own provider-specific blackhole community, so check the documentation of each upstream.
Does a community set on my router change how the upstream routes traffic to me?
Only if the upstream defines an action for it. Local-pref set on your own router affects your outbound traffic. To influence inbound traffic, you send the upstream's documented action communities on your announcements.