====== Mikrotik RouterOS Backup and Restore ====== https://jcutrer.com/howto/networking/mikrotik/perfectrestore-script https://wiki.mikrotik.com/wiki/Manual:Configuration_Management#Exporting_Configuration :!: The backup function will backup and restore MAC addresses. Use the interface function ''Reset MAC Address'' to reset to the hardware MAC addresses. :!: Restore to the same version of RouterOS the backup file was taken from. ===== Dissimilar Hardware ===== Export section by section and import one section at a time. ===== Automated Backup ===== {{:networking:router:mikrotik_email_settings.png?direct&300 |E-Mail Settings}} {{:networking:router:mikrotik_makebackup_script.png?direct&500 |makebackup Script}} ==== E-Mail Settings ==== Sending e-mail is sensitive due to security. If you have problems, be sure to send **from** a valid account. # Edit Mail Settings :local emailserverip "ip.of.mail.server"; :local emailfrom "XYZ Router "; :local emailto "you@yourdomain.tld"; :local emailusername "validusername"; :local emailpassword "validpassword"; /tool e-mail set from="$emailfrom" address="$emailserverip"\ port=587 tls=starttls user="$emailusername" password="$emailpassword"; ==== makebackup Script ==== # Automatic backup script :log info "Starting Backup Script"; :local SYSname [/system identity get name]; :put "Backing up $SYSname"; /system backup save name="$SYSname"; /export file="$SYSname"; :log info "Backup pausing for 10s"; :delay 10s; :log info "Finished backing up configuration, sending e-mail"; :local files {($SYSname . ".backup");($SYSname . ".rsc")}; /tool e-mail send to="you@yourdomain.tld" tls=starttls subject=($SYSname . " backup") \ body="See attached backup files." file=$files; :log info "Backup pausing for 10s"; :delay 10s; :log info "Removing backup file"; :put "Removing backup file"; /file remove ($SYSname . ".backup"); /file remove ($SYSname . ".rsc"); :log info "Finished Backup Script";