Yes, it is possible to configure automatic backups on MikroTik devices and send them to an FTP or TFTP server. This is a best practice to ensure you have a backup of your device settings, which can be vital for quick recovery from hardware failures or misconfigurations. Here I detail how to do it:
Step 1: FTP or TFTP Server Configuration
Before you can send backup files, you need to have a functioning FTP or TFTP server that the MikroTik device can access. You must ensure that the server is properly configured to accept connections and store files.
Step 2: Create the Backup Script
In MikroTik RouterOS, you can create a script that generates the backup and sends it to the server. Here's a basic example of what this FTP script might look like:
/system backup save name=backup_auto
/tool fetch address=192.168.1.100 src-path=backup_auto.backup user=ftpuser password=ftppass mode=ftp dst-path=/mikrotik_backups/backup_auto.backup upload=yes
In this script:
- First a backup file called
backup_auto.backup
. - Then use the command
/tool fetch
to send the file to the FTP server. Change192.168.1.100
with the IP address of your FTP server, and set the user credentials (ftpuser
yftppass
) and the destination route (/mikrotik_backups/
) depending on your configuration.
For TFTP, the script would be similar, but you must change the mode
a tftp
and it may not be necessary to specify username and password, depending on the configuration of your TFTP server.
Step 3: Automate the Script
To have the backup done automatically, you can schedule the script to run at regular intervals using MikroTik's Scheduler.
/system scheduler
add name="Backup Diario" start-date=apr/01/2023 start-time=03:00:00 interval=1d on-event="/system script run backup_script"
This scheduler will execute the script called backup_script
every day at 03:00 AM. Make sure the event name on-event
matches the name you have given to your backup script.
Step 4: Verification and Security
- Verifica that backups are being successfully created and uploaded to the server as scheduled.
- Ensures your FTP or TFTP server, especially if it is accessible from the Internet. Use strong passwords and consider using private networks or VPNs for file transfers.
Setting up automatic backups to an FTP or TFTP server is an effective way to ensure that you maintain a secure copy of the configuration of your MikroTik devices, making it easier to manage your backups and recover your system.
There are no tags for this post.