BGP communities are passed between bgp peers when the 'send community' attribute is set with the neighbor. However what if there is a requirement to delete one of the communities from a list associated with a route!?
Consider the topology below. The route 18.104.22.168/24 is advertised by R1 to R2 and the route has community attributes 'no-advertise' and 'internet'. R2 has an iBGP peering with R3 and the send-community attribute is set. Initially by default R3 does not receive the route as a direct result of the no-advertise community. The requirement is for R3 to have the BGP route 22.214.171.124/24 with only the internet attribute.
The solution relies on the 'set comm-list' command. This enables communities matched by the community-list to be removed. Below i attach the working config from R2.
ip community-list standard RIC permit no-advertise
route-map RIC permit 10
set comm-list RIC delete
router bgp 1
neighbor 192.168.12.1 remote-as 2
neighbor 192.168.12.1 route-map RIC in
Cisco or Linksys
7 hours ago