Community discussions

MikroTik App
 
User avatar
irrwitzer
just joined
Topic Author
Posts: 23
Joined: Mon Apr 11, 2022 11:54 pm

show bgp routes matching community

Sat Jun 11, 2022 12:37 am

Hi all,

I'm new to the forum and rather new to routerOS. I'm used to Juniper and Cisco, and trying to learn Mikrotik by building my own (ipv6-only) network.

On my edge-Routers I'm tagging inbound and outbound BGP prefixes with communities for debugging reasons.
Unfortunately I've been unable to find a way to print just the (ipv6) routes, matching a certain community.
I'm also unable to find a good explanation of the "where" and "find" subcommands/options.

Could somebody please point me in the right direction to some good documentation?
I'm looking for something like:
/ipv6/route/print where bgp.communities=".*:666.*"
or something similar ;-)

BTW, I also tried using this new dump-saved-advertisements command. Of course I've defined keep-sent-attributes=yes on the corresponding connection, but
/routing/bgp/session/dump-saved-advertisements bgp-locix-rs01-1 save-to=locix.pcap
doesn't create a file (at least not in /file/). I tried it on a RB3011 and two different CHRs.


Thanks and best regards,
Irrwitzer
 
mikro2009
just joined
Posts: 11
Joined: Fri Jan 25, 2019 11:12 am

Re: show bgp routes matching community  [SOLVED]

Tue Jun 21, 2022 3:38 pm

Hi Irrwitzer,

if your are running ROS 7.x this should work (at least for ipv4):
/routing/route print detail where bgp.communities~".*:666.*"

