The BGP No Advertise community is one of the four well known communities. If you have no idea what BGP communities are about, I would suggest to check the introduction lesson first. That’s where you will learn about the basics of BGP communities.
When you add the no-advertise community to a prefix then the receiving BGP router will use and store the prefix in its BGP table but it won’t advertise the prefix to any other neighbors.
Let’s look at an example, this is the topology I will use:
Above you can see R1 with a loopback interface that has network 1.1.1.1 /32. We will advertise this network in BGP towards R2 with the no advertise community set. As a result, R2 will not advertise it to R3 (eBGP) or R4 (iBGP).
Configuration
Here’s the basic BGP configuration in case you want to try this example yourself.
Configurations
Want to take a look for yourself? Here you will find the startup configuration of each device.
R1
hostname R1
!
ip cef
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.12.1 255.255.255.0
!
router bgp 1
bgp log-neighbor-changes
network 1.1.1.1 mask 255.255.255.255
neighbor 192.168.12.2 remote-as 24
!
end
R2
hostname R2
!
ip cef
!
interface GigabitEthernet0/1
ip address 192.168.12.2 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.23.2 255.255.255.0
!
interface GigabitEthernet0/3
ip address 192.168.24.2 255.255.255.0
!
router bgp 24
bgp log-neighbor-changes
neighbor 192.168.12.1 remote-as 1
neighbor 192.168.23.3 remote-as 3
neighbor 192.168.24.4 remote-as 24
neighbor 192.168.24.4 next-hop-self
!
end
R3
hostname R3
!
ip cef
!
interface GigabitEthernet0/1
ip address 192.168.23.3 255.255.255.0
!
router bgp 3
bgp log-neighbor-changes
neighbor 192.168.23.2 remote-as 24
!
end
R4
hostname R4
!
ip cef
!
interface GigabitEthernet0/1
ip address 192.168.24.4 255.255.255.0
!
router bgp 24
bgp log-neighbor-changes
neighbor 192.168.24.2 remote-as 24
!
end
Let’s see if R2, R3 and R4 have learned our prefix:
R2#show ip bgp | include 1.1.1.1
*> 1.1.1.1/32 192.168.12.1 0 0 1 i
R3#show ip bgp | include 1.1.1.1
*> 1.1.1.1/32 192.168.23.2 0 24 1 i
R4#show ip bgp | include 1.1.1.1
* i1.1.1.1/32 192.168.24.2 0 100 0 1 i
It’s in the BGP table of these routers. Now let’s configure R1 to add the no advertise community:
R1(config)#router bgp 1
R1(config-router)#neighbor 192.168.12.2 send-community
First we have to tell R1 to send BGP communities, by default this is disabled. Now we can create a route-map that sets the community value:
R1(config)#route-map NO_ADVERTISE permit 10
R1(config-route-map)#set community no-advertise
This route-map doesn’t have any match statements so it will set the no advertise community to all prefixes. Let’s activate it:
Rene,
Great lesson to understand community. I have question if we have two loopbacks for instance 2.2.2.2/32 on R1 and I would like to advertize this and block 1.1.1.1/32. Do I need an ACL to match under route-map?
Please confirm
Hamood
Hi Hamood,
That’s right, in this example I used a really simple route-map but you could do something like this:
The first route-map statement will deny everything that matches access-list 1, the second route-map statement is required to permit everything else.
Rene
Thank you Rene.
Hamood
great topic Rene. thanks
that’s great explanation. thanks Rene