ccie blog

BGP No-Advertise Community

The BGP no-advertise community can be used to ensure a prefix does not get advertised to any other peer (internal, or external). ┬áIn the lab below I’m going to use the feature on R2 so that the 100.100.100.0/24 network learned from R1 does not get advertised to R3 or R4.

BGP No-Advertise1

First things first, let’s check R3 & R4 are receiving the prefix from R2.

R3#sh ip bgp | b Network

   Network          Next Hop            Metric LocPrf Weight Path
*>i12.12.12.0/30    23.23.23.1               0    100      0 i
r>i23.23.23.0/30    23.23.23.1               0    100      0 i
*>i24.24.24.0/30    23.23.23.1               0    100      0 i
*>i100.100.100.0/24 23.23.23.1               0    100      0 10 i
*>i200.200.200.0    23.23.23.1               0    100      0 10 i
R4#sh ip bgp  | b Network

   Network          Next Hop            Metric LocPrf Weight Path
*> 12.12.12.0/30    24.24.24.1               0             0 20 i
*> 23.23.23.0/30    24.24.24.1               0             0 20 i
r> 24.24.24.0/30    24.24.24.1               0             0 20 i
*> 100.100.100.0/24 24.24.24.1                             0 20 10 i
*> 200.200.200.0    24.24.24.1                             0 20 10 i

Ok, if I now create a route-map on R2 to catch this prefix as we learn it from R1, then apply the no-advertise community, it will stop this prefix being advertised to R3 and R4.

R2(config)#ip prefix-list 100_network seq 5 permit 100.100.100.0/24
R2(config)#route-map 100_network_no_advertise
R2(config-route-map)#match ip address prefix-list 100_network
R2(config-route-map)#set community no-advertise
R2(config-route-map)#route-map 100_network_no_advertise permit 20
R2(config-route-map)#
R2(config-route-map)#router bgp 20
R2(config-router)#neighbor 12.12.12.1 route-map 100_network_no_advertise in
R2(config-router)#end
R2#clear ip bgp * in
R2#clear ip bgp * out

Cool, so if i check the BGP table for this network on R2, we should see that it has been set with a community of no-advertise.

R2#sh ip bgp 100.100.100.0
BGP routing table entry for 100.100.100.0/24, version 2
Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised to any peer)
  Not advertised to any peer
  10
    12.12.12.1 from 12.12.12.1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, external, best
      Community: no-advertise

And to verify, let’s check R2 and R3’s BGP table to make sure they no longer receive this prefix

R3#sh ip bgp | b Network
   Network          Next Hop            Metric LocPrf Weight Path
*>i12.12.12.0/30    23.23.23.1               0    100      0 i
r>i23.23.23.0/30    23.23.23.1               0    100      0 i
*>i24.24.24.0/30    23.23.23.1               0    100      0 i
*>i200.200.200.0    23.23.23.1               0    100      0 10 i
R4#sh ip bgp  | b Network
   Network          Next Hop            Metric LocPrf Weight Path
*> 12.12.12.0/30    24.24.24.1               0             0 20 i
*> 23.23.23.0/30    24.24.24.1               0             0 20 i
r> 24.24.24.0/30    24.24.24.1               0             0 20 i
*> 200.200.200.0    24.24.24.1                             0 20 10 i

There we go, the 100.100.100.0/24 prefix has now gone.

1 Comment

JamesNovember 21st, 2016 at 3:23 am

Excellent article

Leave a comment

Your comment