edgenative / mikrotik-irrupdater

Scripts to automatically deploy strict IRR filters to your peers on Mikrotik routers.
GNU General Public License v3.0
12 stars 2 forks source link
bgp-configuration irr-scripts mikrotik mikrotik-api

mikrotik-irrupdater

Update IRR Routing Filters on a Mikrotik Router running ROS7+

Prerequisits

What is this for?

You want to run strict IRR filters on your customer/peer BGP sessions and have a Mikrotik router. This collection of scripts essentially wraps around BGPQ4 to generate prefix lists, then builds filter config that can be read by our python to push them to the actual router using the Mikrotik API.

If you wish to run the python on it's own, we've made the python script accept a format like the below;

{'chain': 'as35008-fcix-import-ipv4', 'rule': 'if (dst==194.246.109.0/24) { accept }'}
{'chain': 'as35008-fcix-import-ipv4', 'rule': 'if (dst==194.15.141.0/24) { accept }'}
{'chain': 'as35008-fcix-import-ipv4', 'rule': 'reject'}

However, we've included everything you need to make this pretty self-contained and so the scripts here do everything you need to build this format from a list of prefixes generated by BGPQ4.

How do I configure it?

This updated collection has everything you need in one place. Our previous release was a bit complex and required IRRPT and some other bits. We've made it much simpler after feedback, so it's all pretty self contained. That said, you do need to configure a couple of things here. We're expecting you to install this into /usr/share/mikrotik-irrupdater/ on your host;

Automate it?

Once you've got the configuration set, you can simply schedule a couple of things to run in cron and you should be all set.

How do I use it on the router?

The scripts here generate filters using a slug as the entity name. For example, we use fcix for the Fremont Cabal Internet Exchange, sfmix for San Francisco Metropolitan Internet Exchange and customer for downstream customers. This results in filters named as follows;

Using the slug, it then goes on to call another filter which needs to exist on your router todo other things. The filters generated by our code here look for <slugname>-import as the next filter. So for sfmix in our example here, we're looking for another filter called sfmix-import. Within this import you can set local preference, med, communities and everything else you need for your internal TE policy. Infact in our setup, we're then jumping to another filter after this which checks RPKI.

What else?

Was this useful?

Let me know, I'd love to hear from you!