BGP Communities Explained

A BGP community is bit of “extra information” that you can add to one of more prefixes which is advertised to BGP neighbors. This extra information can be used for things like traffic engineering or dynamic routing policies. There are 4 well known BGP communities that you can use or you can pick a numeric value that you can use for your own policies.

Here are the 4 well known BGP communities:

  • Internet: advertise the prefix to all BGP neighbors.
  • No-Advertise: don’t advertise the prefix to any BGP neighbors.
  • No-Export: don’t advertise the prefix to any eBGP neighbors.
  • Local-AS: don’t advertise the prefix outside of the sub-AS (this one is used for BGP confederations).

Once you finish reading this lesson, click on one of the links above to learn more about these well known BGP communities. I explained each of them in a separate lesson.

Why do we call them communities? A community is a group of prefixes that should be treated the same way. For example maybe you have 100 prefixes that require the same local preference or weight. You could match all prefixes using an access-list or prefix-list but using BGP communities is more convenient.

Instead of manually selecting the prefixes, an ISP could instruct its customers to tag prefixes with a certain BGP community. When the customer does this, their prefixes get a certain treatment.

To give you an idea, here are some examples that I found from Level 3 (large ISP in the US):

--------------------------------------------------------
customer traffic engineering communities - Prepending
--------------------------------------------------------
65001:0   - prepend once  to all peers
65001:XXX - prepend once  at peerings to AS XXX
65002:0   - prepend twice to all peers
65002:XXX - prepend twice at peerings to AS XXX
65003:0   - prepend 3x to all peers
65003:XXX - prepend 3x    at peerings to AS XXX
65004:0   - prepend 4x to all peers
65004:XXX - prepend 4x    at peerings to AS XXX
--------------------------------------------------------
customer traffic engineering communities - Regional
--------------------------------------------------------
Will only work for regional peers
64980:0   - announce to customers but not to EU peers
64981:0   - prepend once  to all EU peers
64982:0   - prepend twice to all EU peers
64983:0   - prepend 3x    to all EU peers
64984:0   - prepend 4x    to all EU peers
--------------------------------------------------------
customer traffic engineering communities - LocalPref
--------------------------------------------------------
3356:70   - set local preference to 70
3356:80   - set local preference to 80
3356:90   - set local preference to 90

This list might not be up-to-date anymore but it gives you an impression of how BGP communities are used. If a customer of Level 3 tags their prefixes with 3356:90 then they will set the local preference to 90. If you tag them with 64983:0 then they will prepend the AS number three times to all their BGP neighbors in Europe.

These BGP communities are 32-bit values that are divided in two sections. For labs you can pick whatever values you like but normally the first 16 bits are used to indicate the AS number that originates the community, the next 16 bits are assigned by the AS. For example, Level 3 uses these communities:

--------------------------------------------------------
customer traffic engineering communities - LocalPref
--------------------------------------------------------
3356:70   - set local preference to 70
3356:80   - set local preference to 80
3356:90   - set local preference to 90

The first 16 bits is their AS number (3356) and the next 16 bits (70, 80 and 90) corresponds with the local preference value. On their routers they configured a policy that sets the local preference to these values if they receive prefixes with these BGP communities.

Nowadays we also use extended communities which are 8 octets. These are used often for MPLS VPN which we will discuss in another lesson. Let’s take a look at a configuration example so you can see how to implement BGP communities.

Configuration

For this example I will use the following topology:

BGP Communities AS Path Prepend Example

On the left side we have a customer router that is connected to ISP1. This ISP is connected to ISP2 and ISP3. Let’s imagine that ISP2 is somewhere in Europe and that ISP1 has a policy that they will prepend their AS number four times to BGP neighbors in Europe whenever a customer adds BGP community value 64984:0 to their prefixes.

Let’s see how we can configure this on the ISP1 and customer router.

BGP Configuration

Here is the BGP configuration, it’s straight-forward eBGP:

Customer#show running-config | section bgp
router bgp 10
 no synchronization
 bgp log-neighbor-changes
 network 10.10.10.10 mask 255.255.255.255
 neighbor 192.168.10.1 remote-as 1
 no auto-summary
ISP1#show running-config | section bgp
router bgp 1
 no synchronization
 bgp log-neighbor-changes
 neighbor 192.168.10.10 remote-as 10
 neighbor 192.168.12.2 remote-as 2
 neighbor 192.168.13.3 remote-as 3
 no auto-summary
ISP2#show running-config | section bgp
router bgp 2
 no synchronization
 bgp log-neighbor-changes
 neighbor 192.168.12.1 remote-as 1
 no auto-summary
ISP3#show running-config | section bgp
router bgp 3
 no synchronization
 bgp log-neighbor-changes
 neighbor 192.168.13.1 remote-as 1
 no auto-summary

Let’s see if ISP1 has learned any prefixes from the customer router:

ISP1#show ip bgp 10.10.10.10
BGP routing table entry for 10.10.10.10/32, version 2
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0x820
  Advertised to update-groups:
        1
  10
    192.168.10.10 from 192.168.10.10 (192.168.10.10)
      Origin IGP, metric 0, localpref 100, valid, external, best

ISP1 has learned the network on the loopback interface of the customer router. Right now we don’t have any BGP communities. Let’s start with the configuration of ISP1…

ISP1 AS Path Prepend Configuration

First we will create a community list that matches the community- value:

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now! Here is why:

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You've Ever Spent on Your Cisco Career!
  • Full Access to our 660 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

510 Sign Ups in the last 30 days

satisfaction-guaranteed
100% Satisfaction Guaranteed!
You may cancel your monthly membership at any time.
No Questions Asked!

Tags:


Forum Replies

  1. Let me give an example to avoid confusion. To keep it simple and fast, I’ll use EIGRP and a distribute-list. Here’s R1:

    R1#show run | begin router eigrp
    router eigrp 1
     network 0.0.0.0
    

    and R2:

    R2#show run | begin router eigrp
    router eigrp 1
     network 0.0.0.0
    

    R1 has two loopback interfaces that are advertised to R2:

    R2#show ip route eigrp 
    
          1.0.0.0/24 is subnetted, 1 subnets
    D        1.1.1.0 [90/130816] via 192.168.12.1, 00:02:32, GigabitEthernet0/1
          11.0.0.0/24 is subnetted, 1 subnets
    D        11.11.11.0 [90/130816] via 192.168.12.1, 00:02:32, Gigab
    ... Continue reading in our forum

  2. I think this should be the other way around:

    “As a result, R2 will not advertise it to R3 (iBGP) or R4 (eBGP).”

    Since R4 is in the same AS as R2, they would use iBGP and since R3 is in another AS it would use eBGP.

  3. Hello Elias

    Yes you are correct. It should read:

    “As a result, R2 will not advertise it to R3 (eBGP) or R4 (iBGP).”

    Thanks, I’ll let @ReneMolenaar know.

    Laz

  4. Hello Card

    The point of the No Advertise community is that you can advertise a prefix to you iBGP neighbor, but you can instruct that neighbor not to advertise it to any other neighbors downstream. The result is that R1’s neighbor (R2) learns of the prefix but R3 and R4 don’t.

    If the prefix was not advertised in the first place, R2 would not know the prefix either. This is a different result than when the No Advertis

    ... Continue reading in our forum

  5. Thanks

    This website is REALLY REALLY good to understand basic to advance level!

19 more replies! Ask a question or join the discussion by visiting our Community Forum