Professional Documents
Culture Documents
Search …
Lesson Contents
1. Configuration
1.1. BGP Configuration
1.2. ISP1 AS Path Prepend Configuration
1.3. Customer BGP Community Configuration
2. Verification
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
Lessons
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):
https://networklessons.com/bgp/bgp-communities-explained 1/11
7/5/23, 3:31 PM BGP Communities Explained
--------------------------------------------------------
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
Lessons
communities:
--------------------------------------------------------
customer traffic engineering communities - LocalPref
--------------------------------------------------------
3356:70 - set local preference to 70
https://networklessons.com/bgp/bgp-communities-explained 2/11
7/5/23, 3:31 PM BGP Communities Explained
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.
1. Configuration
Lessons
https://networklessons.com/bgp/bgp-communities-explained 3/11
7/5/23, 3:31 PM BGP Communities Explained
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
Lessons
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.
https://networklessons.com/bgp/bgp-communities-explained 4/11
7/5/23, 3:31 PM BGP Communities Explained
Let’s see if ISP1 has learned any prefixes from the customer router:
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…
The community-list is similar to an access-list or prefix-list but only used for BGP communities. Our next
step is to create a route-map that will prepend the AS path whenever we see this value:
This route-map matches on community-list 1 and prepends the AS path four times. Let’s attach it
outbound to ISP2:
ISP1(config)#router bgp 1
ISP1(config-router)#neighbor 192.168.12.2 route-map PREPEND_EU out
This takes care of the configuration of ISP1. Let’s configure our customer router to send the BGP
community with its prefix advertisement now…
On our customer router we will use a prefix-list to match the network on the loopback interface:
https://networklessons.com/bgp/bgp-communities-explained 6/11
7/5/23, 3:31 PM BGP Communities Explained
Everything that matches the prefix-list will have a community value of 64984:0. Now we have to activate
this route-map:
Customer(config)#router bgp 10
Customer(config-router)#neighbor 192.168.10.1 route-map SET_COMMUNITY out
Customer(config-router)#neighbor 192.168.10.1 send-community
Take a close look at the second command, we have to use the neighbor send-community command
because the router doesn’t automatically send BGP communities to its neighbors. Everything is in place,
let’s verify our work…
2. Verification
Customer#clear ip bgp *
Community: 4258791424
This looks interesting, it did receive our community value but it’s showing it as a big 32-bit decimal
number. There’s a command on Cisco IOS that lets you choose between this output and the output with
two 16-bit values. Let’s change it:
https://networklessons.com/bgp/bgp-communities-explained 7/11
7/5/23, 3:31 PM BGP Communities Explained
Use the ip bgp community new-format command and it will now look like this:
ISP2#show ip bgp
BGP table version is 12, local router ID is 192.168.12.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
ISP3#show ip bgp
BGP table version is 12, local router ID is 192.168.13.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Great! Just like expected, the ISP1 router has prepended the AS path when it advertised the prefix to
ISP2. Next time our customer wants something prepended, they only have to set the correct community
value.
https://networklessons.com/bgp/bgp-communities-explained 8/11
7/5/23, 3:31 PM BGP Communities Explained
I hope this example has been useful to understand what BGP communities are about and how to
implement them. Of course we still have our well known communities:
Internet
No-Advertise
No-Export
Local-AS
Just click on the links above if you want to learn how these work. If you have any questions, feel free to
leave a comment!
« Previous Lesson
Accumulated IGP Metric
Attribute (AIGP)
Next Lesson
BGP Community No Advertise »
Tags: Communities
Forum Replies
hamoodrehman87
Rene,
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?
Please clarify.
Thanks
Hamood
Lessons
mauroaldair
Hello Hamood,
Usually Prepending AS is used to make the path less preferable over other. In the case of this example Rene was
just trying to show that using community is much easier to set attributes and refine the way you want the prefixes
to be advertised.
https://networklessons.com/bgp/bgp-communities-explained 9/11
7/5/23, 3:31 PM BGP Communities Explained
@Rene now i also have a question, i have notice that on customer you had use the SEND COMMUNITY command
but on the ISP1 to ISP2 u didn’t, is that a reason for that to not happen? Since you said that the router doesn’t send
the community automatically.
Mauro
ReneMolenaar
Hi Hamood,
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.
Rene
ReneMolenaar
Hi Mauro,
I used send community on the customer router so that ISP1 will see the community that was added to the prefix
and could act upon it.
In this scenario there’s no need for ISP2 or ISP3 to see the community value since only ISP1 is doing something
with it…if you want ISP2 or ISP3 to see the community value then yes we should add the send community
command on ISP1.
Rene
will1
Quick question. Can we apply multiple route maps, for different reasons, to the same neighbor? Say one for AS-
PATH prepend and one for community?
Lessons
80 more replies! Ask a question or join the discussion by visiting our Community Forum
https://networklessons.com/bgp/bgp-communities-explained 10/11
7/5/23, 3:31 PM BGP Communities Explained
Lessons
https://networklessons.com/bgp/bgp-communities-explained 11/11