When people learn BGP, they usually focus on prefixes, AS_PATH, Local Preference, MED, route-maps, and filtering. These are all important topics, but there is one BGP feature that often looks simple at first and later turns out to be one of the most powerful tools in real-world networks.
That feature is BGP Communities.
BGP Communities are used heavily in Service Provider networks, Internet exchanges, large enterprise WANs, Data Center fabrics, MPLS VPN environments, and DDoS mitigation systems. They allow network engineers to attach additional information to BGP routes and then use that information to make routing decisions.
In simple words: a BGP Community is a tag attached to a route. But in production networks, that small tag can control traffic engineering, route propagation, blackholing, customer policies, and inter-domain routing behavior.
What Is a BGP Community?
A BGP Community is an optional transitive BGP attribute. It allows a router to mark a route with one or more values. Other routers can then match those values and apply routing policy.
The classic format looks like this:
ASN:VALUE
For example:
64500:100
64500:200
64500:300
64500:666
The first part usually represents the Autonomous System Number, and the second part represents a specific policy defined by that network.
For example, a Service Provider could define the following policy:
64500:100 - advertise to all upstreams
64500:200 - advertise only to customers
64500:300 - prepend AS_PATH three times
64500:666 - blackhole this prefix
The important thing to understand is that most communities do not have a universal meaning. Their meaning depends on the network that defines and processes them.
Why Are BGP Communities Useful?
In a small lab, it may be easy to configure routing policy manually on every router. In a real Service Provider network, that approach does not scale.
Imagine a provider with hundreds of routers, multiple upstream providers, Internet Exchange connections, enterprise customers, MPLS VPN customers, DDoS protection services, and different routing policies per region.
Without communities, every routing change would require manual changes in many places. With communities, the workflow becomes much cleaner:
- A route is received from a customer or another router.
- The route carries a specific community.
- The provider edge router matches that community.
- A route policy automatically performs the correct action.
This allows the network to become more programmable and policy-driven.
Example: BGP Blackholing for DDoS Mitigation
One of the most common real-world uses of BGP Communities is Remote Triggered Black Hole, often called RTBH.
Let’s say a customer is under a DDoS attack targeting a single IP address. Instead of allowing the attack traffic to saturate the customer’s link, the customer can announce a more specific route, usually a /32 for IPv4, with a special blackhole community.
Prefix: 203.0.113.55/32
Community: 64500:666
The Service Provider has a routing policy that says:
If a route has community 64500:666,
set next-hop to discard/null,
and propagate it to edge routers.
The result is that traffic to the attacked IP address is dropped inside the provider network, closer to the edge, before it reaches the customer circuit.
This is not a perfect solution because the attacked IP becomes unreachable, but it can protect the rest of the customer’s network and services. In many DDoS situations, sacrificing one IP address is better than losing the entire connection.
Well-Known BGP Communities
Some BGP Communities have standard meanings. These are called well-known communities.
The most common ones are:
no-export
A route with this community should not be advertised outside the local AS or confederation.
no-advertise
A route with this community should not be advertised to any BGP neighbor.
local-AS
A route with this community should not be advertised outside the local AS in confederation scenarios.
Standard Communities vs Extended Communities vs Large Communities
Standard Communities
Standard communities use a 32-bit value and are commonly written as:
ASN:VALUE
They are simple and widely supported, but they have limitations, especially when working with 32-bit ASNs.
Extended Communities
Extended Communities provide more space and structure. They are heavily used in MPLS VPNs and EVPN.
Common use cases include Route Targets, Route Origin, MPLS Layer 3 VPN import/export policy, EVPN tenant separation, and VPN route control.
route-target:64500:100
In MPLS L3VPN and EVPN networks, Route Targets are used to decide which VRFs should import specific routes.
Large Communities
Large Communities were introduced to solve limitations of standard communities, especially for networks using 32-bit ASNs.
GLOBAL_ADMIN:LOCAL_DATA_1:LOCAL_DATA_2
Example:
64500:10:200
Large Communities are easier to document and scale in modern networks.
Example Service Provider Policy
Let’s imagine a Service Provider with AS64500. The provider wants to let customers influence how their prefixes are advertised.
64500:100 - advertise to all upstreams and peers
64500:110 - do not advertise to upstream A
64500:120 - do not advertise to upstream B
64500:200 - advertise only to local peers
64500:300 - prepend three times to upstream A
64500:666 - blackhole
Now the customer can control routing behavior by attaching the correct community.
Prefix: 198.51.100.0/24
Community: 64500:300
When the provider advertises this route to upstream A, it applies AS_PATH prepending:
AS_PATH: 64500 64500 64500
This makes the route less preferred through that upstream. The customer does not need to open a ticket or ask the provider to manually change routing policy. The policy is already automated.
Cisco IOS-Like Configuration Example
ip community-list standard BLACKHOLE permit 64500:666
route-map CUSTOMER-IN permit 10
match community BLACKHOLE
set ip next-hop 192.0.2.1
set community no-export additive
route-map CUSTOMER-IN permit 20
set local-preference 100
Then the route-map is applied to a BGP neighbor:
router bgp 64500
neighbor 198.51.100.2 remote-as 64510
neighbor 198.51.100.2 route-map CUSTOMER-IN in
neighbor 198.51.100.2 send-community
The line below is extremely important:
send-community
Without it, the router may not send community attributes to the BGP neighbor. This is one of the most common troubleshooting mistakes with BGP Communities.
Common Troubleshooting Issues
1. Missing send-community
A router sets a community locally, but the neighbor never receives it because send-community is missing. Always verify received routes on the neighbor.
2. Replacing Communities Instead of Adding Them
Some platforms replace existing communities unless you explicitly tell them to add a new one.
set community 64500:100 additive
Without additive, you may accidentally remove communities that were already attached to the route.
3. No Community Documentation
A community without documentation is just a magic number. Good providers usually maintain a public or internal table explaining every community value.
4. Vendor Syntax Differences
The concept of BGP Communities is standard, but the configuration syntax differs between vendors. Cisco, Juniper, Arista, Nokia, Huawei, and FRRouting all support communities, but the route policy syntax can look very different.
Why BGP Communities Matter in Data Center Networks
BGP Communities are not only useful in Service Provider networks. They are also important in modern Data Center designs.
Many Data Centers use BGP as the main control-plane protocol, especially in leaf-spine architectures and EVPN VXLAN fabrics.
In Data Centers, communities can help with tenant separation, VRF import/export policy, route leaking, firewall service insertion, EVPN route control, traffic engineering, automation, and operational visibility.
Extended Communities are especially important in EVPN because Route Targets define which VRFs import specific EVPN routes.
Best Practices
- Document every community. If nobody knows what a community means, it becomes technical debt.
- Use a consistent numbering scheme. For example: 100–199 for export control, 200–299 for local preference, 300–399 for AS_PATH prepending, and 666 for blackholing.
- Always check send-community. If communities are not propagated, your policy will not work.
- Use additive when needed. Avoid accidentally overwriting existing communities.
- Test policies in a lab. Tools like FRRouting, containerlab, EVE-NG, or Cisco CML are great for learning.
- Keep customer-facing community guides simple. If customers are expected to use communities, the documentation must be clear.
Lab Idea
You can build a simple BGP lab with three routers:
R1 - Customer
R2 - Service Provider
R3 - Upstream
Goal:
- R1 advertises a prefix to R2.
- R1 attaches community
64500:300. - R2 matches the community.
- R2 prepends AS_PATH when advertising the route to R3.
- R3 receives the route with a longer AS_PATH.
Then extend the lab: add blackhole community 64500:666, verify communities with show bgp, remove send-community and observe what breaks, and test standard vs large communities.
Summary
BGP Communities are simple in concept but extremely powerful in practice.
They allow network engineers to tag routes and build flexible routing policies. In Service Provider networks, they are used for traffic engineering, blackholing, route filtering, customer policy control, and upstream selection. In Data Center networks, they are important for EVPN, VRFs, tenant separation, and route control.
If you work with BGP, you should understand communities well.
A small tag attached to a route can completely change how traffic flows across a network.
Post a Comment