Wireguard DNS Search Domain not showing up in /etc/resolv.conf

I know this has been talked on before @zach with v1.3.4220.57 but developers are still having issues where the DNS Search Domain is not showing up in our /etc/resolv.conf via Wireguard. We are a mix of Windows/MacOS:

  • Pritunl client: v1.3.4466.51
  • Pritunl VPN: v1.32.4512.98
  • MacOS: Tahoe 26.3

I have not tested this out in Windows yet but going to try this out tomorrow. Is this still something that is in the works?

There’s no reliable way of doing this on Linux that supports all the different DNS systems. It’s generally not recommended to use a DNS search domain. I may develop something for systemd-resolved as that has the most reliable API but not something to directly edit /etc/resolv.conf.

Ya, this is such a pain when it comes to Wireguard. It works in Linux but not MacOS. It’s infuriating. All good. Will try to find a band-aid around this.

I thought you were referring to Linux, for macOS run scutil --dns to check the DNS configuration. I did find the issue for macOS, currently there is a typo setting the DnsServers to the SearchDomains field in service/connection/wg.go. There will be another release this week to fix the Electron window issue so this will be included in that release.

Sorry, let me clarify. I will be testing Windows tomorrow. Linux is working just fine. It’s MacOS that is constantly giving me issues with the Search Domain. A temporary fix, which works ONLY if you don’t switch between multiple VPNs, is me running the following commands:

❯ networksetup -listallnetworkservices
An asterisk (*) denotes that a network service is disabled.
USB ACM 5
USB ACM 4
USB ACM 3
USB ACM 2
USB ACM
USB3.0 5K Graphic Docking
Thunderbolt Bridge
Wi-Fi
❯ sudo networksetup -setsearchdomains Wi-Fi foo.vpn foo.com

I have reviewed and updated all the DNS code for both OpenVPN and WireGuard. The only issues found on macOS was WireGuard DNS IP address incorrectly set to SearchDomain. Additionaly the primary service SearchDomain will now be backed up on connection and restored when all VPN connections end. The DNS servers don’t require modifying the primary service so these should always get restored.

There is another issue on OpenVPN Linux where the DNS code assumes systemd-resolved is in use if the resolvectl binary is present. This may be fixed but the recommend fix is to either complete the systemd-resolved configuration using the commands below or uninstall resolvectl.

sudo pacman -S systemd-resolvconf
sudo systemctl enable --now systemd-resolved
sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

I did additional testing and both DNS IP and search domain configuration should currently be working on Linux and Windows with the latest release. For Linux it will only fully work if systemd-resolvconf is used, some of the other DNS services will work with OpenVPN but can have issues. After the next release both DNS IP and search domain configuration should be fixed for macOS.