cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1301
Views
5
Helpful
1
Replies

BGP Community - Ignore ASN in ASN:XXXX

Andrew WEISS
Level 1
Level 1

Hi All,

With BGP communities, how would I go about ignoring the ASN portion of a BGP community and accept a wildcard value?  For example, if any of my peers/transit providers that send me a route that is tagged with the community X:666 I'd like to reject.  The X = the ASN number that I don't necessarily know.  

Thanks in advance,

Andrew 

 

 

1 Reply 1

Peter Paluch
Cisco Employee
Cisco Employee

Hi Andrew,

The solution would be similar to this:

ip bgp new-format
!
ip community-list expanded NoComm666 deny _[0-9]+:666_
ip community-list expanded NoComm666 permit .*
!
route-map Filter permit 10
  match community NoComm666
!
router bgp ...
  neighbor X.X.X.X route-map Filter in

The first line in the comm-list NoComm666 defines a standalone community number whose part before the colon is an arbitrary group of digits, and the number after the colon is exactly 666, and such routes will be denied. All other routes will be accepted.

Be sure to use the ip bgp new-format command because that one is crucial for the whole exercise to work - the communities are fed to the community-list in the format defined by this command, and as the list is formatted for the XX:YY style, the actual communities must also be displayed in the same way.

Please be sure to try this in lab before testing this in a production network.

Best regards,
Peter

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Innovations in Cisco Full Stack Observability - A new webinar from Cisco