BGP Communities in Practice

BGP communities enable to label prefixes announced by BGP in order to apply specific policies. Two good examples of using BGP communities in real networks are provided for Sprint and RENATER.

Let us analyze the illustration below provided by RENATER to explain how to use communities on its network. A dual-connected client network identifies a primary link and a secondary or backup link toward RENATER. In the BGP prefix announcements, this network can use the community 2200:610 on the primary link, and the community 2200:590 on the backup link. RENATER applies specific policies in order to implement the primary/backup behavior. A simple way to do this is described in the following:

Figure 1. BGP community illustration
  1. The client announces the prefix 10.1.2.0/24 with eBGP on the primary link toward NR-1 with a community attribute 2200:610.
  2. The client announces 10.1.2.0/24 on the backup link toward NR-2 with a community attribute 2200:590.
  3. RENATER receives the same prefix (with eBGP) with two different communities and applies the following policy when announcing the prefix inside its network with iBGP :
    1. If the community attribute matches 2200:610, the local preference attribute in the iBGP announcement is fixed to p.
    2. If the community attribute matches 2200:590, the local preference attribute in the iBGP announcement is fixed to p'.
  4. Therefore, NR-1 announces 10.1.2.0/24 in iBGP with a local preference p whereas NR-2 announces the same prefix with a local preference p'.
  5. By choosing p' (we can assume that p = 610 and p' = 590), RENATER ensures that all its iBGP routers prefer the exit NR-1 to reach the client network and implement this information in their routing table.

With this configuration, all the traffic going to the client network is forwarded by RENATER on the primary link. Note that whenever this link goes down, the BGP selection process chooses the next best announcement (lower local preference) and forwards the traffic on the backup link.