Understanding BGP Communities
Introduction to BGP Communities
BGP Communities, introduced in RFC1997, are a powerful attribute used to tag BGP routes with information that can be leveraged to influence routing decisions. These communities, like labels, help control how routes are treated within a BGP network.
Identifying Communities
Communities can be identified in three ways:
-
Decimal Values (0-4,294,967,295): These numeric representations allow flexibility in assigning community tags. However, ranges 0-65535 and 4,294,967,041-4,294,967,295 are reserved.
-
Hexadecimal Format (0x00000000-0xFFFFFFFF): Hexadecimal notation can be used to represent community values. For example, "0x12345678."
-
Names (Well-Known Values): Some communities are well-known, often represented by names such as "INTERNET," "NO_EXPORT," "NO_ADVERTISE," and "LOCAL_AS."
Two Types of Communities
BGP Communities come in two flavors: Standard and Extended.
-
Standard Communities (32-bit):
- INTERNET (0x0/0)
- NO_EXPORT (0xFFFFF01/4294967041)
- NO_ADVERTISE (0xFFFFFF02/4294967042)
- LOCAL_AS (0xFFFFFF03/4294967043)
-
Extended Communities (64-bit):
- Often used for features like Route Target within MPLS VPN networks.
Configuring Communities
By default, BGP communities are not automatically sent to peers, and they are stripped from BGP UPDATE messages. You can enable sending communities using the following command:
neighbor x.x.x.x send-community [standard|extended|both]
To change the default community decimal display to, for example, hexadecimal format, you can use the command:
ip bgp-community new-format
in global config
Using Communities
Additive Option
The "additive" option allows you to append a community to an existing set of communities, preserving any existing tags.
Example:
set community 500:500 additive
ip community-list
You can filter routes based on their community tags using the ip community-list
command. It functions similarly to prefix-lists or ACLs.
Command Format:
ip community-list [1-99|100-500|standard|expanded] [permit|deny] [community]
match community in Route Maps
In Route Maps, you can use the match community
command to match specific communities as defined in an ip community-list
. This helps control the routing of BGP routes based on community tags.
Command Format in the Route Map:
match community [community #] [exact]
Practical Use Case
Imagine you are customer B in AS 5.6, multi-homed to ISP Z in AS 8.5. ISP Z provides you with specific communities and values to influence the flow of traffic into your network:
- 85:35000
- 85:45000
- 85:55000
These communities enable you to signal ISP Z to set the "weight" for the routes and control how traffic is directed into your network.