Backing Up and Restoring RouterOS Configuration
Having a current backup of your router configuration is essential. Hardware can fail, misconfigurations can happen, and firmware upgrades can occasionally cause unexpected issues. A backup lets you recover quickly.
RouterOS offers two distinct backup methods, each with different use cases.
Method 1: Binary Backup (/system backup)
A binary backup saves the entire RouterOS configuration in a compressed binary file. This is the fastest method and captures everything, including passwords.
Creating a Backup
/system backup save name=myrouter-2024-01-15This saves a file called myrouter-2024-01-15.backup to the router flash storage. To see it:
/file printDownloading the Backup
You can download the .backup file via Winbox (Files menu) or SCP:
scp admin@192.168.1.1:myrouter-2024-01-15.backup ./Restoring from Binary Backup
Upload the backup file to the router, then:
/system backup load name=myrouter-2024-01-15.backupThe router will reboot and restore the saved configuration. Note: This restores the configuration from the exact RouterOS version that created the backup. Restoring a backup from a very different version may cause issues.
Password Protection
You can optionally add a password to the backup:
/system backup save name=myrouter-2024-01-15 password=BackupPass123Then when restoring:
/system backup load name=myrouter-2024-01-15.backup password=BackupPass123Method 2: Export (/export)
The export command generates a human-readable .rsc script file containing RouterOS commands that recreate the configuration. This is more portable and version-independent.
Full Export
/export file=myrouter-export-2024-01-15This creates myrouter-export-2024-01-15.rsc — a plain text file you can open in any editor.
Exporting a Specific Section
You can export just part of the configuration:
/ip address export file=ip-addresses
/ip firewall export file=firewall-rules
/interface export file=interfacesViewing the Export Without Saving
/exportThis prints the configuration to the terminal, useful for quickly reviewing settings.
Compact Export (Hides Defaults)
/export compact file=myrouter-compactThe compact flag only shows settings that differ from RouterOS defaults, making the file smaller and easier to read.
Restoring from Export
Upload the .rsc file to the router, then import it:
/import file=myrouter-export-2024-01-15.rscThis runs the commands in the file line by line. If your router already has conflicting configuration, some commands may fail — it is best to import onto a fresh or reset router.
Comparing the Two Methods
| Feature | /system backup | /export |
|---|---|---|
| Format | Binary | Plain text (.rsc) |
| Passwords | Included | Not included by default |
| Version dependency | Yes | No (mostly) |
| Human readable | No | Yes |
| Partial backup | No | Yes |
| Import on clean router | Yes | Yes |
Best Practices
- Schedule regular backups: Use the RouterOS scheduler to run backups automatically.
/system scheduler add name=weekly-backup interval=7d on-event="/system backup save name=auto-backup" start-time=00:00:00- Store backups off-router: Always download backups to a remote location. If the router dies, you cannot access files stored on it.
- Test restores: Periodically verify your backup actually works by restoring it to a test router.
- Use both methods: Keep a binary backup for fast recovery and an export for version portability.
- Name files with dates: Include the date in the file name so you know which backup is most recent.
Sending Backups via Email
RouterOS can email backups automatically:
/tool e-mail set server=smtp.example.com from=router@example.com
/system scheduler add name=email-backup interval=7d on-event="/system backup save name=weekly; /tool e-mail send to=admin@example.com subject=RouterBackup file=weekly.backup"Summary
- Use
/system backup savefor quick, complete binary backups. - Use
/exportfor human-readable, portable configuration scripts. - Always store backups off the router.
- Schedule automatic backups with
/system scheduler. - Test your backups regularly to ensure they actually work.
