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.

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:

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.

Forum Replies

Great lesson however, I do have a question about prepending AS in ISP-1 because we don’t want other ISPs to learn about 10.10.10.10 is that correct?

64984:0 is a number we get from ISP? It varies from ISP to ISP?
If we need to add another loopback or network we can use the same community on the customer side which is 64984:0 or do we need something else?

Like Mauro explained below, AS path prepending is used to make the path less preferable. BGP uses AS path length in its selection for the best path.

The community values are defined by an ISP, there are no fixed values or anything. Basically it’s just a “tag”, if you tag your prefixes with a certain value then the ISP will do something with it…prepend it’s AS path, set the local preference, etc.

Now I have a problem that makes me want to pull my hairs out. We’re a global company that has 5 different branches in 3 different countries. The current situation is every branch has its own private AS# and we use eBGP to connect all the branches. We have all the devices run OSPF and IBGP inside of each branch. As I said before, we have 5 different branches in 3 different countries, which means actually 3 branches we’ll need to use the same ISP. In order to help with the understanding, please refer to the diagram attached. let’s see 65521 R3 is running

very nice introduction to BGP communities. However, I’ve a little improvement: A hint that communities were only forwarded from second router to a third one if send-community is activated on that neighborhood were be helpful.

New Lessons

Testimonials

Comprehensive Networking Foundation

One of my favorite features of the site in general is the context sensitive keyword search feature in the upper right hand corner. This is my first favorite resource when looking for information on a topic I am unclear of. The site provides comprehensive coverage of all the CCNA topics. I haven't received a zero search result yet for any keyword searchs I've done. The course material is clear and concise with Rene giving video white board explanations making abstract networking concepts appear tangible. If you are looking for an entry point into the world of Cisco routing and switching, Networklessons.com comprehensive content provides the foundation for CCNA and beyond.

Donald L. SimpsonIT ConsultingSeptember 13, 2015

Very Good to Get Pratical

NetworkLessons.com is a very good resource to get practical. They offer good information for the certifications and detailed lessons which are efficiently explained. I started to avoid extensiveness in studying for re-certification and prefer their much more compacter study materials. They offer very helpful information to make me accomplish not only professional networking tasks but also refresh my knowledge all the time and be up to date in my expertise.

Luis Felipe Vargas CarranzaNetwork & Firewall Engineer May 24, 2018

Easy to Understand

Networklessons has helped me immensely so far in understanding all difficult CCIE R&S topics. Some of the books / workbooks / videos out there make things unnecessary complex. The tutorials here are easy to understand and straight to the point!

William ZambranoSystems EngineerMay 6, 2015

Excellent Materials

NetworkLessons.com helped me land my current job right now. When I was affected by a layoff I had forgotten my networking skills. I needed to brush up my skills FAST. I used NetworkLessons.com extensively to relearn the materials within 1 month and as well as prepared for potential interview questions. Thank you for this wonderful site.

Duy NguyenNetwork EngineerJune 4, 2018

In a League of Its Own!

I will say to anyone, without reservation and regardless of his/her goal in their studies; look no more! You've found it! I've only lately been fortunate enough to have Networklessons.com as my guide. If Cisco had a rule which said I could use ONLY ONE resource for my studies, it would be Networklessons.com. Rene's unrelenting effort to "out-do himself", and his dedication to the individual career growth of each member is a testament to what it takes to be a true professional and an asset to this industry.

Bridget EdwardsNetwork EngineerDecember 15, 2015

Awesome!

Networklessons.com is great for anyone who wishes to learn networking in an easy to understand format. If you have a question, then post it at the bottom of the page and Rene quickly gets back to you with an easy to understand and detailed answer.

Mario CorderoNetwork EngineerFebruary 15, 2016

No Nonsense Networking

I have used Networklessons.com for preparation for the CCNP exam and it helped me to pass the 3 exams! The network topics are very well explained, and the videos are helpful too. Questions are answered quickly and to the point. Before I became a member, it took me 3 years to come to the understanding of how multicast sparse mode works; simply because I could not find anything that explained the whole process as simple and clear as Networklessons.com. I will continue to use Networklessons.com as a valuable reference site for my work!

Hans de RoodeCommunications / Network EngineerMarch 14, 2016

Great Source of Information

I had the classroom training for CCNP Routing & Switching and failed the test afterward. That was the reason why I searched for more and better information and found it here. NetworkLessons.com is great. Easy to follow explanations and videos. It covers all topics of the actual test. With the material from NetworkLessons.com, I passed ROUTE (with a 94% score!) and SWITCH (an 88%!) and have 1 more to go (TSHOOT). I am very confident to pass this as well. Thank you very much, Rene!

Christian RichterNetwork EngineerMay 8, 2017

Great Resource to Pass Cisco Certs

NetworkLessons.com proved to be a great resource in passing Cisco certifications. They explain their lessons and courses in understandable terms and which are very easy to digest. Thanks for the simplification of complex topics!

Vanessa SicilianoPremier SupportJanuary 14, 2019

Can’t Miss for a Day

NetworkLessons.com makes labs look easy and understandable. I seriously can't miss a single day without being a member of their website. NetworkLessons.com is a fantastic and very helpful e-learning site. They provide you the best and the most important knowledge that you need to get any networking job done. Thank you!

Jean CasimirSr Network EngineerAugust 14, 2017

Great Site!

Topics are separated into logical and easy to follow stages. The configs labs are a great addition as you can quickly ‘lab up’ the examples to help understand each topic. They have the right balance between not being too simplistic and not being over complex, to prevent an ‘information overload’. NetworkLessons.com recognizes that a lot of the readers -while needing to have a thorough understanding of the technology- may not have the time to ‘deep dive’ on every topic, particularly if one is following a Cisco Certification track that covers a broad range of topics.

Jeff HazelIT ContactorJune 14, 2018

Simple Explanation Even for Hard Topics

Well structured lessons and very simple explanation even for hard topics. Thanks Rene, for all the hard work you have done to create this excellent networking lessons website!