Dynamic DNS not updated in OpenWRT when IP changes on remote server

Hello,

I use an OpenWRT router (Archer C7 V2) with v22.03.05 in a remote location. That router connects via Wireguard to my home network. In order to establish a connection my home network is reachable via a dynamic Dns address. That all works fine until the IP at my home changes (happens like every few weeks at earliest or on a manual reboot).

It turned out when my home IP changes the remote OpenWRT router still seems to use the old home IP despite relying on the dynamic DNS hostname in the Wireguard config. It seems like it does not automatically resolve the IP of that hostname until I restart the OpenWRT router. Is that a bug or working as intended?

The only solution I see for now is to add some scheduled weekly restart of the OpenWRT router.

WireGuard only resolves the hostname when it starts as far as I know.

There are watchdog scripts which check the connection and restart the WG client if the connection is lost.
That could be an option perhaps.

2 Likes

Wow, great, thanks! That is both good to know. I will definitely look into your suggested solution!

Now that I know what to look for I immediately stumbled upon this:

and specifically this:
https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=20c4819c7baf6f9b91420849caf30e5137bd75d6

And if you ruin the watchdog. This can be done via cron.

Command:

/usr/bin/wireguard_watchdog

Example - to run every 15 minutes:

# in /etc/crontabs/root

 */15 * * * * /usr/bin/wireguard_watchdog
1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.