Script to install WireGuard on Ubiquiti

Because i had some issues with configuration lost on Edgerouter ER-4 after power loss i’ve search how to upgrade wireguard without losing configuration (like pubkey and privkey).
I found this. Works pretty good. Installed. Saved. Reboot.

[email protected]:~$ sudo -i
[email protected]:~# cd /config/scripts
[email protected]:/config/scripts# curl -LO --silent
[email protected]:/config/scripts# chmod +x
[email protected]:/config/scripts# ./
[INFO] Board model: EdgeRouter 4
[INFO] Board type: e300
[INFO] Board repo mapping: e300
[INFO] Firmware version: v2.0.4.5199165.190605.1549
[INFO] Installed WireGuard version: 0.0.20190601-1
[INFO] Release version: 0.0.20191219-2
[INFO] Debian package URL:
Downloading WireGuard package…
Checking WireGuard package integrity…
Backing up running configuration…
Removing running WireGuard configuration…
Removing WireGuard module…
Installing WireGuard…
Restoring previous running configuration…
Enabling WireGuard installation after firmware update…
WireGuard has been successfully installed.
[email protected]:/config/scripts# exit

Added cron for future updates:

[email protected]:~$ configure
[email protected]# set system task-scheduler task get_wireguard executable path /config/scripts/
[email protected]# set system task-scheduler task get_wireguard interval 7d
[email protected]# commit
[ system task-scheduler ]
Restarting cron (via systemctl): cron.service.
[email protected]# save
Saving configuration to '/config/config.boot'…
[email protected]# exit

Leave a reply:

Your email address will not be published.

Site Footer