Having a backup of our configuration on the MikroTik RouterOS is very crucial. This is not only for MikroTik but also for any other network devices, it is always recommended to have a backup of the configuration and be saved in a safe place then in case we want to revert to the working configuration one, then we can just simply restore the backup.
In MikroTik RouterOS there are 2 different backups:
- Binary (sometimes referred as image)
- Configuration (sometimes referred as export)
Both of them they can do backup for our configuration. Let’s start speaking about the Binary one.
The Binary backup is a backup which can take all the configuration that you have in the router and save it in a file. This also includes the passwords and everything else.
The good thing about the Binary backup is that in case you have done any wrong configuration and you want to revert back to the old configuration, then you can just load the Binary backup and you will go to back to the configuration saved in the backup file. To mention, the Binary backup is not editable, that means that you cannot open the file of the backup and edit it.
As for the configuration backup, you can simply export the configuration of the router and save it on a file. This type of backup can be edited, so you can simply open the file and change what you want to change then import the new adjusted configuration to the router to have the new configuration. Think for example if you have made a configuration backup from one router and you want to put the same configuration on another MikroTik which doesn’t have the same interfaces as the first one. You can simply go to the export backup, change the name of the interfaces, and then import the configuration to the new MikroTik Router.
To mention, the configuration backup does not contain any passwords saved in the router.
Also on the configuration backup, you can export only part of the configuration. For example, if you have a very nice firewall filter rules in your MikroTik router that you want to put the same filter rules on another MikroTik router, then you can simply export only those filter rules and import them to the new router – that’s possible to be done with the configuration backup.
Now we know the difference between the 2 types of backups that we have on MikroTik RouterOS, let’s apply that on LAB so you can understand them better.
We are still on the same LAB scenario. I am going to show you how you can do the Binary backup and how to restore it to the MikroTik router.
Remember, Binary backup will take the whole configuration that you have on the MikroTik router including the passwords.
To do the Binary backup, you have 1st to go to File List:
[mepr-show rules=”319″ unauth=”message”]
Then all you need to do is to click on Backup:
Now you can give a name for the Backup. If you don’t then it takes the router name followed with the date and time as being the name of that backup. You can also put a password for this backup to be more secure.
The most important one is the Encryption. I highly recommend that you leave the Encryption enabled, because if you disable it by checking “Don’t Encrypt” then in case someone has your backup file then he may use some third-party softwares to read what is this backup file has and guess what, the passwords are there. That means he can guess what your passwords are.
I will leave the encryption enabled and create the backup by clicking on Backup:
You can see, the backup file has been created inside the File List and it has an extension of .backup
When we made the backup, the router identity was R1. I want to change the identity of the router to Router1, then restore the Binary back and see if the router will go back to R1.
Let’s change the router identity to Router1:
Excellent! The router name now is Router1 as you see below:
Now I want to restore the Binary backup file to check if the router will have his name as R1.
Once you click on Restore, you will get this prompt:
I am going to click on Yes and wait for the router to be rebooted then check if its name has been changed to R1.
Now the router has been rebooted, let’s check what the router has taken as a name after the binary backup has been restored:
You can see clearly; the router name has been changed to R1.
Before I finish this LAB, if you wish to do a Binary backup from the command line, you can write the following command from the Terminal:
This way, I have created a Binary backup which is encrypted, and I gave it a name of R1-Backup. Let’s see if I can find it on the file list now:
Here it is in the file list.
That’s all what I wanted to show you about the Binary backup, let’s now do the LAB for the Configuration backup.
We are still on the same LAB scenario. Now I will show you how you can do the Backup as well as the Restore using the 2nd method which is the Configuration Backup.
Very important to remember, with the configuration backup all passwords will not be copied to the backup file.
The 2nd thing to remember, that this type of backup can be only done using the command line.
Let’s go to the MikroTik Terminal and write export:
The output you get from the export command is the configuration that is on our router. This configuration I need to save it in a file which I can edit it later. Let’s do that:
So now I have saved the output of the export command to a file called R1-Export. This file can be seen inside the File List of the Router.
As I said, this file can be edited. So, I will copy this file to my PC by just drag and drop it to my desktop, and try to open it. You can open it with a simple notepad, or notepad++ or any other document software. In my case I will use notepad++.
I copied the file to my desktop and now it is there:
I will open it now with notepad++ to check if I can edit the configuration:
Here it is. You can see I can do whatever I want on this file then save it. Afterword, I can import it to the router or to any new router which I want it to have same configuration as per the configuration backup file.
To import the configuration, you can do it in 1 or the 2 ways:
- Using the command line (will show it now)
- Copy & paste the commands shown in notepad++ to the router terminal
To do the import (restore) of the configuration using the command line, you should write the following:
The last thing I want to show in this LAB, is that you can take part of the configuration and save it in a file.
For example, if you have a very nice template of filter rules in one router, you can export only the filter rules and add it to a 2nd router, so it has same filter rules as the 1st router.
In my case I do not have filter rules on my router, but I do have a NAT rule, so let me show you how I can export that NAT rule only:
If you want to save the output in a file, you can do same as what we have done previously:
Now I have the file inside the file list. If I open it on notepad++, I can see the output there:
That’s all what I wanted to show you about the Backup and Restore on the MikroTik RouterOS, I hope it was informative for you.