MikroTik – BGP advertised routes

Display BGP advertised routes on RouterOS

This article lingered in my drafts for an extended period without being published. Soon after its completion, MikroTik addressed the issue, prompting the need for a new article that I will be writing shortly. For an updated version, read the updated article MikroTik – BGP advertised routes.

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.

In this article, we’ll delve into the peculiar intricacies of configuring MikroTik RouterOS 7 and BGP. If you’ve ever tried to display your advertised routes and felt like you were trying to send a rocket to the moon, you’re not alone. Coming from the Cisco or Juniper world, you might expect a simple command, but MikroTik has its own unique approach. Buckle up as we explore the challenges and solutions in the world of MikroTik RouterOS and BGP.

Exploring the MikroTik way of things

Compared to Cisco’s IOS or Juniper’s Junos, where commands are straightforward, MikroTik’s RouterOS has a unique special dialect, or twisted way of doing things. 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. However, in MikroTik’s world, the equivalent command takes a different form. Instead, you’ll need to navigate a different path, having to hack things around. I am quite sure, this is a work in progress, and at some point they will introduce a more friendly command for that.

The following command caused my BGP session to flap, and I observed an increased strain on my CPU. I recommend using this command only for debugging purposes.

  • List the peer you want to monitor, get it’s ID:
    [admin@mikrotik] /routing/bgp/connection> print

  • Enable the option for the peer ID of your choice (0 in this example):
    [admin@mikrotik] /routing/bgp/connection> set 0 output.keep-sent-attributes=yes

  • Capture the session with a unique file name, such as:
    [admin@mikrotik] /routing/bgp/session> dump-saved-advertisements 0 save-to=peer.pcap

  • Read the output with the following command:
    [admin@mikrotik] /routing/stats/pcap/print detail where file=peer.pcap

  • You can now you can find the prefixes announced in the “.nlri=” section

Conclusion

In exploring the intricacies of MikroTik’s RouterOS commands, it becomes apparent that the current implementation lacks the seamless simplicity found in counterparts such as Cisco‘s IOS or Juniper‘s Junos. This deviation, to me, suggests a work in progress, leaving ample room for refinement and streamlining. In the meantime, I hope this article will be helpful to some of you, even if it elicits a facepalm moment, but you know now how to display BGP advertised routes on RouterOS.

Gregory

Gregory

I'm Gregory from Switzerland, and this is a running log of thoughts, findings, and lessons learned over more than 20 years in IT. With a deep passion for networks and security, I focus on architecture, governance, and emerging technologies. My journey has taken me through complex challenges and continuous learning across various sectors. While this space mainly serves as my personal knowledge base, I hope that sharing these notes might also offer insights or inspiration to others navigating the ever-evolving digital landscape.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

+ 31 = 39