Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Best practices] Force Wireguard to re-resolve DNS after IP change using DynDNS?

Featured Replies

Issue

  • unRAID Server at location A is connected (as client) to a Wireguard server at location B

  • Location B has no static IP address. DynDNS is set up to update when IP address changes.

  • Connection times out (Settings >> VPN Manager >> "Last handshake: x hours ago").

  • Timeout seems to happen every night in the timeframe for receiving a new IP address set in the router at location B.

Reason/ Diagnosis

If my understanding of this ArchWiki documentation for Wireguard is correct, this behavior is expected because Wireguard will not re-resolve the dns for the endpoint (regardless of persistent-keepalive settings). There is a wireguard-tools/reresolve-dns which solves this issue by resetting the endpoint to the updated ip.

Possible solution

Since I did not find wireguard-tools on the unRAID host, I would simply copy the script somewhere and then schedule a cron job using the user scripts plugin to run /<path_to_script>/reresolve-dns.sh /etc/wireguard/wg<tunnel_no>.conf

I've found the wiki entry just now so I hadn't any chance to tried it yet (reconnecting the internet at location B will give me a new IP but I'm not sure if this would be an appropriate simulation of what is happening when my ISP changes the IP).

Questions

  • Has anyone else experienced this issue and found a better/ alternative solution?

  • Is my diagnosis correct? Would running the script via user scripts work?

  • Are there any best practices on how to solve this issue?

Solved by Pa7rickStar

  • Community Expert

Ive a simpel script running that pings the peer ip and if it fails multiple time in a row just runs wg-quick down wg2 and wg-quick up wg2 rinse and repeat.

Edit: I currently can't get the file from the server cause the web terminal/log is broken on mobile chrome, but it's similar to the fix I use in my docker container

https://github.com/Mainfrezzer/wireguard-bridge/blob/main/additions/healthcheck.sh

Edited by Mainfrezzer

  • 3 weeks later...
  • Author
  • Solution

Thanks! So running an user scripts seems to be the way to go 👍

Your script looks very cool! I tried the wireguard-tools/reresolve-dns.sh first, though. I cloned it to /mnt/user/system/wireguard-tools/reresolve-dns.sh and added an user script with this content (the script is running every 5 minutes):

#!/bin/bash
/mnt/user/system/wireguard-tools/reresolve-dns.sh /etc/wireguard/wg0.conf
/mnt/user/system/wireguard-tools/reresolve-dns.sh /etc/wireguard/wg1.conf

Works like a charm. Even when I restarted the router at location B the tunnel was reestablished and Krusader copy processes continue without user intervention.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.