PacketLab
BGP · Communities

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.

TagMeaning
65001:100Operator-defined action, implemented by a route map.
no-advertiseThe receiver does not advertise the route to another BGP peer.
no-exportKeep it within the AS or confederation boundary.
local-ASKeep it within the confederation member AS.
internetGeneral 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.

Lab topologyIllustrative network
.1 / .2 · eBGP.5 / .6 · eBGP.9 / .10 · eBGPR1AS 65010R2AS 65001R3AS 65002R4AS 65003
Solid lines: physical links. Link labels use the last octet of 192.0.2.x; every link is a separate /30. AS labels identify the protocol relationship. Loopback0 is 10.255.0.N/32 for router RN. Exact interfaces and subnets are listed below.
LinkFirst endpointSecond endpoint
R1–R2R1 GigabitEthernet1: 192.0.2.1/30R2 GigabitEthernet1: 192.0.2.2/30
R2–R3R2 GigabitEthernet2: 192.0.2.5/30R3 GigabitEthernet1: 192.0.2.6/30
R2–R4R2 GigabitEthernet3: 192.0.2.9/30R4 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
end

R2

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
end

R3

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
end

R4

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
end
Outputs are illustrative, not recorded router results. Each lesson is a separate lab. Allow updates to converge after changes; the selected baseline path is an example when all earlier criteria tie.
R3# 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 i
R4# 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 i

Before 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-family

The 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
exit
router 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-family
R1# clear ip bgp 192.0.2.2 soft out

Outbound 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:100
R3# 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 i
R4# 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 i

R3 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-family
R1# clear ip bgp 192.0.2.2 soft out
router bgp 65001
 address-family ipv4 unicast
  no neighbor 192.0.2.6 route-map TO-ISP2 out
 exit-address-family
R2# clear ip bgp 192.0.2.6 soft out
R3# 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 i

The 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.

Communities Quiz

Six questions · four options each · select one answer per question. Submit all answers to see your score and explanations.

1. What does 65001:100 do without a matching policy?
2. How large is one standard community?
3. Which command enables transmission to a neighbor in these examples?
4. Why use additive with set community?
5. Four configured copies of ISP1’s AS are prepended on eBGP export. How many copies does ISP2 see?
6. Does a longer AS path guarantee the remote network chooses another exit?
Protocol and command references

Standard communities · Confederation behavior · Community lists and transmission · Router-symbol attribution.