Community discussions

MikroTik App
 
faisali
Member Candidate
Member Candidate
Topic Author
Posts: 180
Joined: Fri Oct 08, 2010 5:11 am

help with IP Route Print command ?

Sat Jul 02, 2011 10:21 pm

hello

what would be the command line equivalent to showing routes that have BGP Communities 'contains' XXXX:XX ?

i.e. in /ip route print where bgp-communities 'contain' XXXX:XX

what is the symbol for 'contains' ?

Thanks.
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: help with IP Route Print command ?

Sun Jul 03, 2011 12:00 am

The ~ operator takes regular expressions.
Here a quick example from my home router - can't show communities here, so instead a filter to print all routes that have a gateway that starts with a capital A:
[felix@rb750g] > ip route print
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
 #      DST-ADDRESS        PREF-SRC        GATEWAY            DISTANCE
 0 ADo  0.0.0.0/0                          10.255.255.253     110
 1   S  0.0.0.0/0                          10.255.255.253     200
 2 ADC  10.255.255.232/30  10.255.255.233  AP-management      0
 3 ADC  10.255.255.236/30  10.255.255.237  management         0
 4 ADC  10.255.255.240/30  10.255.255.241  433                0
 5 ADC  10.255.255.244/30  10.255.255.245  AP-printer         0
 6 ADC  10.255.255.248/29  10.255.255.254  ASA                0
 7 ADo  172.16.0.0/24                      10.255.255.253     110
 8 ADC  172.17.0.0/24      172.17.0.1      AP-hotspot         0
 9 ADC  172.31.255.255/32  172.31.255.255  loopback0          0
10 ADC  192.168.1.0/24     192.168.1.1     LAN                0
[felix@rb750g] > ip route print where gateway~"^A"
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
 #      DST-ADDRESS        PREF-SRC        GATEWAY            DISTANCE
 2 ADC  10.255.255.232/30  10.255.255.233  AP-management      0
 5 ADC  10.255.255.244/30  10.255.255.245  AP-printer         0
 6 ADC  10.255.255.248/29  10.255.255.254  ASA                0
 8 ADC  172.17.0.0/24      172.17.0.1      AP-hotspot         0
 
faisali
Member Candidate
Member Candidate
Topic Author
Posts: 180
Joined: Fri Oct 08, 2010 5:11 am

Re: help with IP Route Print command ?

Sun Jul 03, 2011 7:50 am

The ~ operator takes regular expressions.
Here a quick example from my home router - can't show communities here, so instead a filter to print all routes that have a gateway that starts with a capital A:
[felix@rb750g] > ip route print
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
 #      DST-ADDRESS        PREF-SRC        GATEWAY            DISTANCE
 0 ADo  0.0.0.0/0                          10.255.255.253     110
 1   S  0.0.0.0/0                          10.255.255.253     200
 2 ADC  10.255.255.232/30  10.255.255.233  AP-management      0
 3 ADC  10.255.255.236/30  10.255.255.237  management         0
 4 ADC  10.255.255.240/30  10.255.255.241  433                0
 5 ADC  10.255.255.244/30  10.255.255.245  AP-printer         0
 6 ADC  10.255.255.248/29  10.255.255.254  ASA                0
 7 ADo  172.16.0.0/24                      10.255.255.253     110
 8 ADC  172.17.0.0/24      172.17.0.1      AP-hotspot         0
 9 ADC  172.31.255.255/32  172.31.255.255  loopback0          0
10 ADC  192.168.1.0/24     192.168.1.1     LAN                0
[felix@rb750g] > ip route print where gateway~"^A"
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
 #      DST-ADDRESS        PREF-SRC        GATEWAY            DISTANCE
 2 ADC  10.255.255.232/30  10.255.255.233  AP-management      0
 5 ADC  10.255.255.244/30  10.255.255.245  AP-printer         0
 6 ADC  10.255.255.248/29  10.255.255.254  ASA                0
 8 ADC  172.17.0.0/24      172.17.0.1      AP-hotspot         0

Thanks.. using this command is rather taxing on the system.. I see CPU utilization shoot up when searching for routes with communities..

Is there any other options ? less taxing on the CPU ? ( we have full routing tables from 4 peers.. approx 1.4 mill routes). On the other hand /ip route print count only does not tax the system..


Thanks.
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: help with IP Route Print command ?

Sun Jul 03, 2011 7:57 am

Not that I am aware of. A direct comparison (=) may be cheaper than a regular expression, but filtering through 1.4 mio routes on RouterOS is always going to tax the CPU. There's no separation of management plane, control plane, and forwarding plane.

Printing the total count is indeed a lot cheaper since it does not require evaluating each route.

Who is online

Users browsing this forum: No registered users and 26 guests