09-23-2020 10:11 AM
Does anyone know how to match on an empty standard BGP community list?
I'd like to filter out all routes that have at least one community configured and only advertise those without communities. I know how to do this with expanded communities, e.g. ip community-list expanded EMPTY permit ^$, but not sure how to achieve the same result with standard communities as standard community-lists do not support regular expressions.
Can anyone help?
Solved! Go to Solution.
09-23-2020 12:12 PM
This configuration works in my lab so only prefixes without a community tag are installed.
router bgp 10
bgp log-neighbor-changes
neighbor 192.168.0.20 remote-as 2
!
address-family ipv4
neighbor 192.168.0.20 activate
neighbor 192.168.0.20 route-map bgp in
exit-address-family
ip community-list standard EMPTY permit
route-map bgp permit 10
match community EMPTY exact-match
09-23-2020 11:05 AM - edited 09-23-2020 11:09 AM
Hello @Tymofii Dmytrenko ,
standard community lists look for an exact match, so I would say there is no way to match an empty or missing community attribute with standard community list.
you have found a way to match the routes using an expanded community-list if you can use it you are fine.
to be noted there is the set community none command in route-map but I don't think there is a match community none.
Hope to help
Giuseppe
09-23-2020 12:12 PM
This configuration works in my lab so only prefixes without a community tag are installed.
router bgp 10
bgp log-neighbor-changes
neighbor 192.168.0.20 remote-as 2
!
address-family ipv4
neighbor 192.168.0.20 activate
neighbor 192.168.0.20 route-map bgp in
exit-address-family
ip community-list standard EMPTY permit
route-map bgp permit 10
match community EMPTY exact-match
09-30-2020 03:02 AM - edited 09-30-2020 03:07 AM
That's perfect @Dan Frey
Thank you
To advertise directly attached subnets inc summaries I did this
ip community-list standard EMPTY permit route-map into-MPLS permit 10 description Local BGP Networks match community EMPTY exact-match match route-type local
As redistributed networks are ALL tagged with community in my case, this only advertises whatever I have injected with network statement or aggregate-address. Does what it says
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide