A Guide to Using BGP Communities for Network Control and Documentation
G Gurpreet Singh•May 8, 2024•5 min read
📖 5 min read · 938 words
The Border Gateway Protocol (BGP) is the routing protocol that glues the internet together. BGP allows different autonomous systems (AS), such as Internet Service Providers, to exchange routing information with each other.
This allows each AS to build a consistent view of the global internet routing table and calculate the best paths to deliver traffic.
As such, BGP is crucially necessary for the smooth functioning and stability of internet connectivity.
BGP communities are an attribute that network operators can attach to groups of routes in BGP.
They are designed to provide more fine-grained control over traffic flows and routing policies. BGP communities are widely used by operators for purposes like traffic engineering, restricting route advertisement, monitoring, etc.
What are BGP Communities?
BGP communities are tags that essentially categorize or color routes with specific attributes. They are made up of 32-bit values and can be attached to routes by an operator within their AS.
The community values themselves don’t have any intrinsic meaning, but they allow operators to mark routes to indicate things like where they should be advertised or not, whether they should be preferred or not, what type of traffic they carry, etc.
Other BGP routers can then match these community values to decide how to treat the routes – whether to accept, prefer over other routes, or filter them out.
In this way, BGP communities allow operators a simple yet powerful tool to control the flow of routes in the network.
They are widely used because they enable network policies that are difficult or impossible to achieve in BGP without communities.
Types of BGP Communities
The main types of BGP communities are:
Standard communities
These are 32-bit values typically structured as two 16-bit numbers, like 1:60. They allow grouping and labeling of up to 65536 community values. Standard communities are very commonly used for basic traffic engineering and policy needs.
Extended communities
Also 32-bit values but extended to a structure of three parts – target, subfield, and local administrator field. This allows grouping routes into over 2 billion possible community values for very granular control. Extended communities enable policies difficult to implement with standard communities.
Large communities
These provide 96-bit community values, structured as 32-bit autonomous system numbers, 32-bit user-defined values, and 32-bit user-defined values. The vastly larger namespace allows extremely flexible community patterns for advanced policies.
How are BGP Communities Used?
There are several key use cases of BGP communities:
Traffic engineering: Communities can be used to set preferences for some routes over others, so traffic ratios can be tuned across different links. It allows load balancing or shifting traffic away from congested paths.
Policy enforcement: Community values can be matched to only announce certain routes to select BGP peers. This provides control over route propagation.
Route filtering: Routes can be blocked from being advertised to neighbors based on community tags, acting as an access control mechanism.
Network monitoring & analysis: Tracking the propagation of community-marked routes gives visibility into traffic flow shifts across the network.
Best Practices for Using BGP Communities
To effectively leverage BGP communities, network operators should:
Maintain detailed documentation on the meaning and usage of each community value in their network. This ensures intent remains clear over time.
Use clear and consistent naming conventions for community names/values across the network. This improves readability and limits conflicts.
Regularly review community policies and update them as needed. Requirements change so validation is key.
Take care to limit community values to prevent pollution. Too many communities make policies difficult to manage.
In summary, BGP communities are a beneficial mechanism for network operators to enact customized routing policies while maintaining core internet reliability and performance. Following best practices allows network operators to safely unlock the power of BGP communities.
Where this shows up in real life
A Guide to Using BGP Communities for Network Control and Documentation sounds abstract until you meet it in a normal setup. Take the sections above on What are BGP Communities? and Types of BGP Communities: every one of them maps to a device or a setting you can point at. Once you can point at it, the idea stops being theory.
The test is simple. Can you explain it to someone in two sentences, using your own network as the example? If yes, you understand it. If not, re-read the part where you got stuck, not the whole article.
The parts people mix up
Names that sound alike. Networking is full of terms that differ by one word and mean different things. When two ideas blur together, write both definitions side by side. The difference is usually one sentence.
What it does versus what it is called. Product names and protocol names get used loosely. Trust the function, not the label.
Old rules that no longer apply. Advice from ten years ago still circulates. Check whether it matches current hardware before you follow it.
When does this actually matter?
Not every day. A Guide to Using BGP Communities for Network Control and Documentation matters on three occasions: when something breaks, when you buy equipment, and when you plan a change. Knowing it before those moments is what turns a two-hour problem into a ten-minute fix.
What to learn next
Pick the topic that connects directly to this one, not a random next article. Knowledge in networking compounds: each idea makes the next one easier, but only if the two are actually connected. The related articles at the end of this page are the right place to look.
Can you explain this topic to someone else in 30 seconds? If not, re-read the key takeaways above.
What should you remember most?
The core concepts in the takeaways box above. Bookmark this page and come back when you need a refresher.
GU
Written by
Gurpreet Singh
Hey! I"m Gurpreet Singh and I Have 7+ Years of experience in the Network & Security Domain as well as the Cloud Infra Domain. I am Certified with Cisco ( CCNA ), CheckPoint ( CCSA ), 1xAWS, 3xAZURE, and 3xNSE. So I love to share my tech knowledge with you.