MikroTik – BGP advertised routes – update
Display BGP advertised routes on RouterOS
About a year ago, I wrote a post dubbed MikroTik – BGP advertised routes about displaying BGP advertised routes in RouterOS. My article lingered in my drafts for an extended period without being published. When I finally decided to publish it, MikroTik had addressed it with a neat solution. Here is my attempt to update it and spread the knowledge.
TL;DR – the command: /routing/bgp/advertisements print where peer="peer_name"
In networking, a myriad of devices and vendors exist, each with its unique philosophy and set of CLI commands. When it comes to MikroTik, I find myself in a love-hate relationship—love for the incredible versatility of their devices and hate for the lack of a fully finished, polished product. Nevertheless, MikroTik manages to produce exceptional products with an incredible bang for the buck.
Exploring the MikroTik way of things
MikroTik has caught up with Cisco’s IOS or Juniper’s Junos, where commands are straightforward, MikroTik’s RouterOS has a unique special dialect. To illustrate this distinction, let’s take on the seemingly simple task of acquiring information about BGP neighbors and displaying the routes we advertise to them.
In Cisco, the command show ip bgp neighbor x.x.x.x advertised-routes
is commonly used, and there would be no blog post, period. Well sort of, because the command is not very obvious, at least it was not to me, but it is much better when compare to the previous solution. Glad I was right about the “I am (..) sure, this is a work in progress, (…) they will introduce a more friendly command for that“.
To display your BGP advertised routes, the command is:
[admin@EDGEROUTER] > /routing/bgp/advertisements print where peer="eBGP-AS3356"
0 peer=eBGP-AS3356 dst=1.1.1.0/24 afi=ip nexthop=1.2.3.4 origin=0 as-path=sequence 100
0 peer=eBGP-AS3356 dst=1.1.2.0/24 afi=ip nexthop=1.2.3.4 origin=0 as-path=sequence 100
Above we can see we are advertising two IPv4 prefixes, respectively 1.1.1.0/24 and 1.1.2.0/24 with a next hop of 1.2.3.4. It is originated from your AS 100. And in case you wonder, you can find the peer name with autocomplete, or from the command /routing/bgp/session/print
Conclusion
Although I still perceive MikroTik’s RouterOS commands and dialect as weird unique, it’s worth acknowledging that MikroTik is slowly but surely reaching the level of other major manufacturers of network devices such as Cisco and Juniper. Creating a Network Operating System is undoubtedly a challenging task, so kudos to the team at MikroTik for their continued achievements.