A Border Gateway Protocol (BGP) community is a group of prefixes with a BGP community attribute that is transitive and optional, which is then recognized and passed to other BGP peers that traverse from AS to AS. BGP community can be seen as a tag attached to the BGP routes exchanged between a couple of BGP peers. BGP community values can be displayed as a 32-bit number (0 – 4,294,967,295) or two 16-bit numbers (0 – 65535):(0 – 65535), known as the new format.
Private BGP communities follow a certain format, with the first 16-bits representing the AS of the source community and the second 16-bits representing a pattern described by the originating BGP community.
BGP communities give more capability for tagging routes and modifying BGP routing policy both on the upstream and downstream routers. BGP communities can be altered selectively on each attribute as they traverse from one route to another.
Well-Known BGP Communities
Well-known BGP communities are defined by RFC 1997 that uses the range 4,294,901,760 (0xFFFF0000) to 4,294,967,295 (0xFFFFFFFF). Every router that can send and receiver BGP communities must implement well-known communities. Below are the most common well-known communities:
- Internet – standardized community used to identify routes that should be advertised over the Internet. When talking about more extensive networks that use BGP into their core, routes advertised to the Internet must have this community set to allow the edge BGP routers to only let the advertisement of BGP routes with the Internet community on the Internet.
- Local AS – the prefix is not advertised outside of the sub-AS.
- No_Advertise – routes with this community must not be advertised to any BGP peer, either iBGP or eBGP.
- No_Export – if a route with this community is received, it can only be advertised to iBGP peers.
BGP Community Configuration
The following are the ways to set community attribute values:
- Network command – to set the community of the advertised prefix, the optional route-map found at the end of the network command can be utilized.
- Aggregate address – attribute-map can be used to set the aggregate route’s attribute, which includes the community value.
- Neighbor command – certain communities that receive or send to their neighbors use route-map to set their community.
- Redistribution – community attributes of redistributed prefixes can be set using the route-map option of the redistribute command.
Below is an example of a simple configuration wherein two directly connected routers with IBGP session manipulates BGP attributes.
R1(config)#ip bgp-community new-format R1(config)#route-map SETCOM R1(config-route-map)#set community 1:20 R1(config)#router bgp 25 R1(config-router)#neighbor 192.168.12.2 remote-as 25 R1(config-router)#neighbor 192.168.12.2 send-community !-- The network 188.8.131.52 is advertised with community 1:20 R1(config-router)#network 184.108.40.206 mask 255.255.255.0 route-map SETCOM !-- R1's BGP table R1(config)#do sh ip bgp 220.127.116.11 BGP routing table entry for 18.104.22.168/24, version 2 Paths: (1 available, best #1, table Default-IP-Routing-Table) Not advertised to any peer Local 0.0.0.0 from 0.0.0.0 (192.168.127.1) Origin IGP, metric 0, localpref 100, weight 32769, valid, sourced, local, best Community: 1:20
R2(config)#router bgp 25 R2(config-router)#neighbor 192.168.15.1 remote 12 !-- Before applying any policies R2#sh ip bgp 22.214.171.124 BGP routing table entry for 126.96.36.199/24, version 2 Paths: (1 available, best #1, table Default-IP-Routing-Table) Flag: 0x820 Not advertised to any peer Local 192.168.15.1 from 192.168.15.1 (192.168.127.1) Origin IGP, metric 0, localpref 100, valid, internal, best Community: 1:20 !-- Match the community using a standard community-list R2(config)#ip community-list 1 permit 1:20 R2(config)#route-map COM R2(config-route-map)#match community 1 R2(config-route-map)#set metric 200 R2(config)#router bgp 25 R2(config-router)#nei 192.168.12.1 route-map COM in !-- After applying the policy the metric changed to 200 R2#sh ip bgp 188.8.131.52/24 BGP routing table entry for 184.108.40.206/24, version 3 Paths: (1 available, best #1, table Default-IP-Routing-Table) Flag: 0x800 Not advertised to any peer Local 192.168.15.1 from 192.168.15.1 (192.168.127.1) Origin IGP, metric 200, localpref 100, valid, internal, best Community: 1:20
Download our Free CCNA Study Guide PDF for complete notes on all the CCNA 200-301 exam topics in one book.
We recommend the Cisco CCNA Gold Bootcamp as your main CCNA training course. It’s the highest rated Cisco course online with an average rating of 4.8 from over 30,000 public reviews and is the gold standard in CCNA training: