Show BGP advertised routes on MikroTik RouterOS 7
RouterOS 7 now has a direct command to show the routes advertised to a BGP peer: /routing/bgp/advertisements print. An update to my earlier workaround.
Infrastructure bgp mikrotik routeros networkContents
About a year ago I wrote MikroTik – BGP advertised routes, on how to display the routes RouterOS advertises to a BGP peer. The article sat in my drafts for a long time, and by the time I published it MikroTik had added a proper command for it. This is the update.
In short: /routing/bgp/advertisements print where peer="peer_name"
The MikroTik way
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.
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 shows
what you advertise to a neighbour, and there would be no blog post. The RouterOS
command is still not very obvious, at least it was not to me, but it is much
better than the previous workaround. I was glad to be right when I wrote that
“I am (…) sure, this is a work in progress (…) they will introduce a more friendly
command for that”.
The command
[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
We advertise two IPv4 prefixes, 1.1.1.0/24 and 1.1.2.0/24, with next hop 1.2.3.4,
originated from our AS 100. The peer name autocompletes, or you can look it up
with /routing/bgp/session/print.
Credit where it is due
RouterOS commands still feel unusual to me, but MikroTik is slowly and surely reaching the level of the larger vendors such as Cisco and Juniper. Building a network operating system is hard, so kudos to the MikroTik team.