poniedziałek, 21 maja 2012

Mikrotik scripts for keeping configuration synced between two different Mikrotik routers.

Ten post jest dostępny jedynie w języku angielskim.
I've faced problem how to setup backup router that can be easily (but manually) switched to act as main. I have two routers - RB1000 and RB750. They are different platforms and I can't just backup config on RB1000 and restore it on RB750. Additionally RB750 have one more ethernet interface which I use to detect if router acts as main router. If additional interface (configurable in script) is running (cable is connected) router will act in "backup" mode, otherwise it will be in "running" mode. My solution consists of two separate scripts - 1. mikrotik-sync-config.py 2. set-backup-mode Ad.1 This script cares about config on backup router to be the same (as much as possible) as on main router (RB1000). It's configurable - you can setup what from main router config to omit, while importing on backup router. Ad.2 This script runs on scheduler on backup router. It detects cable at specified interface (SI) and setups router in "backup" or "running" mode. In "backup" mode all interfaces except SI and all schedules are disabled. When cable is removed from SI, script switches router into "running" mode what means it's enabling interfaces and schedules You can find scripts here -> https://github.com/codepill/script-utilities/tree/master/mikrotik