cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5700
Views
10
Helpful
3
Replies

how to strip a specific community-list

gbcbooksmj
Level 1
Level 1

example, 

route BGR prefix has community-list 65400:100 65500:65500 65535:65535 local-as

how can we strip one or more of them to make it become like 

65500:65500 65535:65535 local-as

or

65400:100 65500:65500 65535:65535 

3 Replies 3

gbcbooksmj
Level 1
Level 1

any one know about this ? 

From the book "Effective BGP Policy Control":

Community values for a prefix can be set or reset in two ways:

•Use a set clause within a route map to set a community value, to add a community value (additive), or to remove all community values:

set community {community-value [additive]} | none

•Use a set clause within a route map to selectively remove some community values:

set comm-list community-list-number delete

This route map set command removes communities from the community attribute of an inbound or outbound update. Each community that matches the given community list is removed from the community attribute. When used with this command, each entry of a standard community list should list only one community.


NOTE

When both the set community and set comm-list delete commands are configured in the same instance of a route map, the delete operation is performed before the set operation.

Out of curiosity, I hav labbed Colin's suggestion, and it works perfectly:

 

R1

interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.1.1 255.255.255.252
speed auto
duplex auto
!
router bgp 1
bgp log-neighbor-changes
network 1.1.1.1 mask 255.255.255.255
network 192.168.1.0 mask 255.255.255.252
neighbor 192.168.1.2 remote-as 2
neighbor 192.168.1.2 send-community
neighbor 192.168.1.2 route-map SET_COMMUNITY out
!
ip bgp-community new-format
!
ip prefix-list 1 seq 5 permit 1.1.1.1/32
!
route-map SET_COMMUNITY permit 10
match ip address prefix-list 1
set community 65400:100 65500:65500 local-AS 65535:65535

 

R2

 

interface FastEthernet0/0
ip address 192.168.1.2 255.255.255.252
speed auto
duplex auto
!
router bgp 2
bgp log-neighbor-changes
network 192.168.1.0 mask 255.255.255.252
neighbor 192.168.1.1 remote-as 1
neighbor 192.168.1.1 route-map MODIFY_COMMUNITY in
!
ip bgp-community new-format
!
ip community-list expanded REMOVE_COMMUNITY permit 65400:100
!
ip prefix-list 1 seq 5 permit 1.1.1.1/32
!
route-map MODIFY_COMMUNITY permit 10
match ip address prefix-list 1
set comm-list REMOVE_COMMUNITY delete

 

R2#sh ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.1/32, version 2
Paths: (1 available, best #1, table default, not advertised outside local AS)
Not advertised to any peer
Refresh Epoch 1
1
192.168.1.1 from 192.168.1.1 (1.1.1.1)
Origin IGP, metric 0, localpref 100, valid, external, best
Community: 65500:65500 local-AS 65535:65535
rx pathid: 0, tx pathid: 0x0

 

When the community list matches 'local-AS', that attribute is removed:

 

ip community-list expanded REMOVE_COMMUNITY permit local-AS

 

R2#sh ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.1/32, version 2
Paths: (1 available, best #1, table default)
Not advertised to any peer
Refresh Epoch 1
1
192.168.1.1 from 192.168.1.1 (1.1.1.1)
Origin IGP, metric 0, localpref 100, valid, external, best
Community: 65400:100 65500:65500 65535:65535
rx pathid: 0, tx pathid: 0x0

Review Cisco Networking for a $25 gift card