We use WireGuard to connect to various endpoints with dynamic IP addresses. However, VyOS does not currently support hostname addresses and requires a static IP (Example: 1.2.3.4 below).
wireguard wg110 {
address xxx.xxx.60.2/32
description remote network
mtu 1420
peer xxxxx.tld {
address 1.2.3.4
allowed-ips xxx.xxx.0.0/0
allowed-ips ::/0
persistent-keepalive 10
port 51820
preshared-key ****************
public-key ****************
}
port 51822
private-key xxxxxx
}
Until this feature gets developed, is there a way in VyOS to write a script to update the IP (resolve hostname to IP address) at reboot?
How would the script execute – is there a config command to call a script on boot, for example? Or a way to call it with cron?
Where should the script be saved so it survives system upgrades?
What would the script update (config.boot?) and how should the updated configuration be loaded?
And lastly, what technique might one use to “find and replace” the old IP address under the wg peer, and update it with the new one?
Happy to write something like this for the community, but not sure how best to apply it to VyOS.