# BGP Community No Advertise

**URL:** https://forum.networklessons.com/t/bgp-community-no-advertise/1240
**Category:** Lessons Discussion
**Created:** [December 29, 2016, 5:44pm UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240 "2016-12-29T17:44:11Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![ReneMolenaar](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/renemolenaar/32/488_2.png) [@ReneMolenaar](https://forum.networklessons.com/u/ReneMolenaar)
#### Post date: [December 29, 2016, 5:44pm UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240/1 "2016-12-29T17:44:11Z")

</div>

> **[BGP Community No Advertise](https://networklessons.com/bgp/bgp-community-no-advertise)**
>
> The BGP no advertise community tells your neighbor routers not to advertise a prefix to any iBGP or eBGP neighbors. This lesson shows how to configure this.

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…

---

<div class="post-metadata">

### Author: ![hamoodrehman87](https://cdn-forum.networklessons.com/letter_avatar_proxy/v4/letter/h/50afbb/32.png) [@hamoodrehman87](https://forum.networklessons.com/u/hamoodrehman87)
#### Post date: [July 1, 2015, 11:18pm UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240/2 "2015-07-01T23:18:13Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ReneMolenaar](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/renemolenaar/32/488_2.png) [@ReneMolenaar](https://forum.networklessons.com/u/ReneMolenaar)
#### Post date: [July 2, 2015, 8:08pm UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240/3 "2015-07-02T20:08:50Z")

</div>

Hi Hamood,

That’s right, in this example I used a really simple route-map but you could do something like this:

```
access-list 1 permit host 1.1.1.1

route-map NO_ADVERTISE deny 10
match ip address 1
set community no-advertise

route-map NO_ADVERTISE permit 20

```

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

---

<div class="post-metadata">

### Author: ![hamoodrehman87](https://cdn-forum.networklessons.com/letter_avatar_proxy/v4/letter/h/50afbb/32.png) [@hamoodrehman87](https://forum.networklessons.com/u/hamoodrehman87)
#### Post date: [July 2, 2015, 8:46pm UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240/4 "2015-07-02T20:46:14Z")

</div>

Thank you Rene.

Hamood

---

<div class="post-metadata">

### Author: ![ammaralmhdawi](https://cdn-forum.networklessons.com/letter_avatar_proxy/v4/letter/a/2bfe46/32.png) [@ammaralmhdawi](https://forum.networklessons.com/u/ammaralmhdawi)
#### Post date: [July 30, 2015, 3:06pm UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240/5 "2015-07-30T15:06:14Z")

</div>

great topic Rene. thanks

---

<div class="post-metadata">

### Author: ![ammar.eng100](https://cdn-forum.networklessons.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@ammar.eng100](https://forum.networklessons.com/u/ammar.eng100)
#### Post date: [November 5, 2015, 10:45pm UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240/6 "2015-11-05T22:45:54Z")

</div>

that’s great explanation. thanks Rene

---

<div class="post-metadata">

### Author: ![salvatore.cuzzilla](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/salvatore.cuzzilla/32/134_2.png) [@salvatore.cuzzilla](https://forum.networklessons.com/u/salvatore.cuzzilla)
#### Post date: [April 14, 2016, 9:48pm UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240/7 "2016-04-14T21:48:31Z")

</div>

Ciao Rene’,

testing with your topology: if I set no-advertise with a more specific route-map, like:

```auto
ip prefix-list LOOPBACK seq 5 permit 1.0.0.1/32
!
route-map SET_NOADVERTISE deny 10
 match ip address prefix-list LOOPBACK
 set community no-advertise
!
route-map SET_NOADVERTISE permit 20

```

then I get the following result on R2:

```auto
R2#show ip route 1.1.1.1/32
% Network not in table

```

do you have any idea on why is that?

Regards,  
Salvatore.

---

<div class="post-metadata">

### Author: ![ReneMolenaar](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/renemolenaar/32/488_2.png) [@ReneMolenaar](https://forum.networklessons.com/u/ReneMolenaar)
#### Post date: [April 17, 2016, 3:33pm UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240/8 "2016-04-17T15:33:12Z")

</div>

Hello Salvatore,

This should work…1.1.1.1/32 is not in your prefix-list so it should be permitted. I just checked it to be sure and it’s working for me.

Any chance you got the wrong route-map on R1? 🙂

```auto
R1#
ip prefix-list LOOPBACK permit 1.0.0.1/32
!
route-map SET_NOADVERTISE permit 10
 match ip address prefix-list LOOPBACK
 set community no-advertise
!
route-map SET_NOADVERTISE permit 20
!
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
 neighbor 192.168.12.2 send-community
 neighbor 192.168.12.2 route-map SET_NOADVERTISE out

```

```auto
R2#show ip bgp | include 1.1.1.1
 *&gt; 1.1.1.1/32 192.168.12.1 0 0 1 i

```

Rene

---

<div class="post-metadata">

### Author: ![dinhthaibrilliant90](https://cdn-forum.networklessons.com/letter_avatar_proxy/v4/letter/d/278dde/32.png) [@dinhthaibrilliant90](https://forum.networklessons.com/u/dinhthaibrilliant90)
#### Post date: [June 23, 2016, 4:16am UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240/9 "2016-06-23T04:16:45Z")

</div>

Hi Rene,

I am a big fan of you. Thanks for the lessons.  
Follow up the route-map on R1 allowing advertising loopback 2.2.2.2/32 but blocking loopback 1.1.1.1/32 to neigbor BGP router, I found the mistake.

```
ip prefix-list LOOPBACK permit 1.0.0.1/32
!
route-map SET_NOADVERTISE deny 10 -----------&gt; this should be route-map SET_NOADVERTISE PERMIT 10
 match ip address prefix-list LOOPBACK
 set community no-advertise
!
route-map SET_NOADVERTISE permit 20
!
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
 neighbor 192.168.12.2 send-community
 neighbor 192.168.12.2 route-map SET_NOADVERTISE out

```

Can you double-check again Rene?

Regards,  
Thai

---

<div class="post-metadata">

### Author: ![andrew](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/andrew/32/645_2.png) [@andrew](https://forum.networklessons.com/u/andrew)
#### Post date: [June 23, 2016, 6:15pm UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240/10 "2016-06-23T18:15:24Z")

</div>

Hi Thai,  
Good catch. I believe you are correct. I will ask Rene to review/correct this.

---

<div class="post-metadata">

### Author: ![ReneMolenaar](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/renemolenaar/32/488_2.png) [@ReneMolenaar](https://forum.networklessons.com/u/ReneMolenaar)
#### Post date: [June 26, 2016, 3:47pm UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240/11 "2016-06-26T15:47:27Z")

</div>

Hi Thai,

Thanks, you are right so I just fixed it. It has to be permitted otherwise the community is not set.

Rene

---

<div class="post-metadata">

### Author: ![elecommeng](https://cdn-forum.networklessons.com/letter_avatar_proxy/v4/letter/e/b2d939/32.png) [@elecommeng](https://forum.networklessons.com/u/elecommeng)
#### Post date: [September 16, 2016, 11:55pm UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240/12 "2016-09-16T23:55:46Z")

</div>

Hi Rene,  
Also in your first reply to Hamood, could you please check it?. i think there is some thing wrong.

---

<div class="post-metadata">

### Author: ![lagapidis](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/lagapidis/32/4949_2.png) [@lagapidis](https://forum.networklessons.com/u/lagapidis)
#### Post date: [October 4, 2016, 4:36pm UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240/13 "2016-10-04T16:36:20Z")

</div>

Hello Mahmoud.

I believe that Rene’s explanation is correct, however, I can see where the misunderstanding may be. Specifically, Rene gave the following commands as an example:

```auto
access-list 1 permit host 1.1.1.1

route-map NO_ADVERTISE deny 10
match ip address 1
set community no-advertise

route-map NO_ADVERTISE permit 20

```

and said that

> The first route-map statement will deny everything that matches access-list 1, the second route-map statement is required to permit everything else.

The access-list may say **permit** , however, the route map takes this access list and whatever it matches, that is, whatever corresponds to the permit statement, is **denied**. You can see this by the `route-map NO_ADVERTISE deny 10` statement.

A second line is then added to the route map, line 20 where everything else is permitted.

So even though the access list may say **perimt** , the actual action that is taken by the route-map is **deny**.

I hope this has been helpful!

Laz

---

<div class="post-metadata">

### Author: ![hussien.samer](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/hussien.samer/32/2096_2.png) [@hussien.samer](https://forum.networklessons.com/u/hussien.samer)
#### Post date: [November 12, 2016, 11:37am UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240/14 "2016-11-12T11:37:49Z")

</div>

Hello Laz,

I think Mahmoud H is right and I also check it from cisco doc :-

> **[Configure Route-Maps Applied with Redistribution Command](https://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/49111-route-map-bestp.html)**
>
> This document describes how to configure route-maps that are applied with the redistribute command of dynamic routing protocols.

as cisco say :-  
Do not configure a set command in a deny route-map clause because the deny clause prohibits route redistribution—there is no information to modify.

Best Regard

---

<div class="post-metadata">

### Author: ![ReneMolenaar](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/renemolenaar/32/488_2.png) [@ReneMolenaar](https://forum.networklessons.com/u/ReneMolenaar)
#### Post date: [November 22, 2016, 7:38pm UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240/15 "2016-11-22T19:38:45Z")

</div>

You guys mean this example?

```auto
access-list 1 permit host 1.1.1.1

route-map NO_ADVERTISE deny 10
match ip address 1
set community no-advertise

route-map NO_ADVERTISE permit 20

```

The _Do not configure a set command in a deny route-map clause because the deny clause prohibits route redistribution—there is no information to modify part_ refers to using a route-map with route redistribution, that’s not the case here 🙂

---

<div class="post-metadata">

### Author: ![hussien.samer](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/hussien.samer/32/2096_2.png) [@hussien.samer](https://forum.networklessons.com/u/hussien.samer)
#### Post date: [November 23, 2016, 5:00pm UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240/16 "2016-11-23T17:00:58Z")

</div>

I think the route map with deny statement will deny everything that permitted in access-list statement, so the outbound routes will be filtered if we use the route map with redistribution or with community or any other case, I also check it out with a lab and I see the route 1.1.1.1 in your case will not announce even to R2 !!! If I did not understand, is it possible to clarify this case more ???

---

<div class="post-metadata">

### Author: ![ReneMolenaar](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/renemolenaar/32/488_2.png) [@ReneMolenaar](https://forum.networklessons.com/u/ReneMolenaar)
#### Post date: [December 21, 2016, 12:36pm UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240/17 "2016-12-21T12:36:51Z")

</div>

Let me give an example to avoid confusion. To keep it simple and fast, I’ll use EIGRP and a distribute-list. Here’s R1:

```
R1#show run | begin router eigrp
router eigrp 1
 network 0.0.0.0

```

and R2:

```
R2#show run | begin router eigrp
router eigrp 1
 network 0.0.0.0

```

R1 has two loopback interfaces that are advertised to R2:

```
R2#show ip route eigrp 

      1.0.0.0/24 is subnetted, 1 subnets
D 1.1.1.0 [90/130816] via 192.168.12.1, 00:02:32, GigabitEthernet0/1
      11.0.0.0/24 is subnetted, 1 subnets
D 11.11.11.0 [90/130816] via 192.168.12.1, 00:02:32, GigabitEthernet0/1

```

It has learned 1.1.1.0/24 and 11.11.11.0/24. Let’s add a distribute-list:

```
R1(config)#router eigrp 1
R1(config-router)#distribute-list route-map NO_ADVERTISE out

```

Here’s a route-map:

```
R1(config)#access-list 1 permit 1.1.1.0 0.0.0.255

R1(config)#route-map NO_ADVERTISE deny 10
R1(config-route-map)#match ip address 1

```

Here’s what we have on R2:

`R2#show ip route eigrp`

It’s empty…why? the first route-map statement denies what we have in our access-list. The second (invisible) route-map statement is also a deny which prevents 11.11.11.0/24 from being advertised. If we want this, we have to add a permit:

`R1(config)#route-map NO_ADVERTISE permit 20`

This empty permit, permits everything since there is no match command. The result:

```
R2#show ip route eigrp 

D 11.11.11.0 [90/130816] via 192.168.12.1, 00:00:30, GigabitEthernet0/1

```

Rene

---

<div class="post-metadata">

### Author: ![EUNLITManagedService](https://cdn-forum.networklessons.com/letter_avatar_proxy/v4/letter/e/d26b3c/32.png) [@EUNLITManagedService](https://forum.networklessons.com/u/EUNLITManagedService)
#### Post date: [July 26, 2018, 12:47pm UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240/18 "2018-07-26T12:47:19Z")

</div>

I think this should be the other way around:

“As a result, R2 will not advertise it to R3 (iBGP) or R4 (eBGP).”

Since R4 is in the same AS as R2, they would use iBGP and since R3 is in another AS it would use eBGP.

---

<div class="post-metadata">

### Author: ![lagapidis](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/lagapidis/32/4949_2.png) [@lagapidis](https://forum.networklessons.com/u/lagapidis)
#### Post date: [July 27, 2018, 11:58am UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240/19 "2018-07-27T11:58:17Z")

</div>

Hello Elias

Yes you are correct. It should read:

“As a result, R2 will not advertise it to R3 (eBGP) or R4 (iBGP).”

Thanks, I’ll let @ReneMolenaar know.

Laz

---

<div class="post-metadata">

### Author: ![ReneMolenaar](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/renemolenaar/32/488_2.png) [@ReneMolenaar](https://forum.networklessons.com/u/ReneMolenaar)
#### Post date: [August 1, 2018, 2:56pm UTC](https://forum.networklessons.com/t/bgp-community-no-advertise/1240/20 "2018-08-01T14:56:20Z")

</div>

Thanks Elias, just fixed this typo.

[Next page](https://forum.networklessons.com/t/bgp-community-no-advertise/1240.md?page=2)