Some information you can find in the scripting documentation (https://wiki.mikrotik.com/wiki/Manual:Scripting).

Concerning dump-saved-advertisements I have the same problem (ROS 7.3.1) - there is not any capture file generated.

Best Regards,
Heino
 
User avatar
irrwitzer
just joined
Topic Author
Posts: 23
Joined: Mon Apr 11, 2022 11:54 pm

Re: show bgp routes matching community

Tue Jun 21, 2022 4:31 pm

Hi Heino,

Thanks so much for answering my (silly?) question!
if your are running ROS 7.x this should work (at least for ipv4):
/routing/route print detail where bgp.communities~".*:666.*"
Some information you can find in the scripting documentation (https://wiki.mikrotik.com/wiki/Manual:Scripting).
I'll need to getting used to the documentation sources.... wiki.mikrotik.com vs help.mikrotik.com... of course I didn't look at the scripting documentation for bgp debugging commands ;-)

This command needs an absurd amount of time to look through a full routing table but it presents the information I'm looking for. Thanks for pointing out the correct syntax for regexp queries!
Concerning dump-saved-advertisements I have the same problem (ROS 7.3.1) - there is not any capture file generated.
too bad. But I'm happy I'm not the only one not being able to get this to work. (ROS 7.3 & 7.3.1)
I had to sniff/wireshark my announcements to verify my filters are working.

Thanks again and all the best,
Johannes
 
User avatar
StubArea51
Trainer
Trainer
Posts: 1739
Joined: Fri Aug 10, 2012 6:46 am
Location: stubarea51.net
Contact:

Re: show bgp routes matching community

Tue Jun 21, 2022 4:49 pm

fwiw, you can also combine queries using the && operator to specify only IPv6 or any other attribute as well as the community search. Here is an example with large communities.

[zuul@sw-core-01.jan1.us.ipa] > routing/route/print detail where afi=ip6 && bgp.large-communities="65012:0:6"
Flags: X - disabled, F - filtered, U - unreachable, A - active; c - connect, s - static, r - rip, b - bgp, o - ospf, d - dhcp, v - vpn, m - modem, a - ldp-address, l - ldp-mapping, y - copy; H - hw-offloaded; 
+ - ecmp, B - blackhole 
  bH  afi=ip6 contribution=best-candidate dst-address=::/0 routing-table=main gateway=fc00:127:32::2 immediate-gw=fe80::de2c:6eff:fe39:18b%vlan3013-to-rtr-edge-02.jan1.us.ipa distance=200 scope=40 target-scope=30 
       belongs-to="BGP IP6 routes from fc00:127:32::2" 
       bgp.peer-cache-id=*B000005 .large-communities=65012:0:6 .local-pref=100 .atomic-aggregate=no .origin=igp 
       debug.fwp-ptr=0x203033C0 

Here is a Cisco to MikroTik command translation guide that may be helpful (for ROSv6 as I haven't done ROSv7 yet)

https://stubarea51.net/2015/11/09/cisco ... ation-bgp/
 
mikro2009
just joined
Posts: 11
Joined: Fri Jan 25, 2019 11:12 am

Re: show bgp routes matching community

Tue Jun 21, 2022 5:34 pm

Hi Johannes,

if you intend to use Mikrotik routers for production purposes I recommend ROS6 (I am evaluating ROS7 for a quite long time but there are some important features still missing, e.g. show advertised routes). We are running CCR1072-1G-8S+ routers (full bgp table) for some years without major problems. The main disadvantage (ROS6) is a single core bgp (running at 100% nearly all the time). Nevertheless it is a powerful system with an excellent value for money and a lot of nice features.

Best Regards,
Heino
 
User avatar
irrwitzer
just joined
Topic Author
Posts: 23
Joined: Mon Apr 11, 2022 11:54 pm

Re: show bgp routes matching community

Tue Jun 21, 2022 9:55 pm

Hi IPANetEngineer (Kevin?),

First of all: thank you for your great talks at MUMs! They are enjoyable, of very high quality and I've learned a lot from them in the past weeks! Please keep doing them ;-)
I also like your detailed postings in this forum and your fantastic lab setup - just wow!
fwiw, you can also combine queries using the && operator to specify only IPv6 or any other attribute as well as the community search. Here is an example with large communities.
[zuul@sw-core-01.jan1.us.ipa] > routing/route/print detail where afi=ip6 && bgp.large-communities="65012:0:6"
Flags: X - disabled, F - filtered, U - unreachable, A - active; c - connect, s - static, r - rip, b - bgp, o - ospf, d - dhcp, v - vpn, m - modem, a - ldp-address, l - ldp-mapping, y - copy; H - hw-offloaded; 
+ - ecmp, B - blackhole 
  bH  afi=ip6 contribution=best-candidate dst-address=::/0 routing-table=main gateway=fc00:127:32::2 immediate-gw=fe80::de2c:6eff:fe39:18b%vlan3013-to-rtr-edge-02.jan1.us.ipa
  [...]
  bgp.peer-cache-id=*B000005 .large-communities=65012:0:6 .local-pref=100 .atomic-aggregate=no .origin=igp
That's cool! That's great for live debugging without too much hassle and even better than the missing "| in" , "| match" or even "| grep".
I'm coming from cisco (ios,xe,xr), Arista and Junos and learning ROS syntax is equally challenging as fun ;-)
Here is a Cisco to MikroTik command translation guide that may be helpful (for ROSv6 as I haven't done ROSv7 yet)

https://stubarea51.net/2015/11/09/cisco ... ation-bgp/
Thanks! I stumbled upon your blog a few days ago, subscribed to your feed, but haven't seen this compilation yet.
It's for ROS6, but I guess I will find my way for ROS7 as well sometime.


Hi Heino,
if you intend to use Mikrotik routers for production purposes I recommend ROS6 (I am evaluating ROS7 for a quite long time but there are some important features still missing, e.g. show advertised routes). We are running CCR1072-1G-8S+ routers (full bgp table) for some years without major problems. The main disadvantage (ROS6) is a single core bgp (running at 100% nearly all the time). Nevertheless it is a powerful system with an excellent value for money and a lot of nice features.
Well - I thought about that from reading some of the beta and release threads I got the impression that there is still a lot of stuff missing in ROS7 and some things are just broken of course... but on the other hand there's a lot that changed going from 6 to 7 (general syntax, routing filter rule syntax, wireguard and some other features). I'm betting here on Mikrotik to get 7 stable and complete sooner than later. At the moment I did get everything to work I was looking for, so I guess I could stay on 7 for now for my personal stuff.
I got into Mikrotik mainly because I'm going to join a new company soon that uses Mikrotik for their enterprise routing. Coming from a datacenter and ISP company that's a huge step, so I thought I would have to look into this equipment before having to deal with it professionally. You might say I fell in love pretty hard, so I now have a little lab built myself and some production routers for my personal official networking project: a CHR and an x86 at IXPs with peering and transit, a 3011 at my home, all of those with fulltable (ipv6 only). The labbing stuff includes 3 HAP lites, some wifi APs. Then (of course...) Mikrotik decided to drop BGP and MPLS support from the HAPlites, so three HEX joined the club. I'm still waiting for two 5009, two ltAPs(LTE) and two R11e-LT8... from this you might see that I fell in love quite deep...

So I guess what will happen is: I will downgrade the HAPlites to 6.48.6 (to train the cli in case the new company is still on 6 and to get BGP back) and I will keep the rest on 7 to be up to date with the new stuff and to know what to lookout for when moving the company from 6 to 7 sometime.

Thanks to both of you for your insights, very much appreciated!

All the best,
Johannes

Who is online

Users browsing this forum: Bolendox, LeoNaXe and 40 guests