A community is a logical group of prefixes that share some common attribute. Community members can reside on different networks and in different autonomous systems. BGP enables you to define the community to which a prefix belongs. A prefix can belong to more than one community. The community attribute lists the communities to which a prefix belongs.
You can use communities to simplify routing policies by configuring the routing information that a BGP device can accept, prefer, or distribute to other neighbors according to community membership. When a route is learned, advertised, or redistributed, a BGP device can set, append, or modify the community of a route. When routes are aggregated, the resulting BGP update contains a community attribute that contains all communities from all of the aggregated routes (if the aggregate is an AS-set aggregate).
Several well-known communities are predefined. Table 5 describes how a BGP device handles a route based on the setting of its community attribute.
Table 5: Action Based on Well-Known Community Membership
In addition to the well-known communities, you can define local-use communities, also known as private communities or general communities. These communities serve as a convenient way to categorize groups of routes to facilitate the use of routing policies. The community attribute consists of four octets, but it is common practice to designate communities in the AA:NN format. The autonomous system number (AA) comprises the higher two octets, and the community number (NN) comprises the lower two octets. Both are expressed as decimal numbers. For example, if a prefix in AS 23 belongs to community 411, the attribute could be expressed as 23:411. Use the ip bgp-community new-format command to specify that the show commands display communities in this format. You can also use a regular expression to specify the community attribute.
Use the set community command in route maps to configure the community attributes. You can add one or more communities to the attribute, or you can use the list keyword to add a list of communities to the attribute. By default, the community attribute is not sent to BGP peers. To send the community attribute to a neighbor, use the neighbor send community command.
A community list is a sequential collection of permit and deny conditions. Each condition describes the community number to be matched. If you issued the ip bgp-community new-format command, the community number is in AA:NN format; otherwise, it is in decimal format (the hexadecimal octets converted to decimal).
The router tests the community attribute of a route against each condition in a community list. The first match determines whether the router accepts (the route is permitted) or rejects (the route is denied) a route that has the specified community. Because the router stops testing conditions after the first match, the order of the conditions is critical. If no conditions match, the router rejects the route.
Consider the network structure shown in Figure 5.
Figure 5: Community Lists

Suppose you want router Albany to set metrics for routes that it forwards to router Boston based on the communities to which the routes belong. You can create community lists and filter the routes with a route map that matches on the community list. The following example configures router Albany:
- host1(config)#router bgp 293
- host1(config-router)#neighbor 10.5.5.2 remote-as
32
- host1(config-router)#neighbor 10.2.2.1 remote-as
451
- host1(config-router)#neighbor 10.2.2.4 remote-as
17
- host1(config-router)#neighbor 10.2.2.4 route-map
commtrc out
- host1(config-router)#exit
- host1(config)#route-map commtrc permit 1
- host1(config-route-map)#match community 1
- host1(config-route-map)#set metric 20
- host1(config-route-map)#exit
- host1(config)#route-map commtrc permit 2
- host1(config-route-map)#match community 2
- host1(config-route-map)#set metric 75
- host1(config-route-map)#exit
- host1(config)#route-map commtrc permit 3
- host1(config-route-map)#match community 3
- host1(config-route-map)#set metric 85
- host1(config-route-map)#exit
- host1(config)#ip community-list 1 permit 25
- host1(config)#ip community-list 2 permit 62
- host1(config)#ip community-list 3 permit internet
Community list 1 comprises routes with a community of 25; their metric is set to 20. Community list 2 comprises routes with a community of 62; their metric is set to 75. Community 3 catches all remaining routes by matching the Internet community; their metric is set to 85.
ip bgp-community new-format
- host1(config)#ip bgp-community new-format
ip community-list
- host1(config)#ip community-list 1 permit 100:2
100:3 100:4
- host1(config)#route-map marengo permit 10
- host1(config-route-map)#match community 1
A route matches this community list only if it belongs to at least all three communities in community list 1: communities 100:2, 100:3, and 100:4.
neighbor send-community
- host1:vr1(config-router)#neighbor 192.3.4.5
send-community standard
set community
- host1(config)#route-map 1
- host1(config-route-map)#set community no-advertise