BGP Communities
Attach a policy label to a route, then let another router act on that label.
What the tag means
A standard community is a 32-bit route attribute. The common notation 65001:100 splits it into two 16-bit numbers. A route can carry several communities. The tag does not select a better path by itself: a receiving policy must give an ordinary numeric tag its meaning.
In this lab, provider AS 65001 defines 65001:100 to mean “prepend four extra copies of our AS toward ISP2.” This is a lab agreement, not a universal provider code. Standard communities cannot encode a full four-byte ASN in the first 16-bit field; large communities address a different format.
| Tag | Meaning |
|---|---|
| 65001:100 | Operator-defined action, implemented by a route map. |
| no-advertise | The receiver does not advertise the route to another BGP peer. |
| no-export | Keep it within the AS or confederation boundary. |
| local-AS | Keep it within the confederation member AS. |
| internet | General distribution scope; normal export policy still applies. |
Customer and provider network
R1 is Customer (AS 65010), R2 is ISP1 (AS 65001), R3 is ISP2 (AS 65002), and R4 is ISP3 (AS 65003). R1 originates the test host route. ISP1 exports it through two different external sessions.
| Link | First endpoint | Second endpoint |
|---|---|---|
| R1–R2 | R1 GigabitEthernet1: 192.0.2.1/30 | R2 GigabitEthernet1: 192.0.2.2/30 |
| R2–R3 | R2 GigabitEthernet2: 192.0.2.5/30 | R3 GigabitEthernet1: 192.0.2.6/30 |
| R2–R4 | R2 GigabitEthernet3: 192.0.2.9/30 | R4 GigabitEthernet1: 192.0.2.10/30 |
Complete baseline configurations
R1
hostname R1
ip cef
interface Loopback0
ip address 10.255.0.1 255.255.255.255
exit
interface Loopback10
ip address 198.51.100.1 255.255.255.255
exit
interface GigabitEthernet1
ip address 192.0.2.1 255.255.255.252
no shutdown
exit
router bgp 65010
bgp router-id 10.255.0.1
no bgp default ipv4-unicast
neighbor 192.0.2.2 remote-as 65001
address-family ipv4 unicast
no auto-summary
neighbor 192.0.2.2 activate
network 198.51.100.1 mask 255.255.255.255
exit-address-family
endR2
hostname R2
ip cef
interface Loopback0
ip address 10.255.0.2 255.255.255.255
exit
interface GigabitEthernet1
ip address 192.0.2.2 255.255.255.252
no shutdown
exit
interface GigabitEthernet2
ip address 192.0.2.5 255.255.255.252
no shutdown
exit
interface GigabitEthernet3
ip address 192.0.2.9 255.255.255.252
no shutdown
exit
router bgp 65001
bgp router-id 10.255.0.2
no bgp default ipv4-unicast
neighbor 192.0.2.1 remote-as 65010
neighbor 192.0.2.6 remote-as 65002
neighbor 192.0.2.10 remote-as 65003
address-family ipv4 unicast
no auto-summary
neighbor 192.0.2.1 activate
neighbor 192.0.2.6 activate
neighbor 192.0.2.10 activate
exit-address-family
endR3
hostname R3
ip cef
interface Loopback0
ip address 10.255.0.3 255.255.255.255
exit
interface GigabitEthernet1
ip address 192.0.2.6 255.255.255.252
no shutdown
exit
router bgp 65002
bgp router-id 10.255.0.3
no bgp default ipv4-unicast
neighbor 192.0.2.5 remote-as 65001
address-family ipv4 unicast
no auto-summary
neighbor 192.0.2.5 activate
exit-address-family
endR4
hostname R4
ip cef
interface Loopback0
ip address 10.255.0.4 255.255.255.255
exit
interface GigabitEthernet1
ip address 192.0.2.10 255.255.255.252
no shutdown
exit
router bgp 65003
bgp router-id 10.255.0.4
no bgp default ipv4-unicast
neighbor 192.0.2.9 remote-as 65001
address-family ipv4 unicast
no auto-summary
neighbor 192.0.2.9 activate
exit-address-family
endR3# show ip bgp 198.51.100.1/32
Network Next Hop Metric LocPrf Weight Path
*> 198.51.100.1/32 192.0.2.5 0 65001 65010 iR4# show ip bgp 198.51.100.1/32
Network Next Hop Metric LocPrf Weight Path
*> 198.51.100.1/32 192.0.2.9 0 65001 65010 iBefore tagging, both downstream routers see one copy of ISP1’s AS in the path.
Prepare the provider policy
On ISP1 (R2), match the agreed community and prepend only on the session toward ISP2 (R3). The final permit clause passes routes that do not match. No special policy is applied toward ISP3.
ip bgp-community new-format
ip community-list standard PREPEND-ISP2 permit 65001:100
route-map TO-ISP2 permit 10
match community PREPEND-ISP2
set as-path prepend 65001 65001 65001 65001
exit
route-map TO-ISP2 permit 20
exit
router bgp 65001
address-family ipv4 unicast
neighbor 192.0.2.6 route-map TO-ISP2 out
exit-address-familyThe display command selects colon notation; it does not enable community transmission.
Tag the customer route
On R1, mark only the test prefix and explicitly send standard communities to ISP1. Additive retains any existing standard tags.
R1
ip prefix-list TARGET seq 5 permit 198.51.100.1/32
route-map TAG-TARGET permit 10
match ip address prefix-list TARGET
set community 65001:100 additive
exit
route-map TAG-TARGET permit 20
exitrouter bgp 65010
address-family ipv4 unicast
neighbor 192.0.2.2 route-map TAG-TARGET out
neighbor 192.0.2.2 send-community
exit-address-familyR1# clear ip bgp 192.0.2.2 soft outOutbound soft refresh regenerates the advertisement with the tag. The sender’s locally originated table entry need not display a tag added only by an outbound route map.
Verify both exits
R2# show ip bgp 198.51.100.1/32
BGP routing table entry for 198.51.100.1/32
Paths: (1 available, best #1, table default)
65010
192.0.2.1 from 192.0.2.1
Origin IGP, metric 0, localpref 100, valid, external, best
Community: 65001:100R3# show ip bgp 198.51.100.1/32
Network Next Hop Metric LocPrf Weight Path
*> 198.51.100.1/32 192.0.2.5 0 65001 65001 65001 65001 65001 65010 iR4# show ip bgp 198.51.100.1/32
Network Next Hop Metric LocPrf Weight Path
*> 198.51.100.1/32 192.0.2.9 0 65001 65010 iR3 sees five copies of 65001: four configured copies plus the normal eBGP prepend. R4 sees only the normal copy. R2 consumes the tag locally; these baseline downstream sessions do not need to carry it because their neighbors are not acting on it. Add send-community on each further hop when downstream policy needs the tag.
A longer AS path can influence another network’s decision, but does not guarantee its choice: higher-priority policy can still win.
Restore the baseline
router bgp 65010
address-family ipv4 unicast
no neighbor 192.0.2.2 route-map TAG-TARGET out
exit-address-familyR1# clear ip bgp 192.0.2.2 soft outrouter bgp 65001
address-family ipv4 unicast
no neighbor 192.0.2.6 route-map TO-ISP2 out
exit-address-familyR2# clear ip bgp 192.0.2.6 soft outR3# show ip bgp 198.51.100.1/32
Network Next Hop Metric LocPrf Weight Path
*> 198.51.100.1/32 192.0.2.5 0 65001 65010 iThe tag and extra prepend are removed from regenerated advertisements.
Key Takeaways
- Standard communities are 32-bit route labels, commonly written as two 16-bit values.
- An operator-defined community needs an agreed policy to produce an action.
- Set the tag, transmit it, match it, and verify the resulting advertisement.
- Additive preserves existing standard communities; display formatting does not enable transmission.
- Four extra prepends plus normal eBGP export produce five copies of the provider AS.
Protocol and command references
Standard communities · Confederation behavior · Community lists and transmission · Router-symbol attribution.