BGP Essentials: BGP Communities

BGP communities are extra attributes you can attach to an IP route carried by BGP. You can use communities to indicate which routes should be propagated or filtered (for example, the well-known NO_EXPORT community signifies that the route it’s attached to shall not be sent outside of the local AS), to influence route selection on remote routers or to trigger other BGP-dependent IOS features (for example, quality-of-service marking based on BGP).

Each BGP community is a 32-bit value. The best practice dictates that the top 16 bits should be the AS number of the network defining the community meaning and the bottom 16 bits are defined by the network administrator.

For example, if you use BGP communities to control QoS marking within your network, the top 16 bits should be your AS number. If you’re using a BGP community to mark backup BGP routes before they are sent to your ISP, you should use the BGP community defined by your ISP (and thus the top 16 bits are the ISP’s AS number).

The only mechanism to set BGP community in Cisco IOS is the set community command in a route-map.

Important: The set community command erases existing communities attached to a route and replaces them with the new set of communities unless you specify the additive option.

You can set BGP communities in any point where you can use a route-map within BGP:

  • on routes you’re receiving from a neighbor with the neighbor route-map in router configuration command;
  • on routes you’re sending to a neighbor with the neighbor route-map out router configuration command;
  • on routes originated into BGP with the network route-map router configuration command;
  • on routes redistributed into BGP with the redistribute route-map router configuration command.

The BGP communities are transitive BGP attribute, meaning that they should be propagated to all BGP neighbors.

Cisco IOS does not propagate BGP communities unless you manually configure community propagation for each neighbor with the neighbor send-community configuration command. BGP peer groups or peer templates are an excellent way to configure BGP community propagation for a large number of peers.


  1. Nice one...helped a lot
  2. Hi Ivan, the 3rd bullet point should be "network route-map in" instead of simply "network route-map". Thanks. 8-)
  3. Nope, it's correct syntax. It's a route map applied to a network statement, not to a neighbor.
  4. Thanks for this post ; I was wondering if there was some restriction for the "set community" with the route-maps (ie, in input or output), this make things very clear :)
  5. Hi Ivan,

    I appreciate if you can write a short form of a post about the usage of "network route-map" command, as it's unclear to many people. In addition, there are very few and rare documents which explain the usage of route-map with the network command.

    Thanks Ivan :)
  6. "network route-map" allows you to set attributes of the BGP network you're originating. In most cases you'd use it to set BGP community or MED.
  7. ip bgp new-format can be done to show the community format in the 65001:17 format instead of the long format.

    You can also create a community list which permits only a specified community... sorta like an as-path access-list.

    Ex. #ip community-list 1 permit 65001:17

    Then you wan to match on that community-list.

    #route-map CLIST_IN permit 10
    #match community 1 (leave off the -list)
  8. need more details..
  9. need more detail on match list
  10. My query is basically in the context of vrf. Suppose a CE comprises multiple VRF to connect to different customers and eBGP is used as an PE-CE routing protocol.

    Consider an eBGP route update (without a RT value) is received by a BGP peer in a VRF and successfully installed in the VRF routing table.
    Also consider that the same VRF is configured with a export map which has a match criteria for this received prefix and set action to attach an RT vlaue (65500:5).

    If there is no requirement exist in this VRF to advertise this received prefix to any other BGP peer, will the configured export map come in action to set the RT vlaue (6500:5) with the received and already existing prefix entry in the BGP table?
  11. Thanks for confirming the "set community" overwrites any existing Community values; been Cisco'd with that kind of "obvious" behaviour before...
  12. Hi,

    Can i use this additive keyword to update the community value with existing community value list at the time of network add ?

Add comment