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 188.8.131.52 /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 (iBGP) or R4 (eBGP).
Here’s the basic BGP configuration in case you want to try this example yourself:
R1#show running-config | section bgp router bgp 1 no synchronization bgp log-neighbor-changes network 184.108.40.206 mask 255.255.255.255 neighbor 192.168.12.2 remote-as 24 no auto-summary
R2#show running-config | section bgp router bgp 24 no synchronization 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 no auto-summary
R3#show running-config | section bgp router bgp 3 no synchronization bgp log-neighbor-changes neighbor 192.168.23.2 remote-as 24 no auto-summary
R4#show running-config | section bgp router bgp 24 no synchronization bgp log-neighbor-changes neighbor 192.168.24.2 remote-as 24 no auto-summary
Let’s see if R2, R3 and R4 have learned our prefix:
R2#show ip bgp | include 220.127.116.11 *> 18.104.22.168/32 192.168.12.1 0 0 1 i
R3#show ip bgp | include 22.214.171.124 *> 126.96.36.199/32 192.168.23.2 0 24 1 i
R4#show ip bgp | include 188.8.131.52 * i184.108.40.206/32 192.168.12.1 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: