Hi, I have been trying to use regular expressions in BGP_AS_Path filter option to filter inbound routes, but the results were very strangers and without any apparent logic. The question is, do Mikrotik support regex to filter routes in BGP?
Thank you.
yes regex is supported.
Is there any wiki with examples and syntax documentation? I used CISCO syntax but didn’t work.
POSIX regular expressions are supported, google for syntax and tutorials. You can start with wikipedia
http://en.wikipedia.org/wiki/Regular_expression#POSIX_basic_and_extended
I also had some initial struggles with them…but, here are a few more tips.
Take a look at this site… some more specific info
http://networklessons.com/bgp/bgp-regular-expressions-examples/
for example using bgp-as-path= ^10784_174_[0-9]*$
should match all routes having AS10784_AS174_* in the path. (i.e. one level deep on Cogent network…AS174)
Similarly bgp-as-path= ^10784_174_[0-9]_[0-9]$
should match all routes having AS10784,AS174,AS*,AS* in the path (i.e. two level deep on Cogent network…)
Hope this helps you out.
I use these to set a higher bgp local pref, in the inbound bgp filters.
You have to pay attention to the sequence of the command in the filter.