Ubiquiti EdgeRouter Backups

With Ubiquiti EdgeRouters, I always prefer to do CLI-level command backups. The “backups” you can do on the WebUI presumably work, but make configuration diffing impossible, and it limits portability across devices, especially device models. The default json format for the config is also fairly annoying to edit/maintain.

Instead, I do regular backups of the commands instead, and check them into git.

SSH into the EdgeRouter, and run1:

sudo cli-shell-api showConfig --show-commands --show-active-only --show-ignore-edit --show-show-defaults > /tmp/edgerouter-backup-$HOSTNAME.commands.conf

Then I pull the resultant conf file off the routers, and backups and check into git as necessary.

This format makes it far easier to make configuration changes, and bring up new devices by modifying configurations from other/previous devices.

If you get an errors stating that the configuration node already exists, simply take the current set command and replace it with delete, then set the value again:

delete interfaces ethernet eth1 address dhcp
set interfaces ethernet eth1 address 10.0.0.1/24