Show BGP advertised routes on MikroTik RouterOS 7 (the old way)

Before RouterOS had a proper command, seeing what you advertise to a BGP peer meant saving the sent attributes and reading them from a pcap. Kept for reference.

Contents

Every network vendor has its own philosophy and CLI. With MikroTik I have a love-hate relationship: I love how versatile and good value their devices are, and dislike how often the product feels unfinished.

Coming from Cisco or Juniper, you expect a simple command to show the routes you advertise to a BGP neighbour. In RouterOS 7, it felt more like sending a rocket to the moon.

The MikroTik way

In Cisco IOS or Juniper Junos, commands tend to be straightforward. RouterOS has its own dialect. On Cisco, show ip bgp neighbor x.x.x.x advertised-routes does the job, and there would be no blog post. On RouterOS you have to work around it. I am quite sure this is a work in progress, and at some point they will introduce a more friendly command for that.

The workaround

  1. List the BGP connections and note the ID of the peer you want to look at:

    [admin@mikrotik] /routing/bgp/connection> print
  2. Make the router keep the attributes it sends to that peer (ID 0 here):

    [admin@mikrotik] /routing/bgp/connection> set 0 output.keep-sent-attributes=yes
  3. Save the advertisements of the session to a file with a unique name:

    [admin@mikrotik] /routing/bgp/session> dump-saved-advertisements 0 save-to=peer.pcap
  4. Read the file:

    [admin@mikrotik] /routing/stats/pcap/print detail where file=peer.pcap

The announced prefixes are listed in the .nlri= fields.

A work in progress

Compared with Cisco IOS or Juniper Junos, this is far from simple, which to me suggests a feature that was still being built. It may cause a facepalm, but it works.

Join the discussion

Comments are hosted on comments.vciso.ch, a server I run myself. Nothing is loaded from it until you press the button below. Loading comments connects your browser to that server, and signing in with GitHub sets a cookie there. See the privacy page for details.

Type to search.

↑ ↓ to move, Enter to open, Esc to close