BGP Communities Explained

Hello Pradyumna

The path shown in the output of the show ip bgp command shows AS1 five times, and this is correct. If no prepending was to take place, then the output would show AS 1 only once. So with the set as prepend 1 1 1 1 we are adding AS1 four times to the already existing path list of one. Therefore there should be the original AS1, plus an additional four, resulting in five ones.

I hope this has been helpful!

Laz

I have 2 routers
Router 1 advertising subnet : 192.168.100.0/24 with community 65490:500 when SLA is OK and advertising the same subnet with community 65490:400 when SLA is not OK.

When router 2 receives the community from Router 1 depending on the community …can router 2 make decision based on the recieved communities and send a community back to router 1. if router 2 receives a community of 65490:500 , then it should be able to send the community of 65490:501 back to router 1 and if it recieves the community of 65490:400 , then it should be able to send a community of 65490:401 to router 1 ?

Is this possible?

Hello Pankaj

It depends on what you mean when you say “can router 2 send a community back to router 1”. Using route maps, it is possible to set a community based on the community that has been received. Route maps can match BGP community lists directly using the match community command under the route map configuration. You can then set a community based on that match statement.

If you take a look at this lesson, you will see an example of how to use route maps to set communities. You can modify this configuration to achieve what you described in your post.

I hope this has been helpful!

Laz

Hi Laz,

Do we have to learn these community value like 64984:0 for AS path prepending and remaining mentioned by you from Layer 3 ISP, if not then how could we choose value?

I am unable to understand the given policy b/c there is no prefix/network in that case how could I read it, please elaborate the command one by one?

ISP1(config)#ip community-list 1 permit 64984:0
ISP1(config)#route-map PREPEND_EU permit 10
ISP1(config-route-map)#match community 1
ISP1(config-route-map)#set as prepend 1 1 1 1
ISP1(config-route-map)#exit
ISP1(config)#route-map PREPEND_EU permit 20

Hi Rene,

On ISP1 I tried to set to routemap on the incomming interface from customer one instead of outgoing to IPS2, because I thought it would give a similar result, but with the 10.10.10.10 prefix already having AS 1 prepended 4 times BEFORE sending it to ISP2.
While it does not show AS 1 added 4 times when I view it with show ip bgp like I would have expected, it not even the case on ISP2. So nothing happens basically.

How does this not work?

(So to be clear I did neighbor 192.168.10.10 route-map PREPEND_EU in instead of neighbor 192.168.12.2 route-map PREPEND_EU out on ISP1)

Hello Pradyumna

As stated in the lesson:

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.

You do not need to memorize any of these numbers.

The policy used in the lesson does not need to mention a prefix/network, since the only matching criteria is the community list. So this route map matches ALL prefixes that contain the specific community parameter.

I hope this has been helpful!

Laz

Hello Mathias

I tried to replicate your results, but I was unable to. What I did was I removed the following command from the BGP configuration of ISP1:

neighbor 192.168.12.2 route-map PREPEND_EU out

…and I replaced it with the following command:

neighbor 192.168.10.10 route-map PREPEND_EU in

The result was that the prepending of the AS’es takes place as the BGP update comes into ISP1, so I see the prepended AS’es within the BGP table of both ISP1 as well as ISP2 as expected. Actually, it took a little bit of time (about 30 seconds) before the BGP table of ISP1 was updated.

You may want to check your configuration again? Let us know how your troubleshooting goes.

I hope this has been helpful!

Laz

1 Like

Thank you for the feedback. I probably misconfigured something then. Glad to know it should work like I expected it would.

1 Like

Hi @lagapidis Aren’t the BGP communities and extended communities optional transitive? Why have you mentioned BGP communities as “well known” ? Please correct me if I am wrong.

Thanks,
Nihar

Hello Nihar

When we talk about “well known” communities, we are simply saying that there are four predefined communities in BGP. These are known as:

  • Internet
  • No-Advertise
  • No-Export
  • Local-AS

These are further described in the lesson. They are well-known in the sense that they have built-in commands that you can use to activate them simply because they are used quite often. For example, the No Advertise community can be

Furthermore, RFC1997 describes these well-known communities as those that “have global significance and their operations shall be implemented in any community-attribute-aware BGP speaker.”

BGP communities and extended communities are indeed transitive, however, they are not optional. Even if you configure no community in your implementation, by default, you are using the “Internet” well-known community, which simply advertises the prefix to all BGP neighbors.

For more information on community types and community propagation, take a look at this NetworkLessons Note on BGP community types.

I hope this has been helpful!

Laz

Hi Team,

In my lab a single router is acting as ASBR with OSPF on one leg and BGP into other. I am trying to match the Router ID of the router that send OSPF routes and set the community string over BGP, is this technically possible ?
Regards,
Dhruv

Hello Dhruv

It is possible to create a route map that will set the community string for particular prefixes it sends to its BGP neighbors. This can be done by using the match ip route-source route-map command where the OSPF router ID is the route source.

You can then set the community of those prefixes that are sent from the desired route source (OSPF router ID) to whatever you like.

For more info on setting BGP communities using a route map take a look at this lesson:

For more info on route maps in general, take a look at this lesson:

For more info on the match ip route-source command, take a look at the NetworkLessons note on matching OSPF router IDs using route maps.

I hope this has been helpful!

Laz

Hi Laz,

Thank you for your response, but for some reasons after configuring my OSPF connections are not distributed now.

#########################################

!
access-list 10 permit host 16.16.16.16 
!
route-map N7K-NDC-OSPF permit 20
match ip route-source 10
set community 64700:2
!
router bgp 64700
 bgp log-neighbor-changes
 network 11.0.0.0
 redistribute ospf 1 route-map N7K-NDC-OSPF
 neighbor 11.11.11.12 remote-as 65440
!
ip bgp-community new-format
!

###############################

N7K-SiteA#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
16.16.16.16       1   FULL/DR         00:00:35    15.15.15.16     GigabitEthernet3
1.1.1.1           1   FULL/BDR        00:00:39    10.10.10.10     GigabitEthernet2

Regards,
Dhruv

Hello Dhruv

The route map you have configured matches all prefixes that come from your neighboring OSPF router with ID 16.16.16.16, and assigns the appropriate community to that prefix. However, by applying that route map to the redistribution into BGP, this route map also filters all other OSPF prefixes from being redistributed. Remember that a route map always has an implicit deny-all at the end. You must add a second command entry to the route map to allow everything else to go through, without changing the community. This command would resolve your issue:

N7K-SiteA(config)#route-map N7K-NDC-OSPF permit 30
N7K-SiteA(config-route-map)#exit

This essentially counteracts the implicit deny statement at the end, allowing all other prefixes to be redistributed.

I hope this has been helpful!

Laz

Hello,

Can you add section on large BGP communities? These communities are with 12 byte values that appear to be new RFC

Hello Shaunak

Large BGP communities are not part of the lesson content, however, I have created a NetworkLessons Note on large BGP communities that you may find useful.

I hope this has been helpful!

Laz

@ReneMolenaar @lagapidis @lagaused
which type this one? what we name it?

Hello Ali

I don’t understand your question. Can you clarify? Thanks!

Laz

Is the explained community is standard type?
I am asking about the type
As we know there is 4 types in well-know and 2 types in private community .
Which type this one?

Hello Ali

The lesson speaks about BGP communities in general, and it points out that there are four well-known BGP communities. When you say standard type, do you mean well-known?

These are the well known 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).

In the lesson, all four are mentioned. When you say “which type is this one?” which “one” are you talking about?

I hope this has been helpful!

Laz