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.