06-04-2018 10:11 AM - edited 03-05-2019 10:32 AM
Hey Guys,
Not sure what I am missing here as I cannot test it from another platform other than the one I have right now but can someone help check why AS-Path filtering under route-map isn't working?
I am trying to filter out in this lab a network routes with AS-Path 2 4 3. Here's my route-map and AS-Path filter.
R1#sh ip as-path-access-list
AS path access list 10
permit _3_3$
AS path access list 11
deny 2 4 3$
AS path access list 12
permit 2 4 3$
AS path access list 13
deny 2 4 3$
permit .*
I am trying different combinations here that's why there are multiple AS-Path ACL
Here's the route-map. (just putting some space so it will be easier to read)
route-map BGP4R2 permit 10 - Allow the prefix if prefix-list R2IN and AS-Path. Setting local preference to identify if the route is a match
match ip address prefix-list R2IN
match as-path 10
set local-preference 10
route-map BGP4R2 permit 15 - This one I am concerned about. I am trying to block AS_Path 2 4 3 using APACL 11 but appears not to be working. I just attached a local preference to see if this sequence is somewhat permitting the route for some reason
match as-path 11
set local-preference 15
route-map BGP4R2 permit 1000 - Just a catch all and set local preference to 1000
set local-preference 1000
Here's the BGP table after applying the route-map as inbound.
R1#show ip bgp | b Network
Network Next Hop Metric LocPrf Weight Path
*> 2.2.2.2/32 10.0.12.2 0 1000 0 2 i
*> 22.22.22.22/32 10.0.12.2 0 1000 0 2 4 3 i
R1#
I can still see 22.22.22.22/32 being received with a local-pref of 1000 with AS-Path 2 4 3. That means it didn't satisfy sequence 15 and moved to sequence 1000 where it was permitted.
I tried to reverse the logic by adding another route-map sequence.
route-map BGP4R2, deny, sequence 25
Match clauses:
as-path (as-path filter): 12
Set clauses:
Policy routing matches: 0 packets, 0 bytes
The above route-map worked.
I also tried to remove the inbound route-map under BGP and replaced it with filter-list in using APACL 13 just to see if there's anything wrong with the APACL and it successfully filtered out 22.22.22.22/32.
Any idea why sequence 15 is not working? Or it's just a limitation of BGP filters under route-map?
Thanks!
JL
Solved! Go to Solution.
06-04-2018 12:50 PM
06-04-2018 11:07 AM
Hello,
here is the regular expression with a filter list:
neighbor 192.168.12.2 filter-list 11 in
!
ip as-path access-list 11 deny ^2_3_4$
ip as-path access-list 11 permit .*
06-04-2018 11:36 AM
06-04-2018 11:15 AM
I believe you need to use access-list 12 with the permit, the 11 has a deny instance for as-path 2 4 3$, which means it won't apply.
Hope this helps
06-04-2018 11:38 AM
06-04-2018 12:08 PM - edited 06-04-2018 12:11 PM
I can’t test but I think when you have a permit route map statement and a deny in your acl it just moves it on to the next route map statement.
Try using a deny route map statement and a permit in your acl.
Jon
06-04-2018 12:12 PM
I will test it using a simple prefix-list and see the effect.
I have already tried your suggestion with that AS-Path 12 and it worked just fine.
I was just wondering what was the logic behind the route-map permit and matching with a deny statement combo.
06-04-2018 12:16 PM
The deny simply means to exclude the item from that instance. So it you wish to deny something using a route map, you permit it in the ACL, but then deny it in the instance in the route map.
Hope that makes sense.
06-04-2018 12:22 PM
06-04-2018 12:50 PM
Here's the answer to my question.
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