Community discussions

MikroTik App
 
tomascribb
just joined
Topic Author
Posts: 3
Joined: Wed Jul 14, 2010 4:58 pm

Regular expressions in BGP_AS_Path filter option

Fri Oct 18, 2013 3:17 am

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.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7053
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Regular expressions in BGP_AS_Path filter option

Fri Oct 18, 2013 11:24 am

yes regex is supported.
 
tomascribb
just joined
Topic Author
Posts: 3
Joined: Wed Jul 14, 2010 4:58 pm

Re: Regular expressions in BGP_AS_Path filter option

Fri Oct 18, 2013 7:05 pm

Is there any wiki with examples and syntax documentation? I used CISCO syntax but didn't work.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7053
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Regular expressions in BGP_AS_Path filter option

Mon Oct 21, 2013 10:53 am

POSIX regular expressions are supported, google for syntax and tutorials. You can start with wikipedia
http://en.wikipedia.org/wiki/Regular_ex ... d_extended
 
faisali
Member Candidate
Member Candidate
Posts: 180
Joined: Fri Oct 08, 2010 5:11 am

Re: Regular expressions in BGP_AS_Path filter option

Tue Oct 29, 2013 9:21 pm

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-regul ... -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.

Who is online

Users browsing this forum: No registered users and 11 guests