19. srpna 2013

Mikrotik - backup configuration

Mikrotik - backup config

I started make some bigger changes in configuration of my Mikrotik. Becouse I don't want to loose whole my configuration, I first study how to backup configuration. There are two posibilities how to do this.

First way, Binary file with config.

Over menu Files, you can choose Backup. Mikrotik make file with configuration, who you can copy to your computer. If you want to know the simplest way how to copy file in and out of your Mikrotik, then you just use Drag & Drop :). Of course, you can use FTP, or samba, something else, what you prefer.

Second way, Script with configuration.

This is a little complicated, but after this you get script with complete configuration, who you can change, and see values which has been set.
Open New terminal, and over command export in root directory print whole configuration into terminal window. After that you can copy whole config to clipboard and paste it in new text document.


I know, that this is silly solution, but I change configuration just two or three times a year, and this is fast and functional.

Thirth way, Script for backup (as its desribe in manual)

Becouse I use Mikrotik as main router with DHCP and for VPN an so on, I needed more better backup for configuration. Previous ways was good, but it wasn't easy to to do it automatically. Then I deside use other really better style of backup.
Manual is good source and offer me definitely the best way.

First you just need confugure email  in Tools->Mail for outcome email comunication (you can use it for a lot of things, not just for this backup ;)

After that you should create script in System-> Script.

Script is easy, its just four commands.

/system backup save name=([/system identity get name] . "-" . [:pick [/system clock get date] 7 11] . [:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6]); \

/tool e-mail send to="your@emailaddress.com" subject=([/system identity get name] . " Config Backup " . \
[/system clock get date]) file=([/system identity get name] . "-" . [:pick [/system clock get date] 7 11] . \
[:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6] . ".backup"); :delay 10; \

/file rem [/file find name=([/system identity get name] . "-" . [:pick [/system clock get date] 7 11] . \
[:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6] . ".backup")]; \

:log info ("System Backup emailed at " . [/sys cl get time] . " " . [/sys cl get date])



When you named this script and save it in Mikrotik, you can run it manually, for sure ,that it do what you want. If you copy it correctly, in your mailbox should come backed up configuration.



Last step is in System -> Scheduler, where you have to create new scheldule for script which you create in Script. Set up Date of firt run, and period how often do you wants run script for backup.



If you want make more complex backup, just look in this manual.
http://wiki.mikrotik.com/wiki/Using_SSH_for_system_backup



Žádné komentáře:

Okomentovat