Blog

WireGuard DNS: what the DNS line does on Linux

WireGuard has no DNS setting: wg-quick reads the DNS line and hands it to resolvconf. We ran one config under five setups on Linux and crashed it twice.

Published December 2, 2026 · 19 minutes read

Key takeaways

  • wg-quick, not WireGuard, reads the DNS line: it pipes the addresses to resolvconf -a with -m 0 -x, and that program decides the rest.
  • ~. is what systemd-resolved made of the line on our machine: all test lookups went to the tunnel’s server, though only one subnet was routed.
  • 5.005 seconds: how long each glibc lookup (getent) waited on our machine, with Debian’s resolvconf, after we deleted the tunnel without wg-quick down.
  • 127 is wg-quick’s exit code on our machine when a config has a DNS line and no resolvconf exists: it deletes the interface again.
  • One firewall rule kept the DNS address our apps use inside the tunnel answering; without it, names failed while the tunnel looked healthy.
On this page (18)

WireGuard never reads the DNS = line in a config: wg-quick passes it to whichever program answers to resolvconf, and that program decides where your lookups go. Deleting the tunnel without wg-quick down on our Ubuntu virtual machine on 2 December 2026 left systemd-resolved fine, openresolv resolving nothing, and Debian's resolvconf making each system lookup wait 5.005 seconds.

Nothing in those runs was WireGuard's doing. On a machine with no resolvconf at all, the same config never brought the tunnel up.

On our Ubuntu 26.04 machine, as shipped, the program behind resolvconf is systemd-resolved. It turned the line into the catch-all routing domain ~., so the tunnel's DNS server got every name we looked up, though the tunnel routed only one subnet. Without the line, the tunnel still came up and lookups stayed with the normal network's resolver, in 3 of 3 runs on every setup. This is the config we tested, keys left out. The line sits in [Interface]:

[Interface]
PrivateKey = <client private key>
Address = 10.9.0.2/24
DNS = 10.9.0.1
 
[Peer]
PublicKey = <server public key>
Endpoint = <server>:<port>
AllowedIPs = 10.9.0.0/24

Our own tunnel once failed the other way. On the night of 4 to 5 September 2026 the DNS address our apps are given inside the tunnel answered nothing on one of our exit servers while every tunnel layer looked healthy. The second half of this post is that night and the test that now catches it.

wg-quick
A helper script shipped in wireguard-tools. From a config file it creates the Linux interface, gives it addresses and routes, and runs your hooks.
resolvconf
The command name for managing /etc/resolv.conf, the file that says which DNS server programs should query. Three unrelated programs answer to it, and each behaves its own way.
systemd-resolved
Ubuntu's default DNS service. It remembers DNS servers per network link rather than in one file.
  • 5DNS setups for one tunnel; all 3 runs agreed in every cell
  • 5.005 seach glibc lookup waited this long after a crash, Debian’s resolvconf
  • 0names resolved after the same crash with openresolv
  • 127wg-quick’s exit code with a DNS line and no resolvconf: no tunnel
How we tested
Date
2 December 2026
Machine
One Ubuntu 26.04.1 virtual machine, kernel WireGuard, wireguard-tools 1.0.20250521, systemd 259, AppArmor 5.0.2.
Network
Two network namespaces on that machine: a local network whose resolver (192.0.2.53) answers every name with 203.0.113.99, and a WireGuard peer whose resolver (10.9.0.1) answers with 203.0.113.53.
Config
Address = 10.9.0.2/24, one peer, AllowedIPs = 10.9.0.0/24 (split), and either DNS = 10.9.0.1 or no DNS line.
Setups
systemd-resolved as shipped; the same with the PostUp recipe; openresolv 3.17.4 and Debian resolvconf 1.95 (Debian packages on Ubuntu, systemd-resolved stopped, wg-quick’s AppArmor profile removed for their main rows and kept for the confined rows); no resolvconf.
Lookups
One unique name per step, with getent ahostsv4 and dig +time=2 +tries=1, and tcpdump on every interface.
Crashes
A: ip link del wg0. B: SIGKILL during a PostUp pause after the DNS step, on a byte-identical copy of wg-quick outside the AppArmor profile so that a hook could pause it.
Resolved rows
DNS default-route was off on the machine’s management link, so only the test network’s resolver could answer a name the tunnel did not claim.
Runs
3 per cell; all agreed.
Exit test
Three network namespaces (our client, a stand-in internet holding the upstream resolver, our exit), the exit’s packaged firewall file loaded unmodified; the packaged file and a copy with only the DNS rule removed.

What does the DNS line in a WireGuard config actually do?

Nothing, as far as WireGuard goes. The line belongs to wg-quick, which turns the addresses into nameserver lines and feeds them to resolvconf -a <interface> -m 0 -x; on the way down it calls resolvconf -d. What that call means depends on which program owns the resolvconf name.

The kernel module has no notion of a resolver, which fits how WireGuard leaves most configuration to surrounding tools. In the script, as we read it on 2 December 2026, the sequence is short:

  1. The value is split at commas. Tokens shaped like IP addresses go in a server list; every other token goes in a search-domain list.
  2. Once the interface has its address and MTU, set_dns makes one resolvconf call. A line with no address makes no call.
  3. Routes and your PostUp hooks run afterwards.
  4. wg-quick down runs unset_dns, which tells resolvconf to drop the entry.
# wg-quick, linux.bash (trimmed)
set_dns() {
	[[ ${#DNS[@]} -gt 0 ]] || return 0
	{ printf 'nameserver %s\n' "${DNS[@]}"
	  [[ ${#DNS_SEARCH[@]} -eq 0 ]] || printf 'search %s\n' "${DNS_SEARCH[*]}"
	} | cmd resolvconf -a "$(resolvconf_iface_prefix)$INTERFACE" -m 0 -x
	HAVE_SET_DNS=1
}
 
unset_dns() {
	[[ ${#DNS[@]} -gt 0 ]] || return 0
	cmd resolvconf -d "$(resolvconf_iface_prefix)$INTERFACE" -f
}

wg-quick(8) documents resolvconf -a tun.INTERFACE, yet the script adds tun. only for Debian's resolvconf. Our logs show both shapes: -a wg0 on systemd-resolved and openresolv, -a tun.wg0 on Debian's.

Can WireGuard use DNS?

Yes, through the tools around it rather than the protocol. WireGuard carries DNS packets like any others and never picks a resolver. wg-quick sets one from the DNS = line, and the wg tool looks up a host name in Endpoint once, when it loads the config, leaving the kernel with a plain address.

Whether a changing server address means you need dynamic DNS, and on which end, is answered in our WireGuard port article; the wireguard-tools reresolve-dns script, which repeats the lookup on the client, is meant to run "from cron every thirty seconds or so".

Which server answers with the DNS line, and which without it?

With the line in the config, every test lookup went to the tunnel's server on all three resolver programs, 3 of 3 runs each (the two script-based ones only after we removed Ubuntu's AppArmor profile for wg-quick; under it they never started the tunnel). Without it the tunnel came up all the same, and every lookup stayed with the local network's resolver.

Setup: one Ubuntu 26.04 virtual machine, 2 December 2026, and a split tunnel that routed only 10.9.0.0/24 (not 0.0.0.0/0). Both resolvers answered every name with an address of their own, so an answer names its sender. tcpdump on all interfaces shows the path each query took. lan0 is the test network's link with its resolver at 192.0.2.53; the tunnel's resolver is 10.9.0.1.

SetupWith DNS = 10.9.0.1, after upNo DNS line, after upAfter down
systemd-resolved, as Ubuntu 26.04 ships itTunnel's server, via wg0Local resolver, via lan0Local resolver
systemd-resolved, PostUp recipe instead of the lineTunnel's server, via wg0Local resolver, via lan0Local resolver
openresolv, AppArmor profile removedTunnel's server, via wg0Local resolver, via lan0Local resolver
Debian resolvconf, AppArmor profile removedTunnel's server, via wg0Local resolver, via lan0Local resolver
No resolvconfExit code 127, no tunnelTunnel up, local resolverWith the line: exit code 1, nothing to take down. Without: local resolver
openresolv or Debian under Ubuntu's AppArmor profileExit code 2, no tunnelTunnel up, local resolverWith the line: exit code 1, nothing to take down. Without: local resolver

Without the line, the tunnel's resolver stayed reachable through the tunnel and nothing asked it.

How does each resolvconf turn the line into a setting?

All three programs receive the same arguments and keep them in different places. systemd-resolved turns wg-quick's -x into the catch-all routing domain ~., so any name no other link claims goes to the server on wg0. openresolv leaves only the tunnel's server in the file; Debian's puts it first.

systemd-resolved (Ubuntu 26.04)

  1. DNS = 10.9.0.1
  2. resolvconf -a wg0 -m 0 -x
  3. wg0: server 10.9.0.1, domain ~.
  4. Names no other link claims: to the tunnel

openresolv

  1. DNS = 10.9.0.1
  2. resolvconf -a wg0 -m 0 -x
  3. /etc/resolv.conf: 10.9.0.1 only
  4. Every lookup to the tunnel

Debian resolvconf

  1. DNS = 10.9.0.1
  2. resolvconf -a tun.wg0 -m 0 -x
  3. /etc/resolv.conf: 10.9.0.1, then 192.0.2.53
  4. Tunnel first, local second
One call, three meanings: what each resolvconf made of DNS = 10.9.0.1

Per the resolvectl manual, -x is "mapped to an additional configured search domain of ~.", while -m is silently ignored. Below is resolvectl status from run 1, cut to the two links that matter (the machine's other links are left out).

Link 52 (lan0)
    Current Scopes: DNS
         Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 192.0.2.53
       DNS Servers: 192.0.2.53
     Default Route: yes
 
Link 55 (wg0)
    Current Scopes: DNS
         Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
       DNS Servers: 10.9.0.1
        DNS Domain: ~.
     Default Route: yes

Link lan0 kept its server and was never asked, and /etc/resolv.conf stayed the local stub at 127.0.0.53.

The file-based programs worked differently. With openresolv, -x marks the entry exclusive, so the file named 10.9.0.1 and nothing else. Debian's manual describes no exclusive mode: its file listed 10.9.0.1 first and 192.0.2.53 second, because wg-quick borrows its prefix from the first wildcard line of Debian's /etc/resolvconf/interface-order, here tun*, and that file ranks tun.wg0 ahead of lan0.dhcp.

Our own Linux app showed the same ~. on its tunnel link in the IP leak test run.

Why does one routed subnet send every lookup into the tunnel?

The DNS line is about names and AllowedIPs is about addresses, so they never had to agree. Our config routed just 10.9.0.0/24, yet with the line present every name we looked up on our Ubuntu machine went to the tunnel's server. On a machine set up like ours, a home tunnel with a DNS line sends every name you look up to your home resolver, not only the names of hosts at home.

Three steps explain it. The line chooses the server. ~. gives that server every name. Only then does AllowedIPs decide how packets to the server travel (the other half, covered in the AllowedIPs article). If the tunnel's server falls silent, every name fails, even names for traffic that never enters the tunnel.

Anyone after real split DNS would drop the line and try PostUp = resolvectl dns %i <server>; resolvectl domain %i ~example.internal, so that only one domain goes down the tunnel. We did not run that variant. Our Linux app takes the opposite stance on purpose: it keeps lookups inside the tunnel even with an address range excluded, as the split tunneling measurements show.

Is a PostUp resolvectl recipe better than the DNS line?

On our Ubuntu machine it changed nothing. The recipe popular on troubleshooting pages (resolvectl dns %i ...; resolvectl domain %i ~.) left the same link settings behind and sent lookups the same way as the plain line, in 3 of 3 runs. Reach for PostUp when you want a domain other than ~..

Pro Custodibus suggests the PostUp form for systemd-resolved in its 2023 troubleshooting article, and the ArchWiki gives Domains=~. for systemd-networkd and dns-priority=-1 with ~. for NetworkManager. Those recipes are not wrong. On this machine the two forms came out identical.

One extra we measured: the PostUp form needed no PostDown. Under systemd-resolved the settings belong to the link, so they vanish when it does.

What happens to DNS when a WireGuard tunnel crashes?

That depends on which resolver program you run and how the tunnel died. We deleted the interface without wg-quick down: systemd-resolved lost the tunnel's settings along with the link, while openresolv and Debian's resolvconf kept theirs. openresolv then resolved nothing; Debian's made each glibc lookup wait 5.005 seconds (dig, on its own 2-second timeout, waited 2).

We staged two crashes, three runs each. Crash A deleted the interface by hand with ip link del wg0 after a clean start (we can't say what does that in the wild). Crash B killed wg-quick with SIGKILL while a PostUp hook was running, after the DNS step.

SetupInterface deleted: next lookupThen wg-quick downwg-quick killed mid-start: next lookupThen wg-quick down
systemd-resolved, as Ubuntu 26.04 ships itLocal resolver, answered in about 0.2 msExit code 1, nothing left to cleanTunnel's serverExit code 0, cleaned
systemd-resolved, PostUp recipeSame as the row aboveSame as the row aboveSame as the row aboveSame as the row above
openresolvNo answer; gave up after about 10 sExit code 1, entry staysTunnel's serverExit code 0, cleaned
Debian resolvconfLocal resolver, after 5.005 sExit code 1, entry staysTunnel's serverExit code 0, cleaned

Deleting the interface strands whatever was stored in a file. Figure 1 puts the first lookup after crash A on one time axis.

Deleting the interface cost nothing on systemd-resolved, 5.005 s on Debian's resolvconf and the whole lookup on openresolv.
How we crashed it
Run
2 December 2026, Ubuntu 26.04 virtual machine, 3 runs per cell, crash A and crash B as defined above
Timing
tcpdump timestamps on one machine clock; the lookup uses glibc defaults

Why does a crash leave the DNS entry behind?

Because settings that live in a file outlive the interface, and wg-quick down refuses to clean them up. The script's first act is to check that the interface exists. After crash A it doesn't, so it exits with code 1 before it ever reaches unset_dns.

$ wg-quick down wg0
wg-quick: `wg0' is not a WireGuard interface

Notice what isn't there: no resolvconf -d line. Step by step, the rows of the table follow from six facts:

  1. systemd-resolved attaches DNS settings to the link, so deleting the link deletes them.
  2. openresolv and Debian's resolvconf each keep an entry of their own, which the link knows nothing about.
  3. wg-quick down runs its wg show interfaces guard first (the top of cmd_down), and stops there.
  4. openresolv's entry was exclusive, which left /etc/resolv.conf listing 10.9.0.1 alone, an address the machine could no longer reach. glibc tried it twice, 5.005 s apart, and failed after about 10 s.
  5. Debian's entry was first of two. glibc waited out its 5-second timeout on 10.9.0.1, then asked 192.0.2.53, in each of the three runs.
  6. In crash B nothing could trap the SIGKILL, so the cleanup never ran; interface and entry both stayed, and a later wg-quick down (exit code 0) cleaned them on every setup.

How long does a stale entry delay a lookup?

On Debian's resolvconf, 5.005 seconds for each glibc lookup, in each of our three runs; on openresolv, the lookup fails after about 10. Here is the Debian case on the wire, from tcpdump on one machine's clock with the source address left out (crash A, run 1):

Time (s)WhereWhat
0.000default routegetent sends its query to 10.9.0.1
5.005lan0getent retries against 192.0.2.53
5.005lan0reply carries 203.0.113.99
5.013default routedig starts and queries 10.9.0.1
7.016lan0dig queries 192.0.2.53
7.016lan0reply comes back

The subtraction, shown: the first query left at 1796224688.503998 and the answer arrived at 1796224693.509190, which is 5.005192 s. Runs 2 and 3 gave 5.005287 and 5.005262.

dig with +time=2 +tries=1 gave up on the dead server after 2 s, so its own answer came 2.002 s after its first query (1796224693.517307 to 1796224695.519690; the rounded times in the table differ by 2.003).

Under openresolv the same query went out at 0 s and again at 5.005 s with the same DNS id, drew no reply, and the next step began at 10.018 s. That matches the defaults in resolv.conf(5): a 5-second timeout and two attempts.

The capture also shows a leak, on this machine only. After crash A, under both openresolv and Debian's resolvconf, the lookup went out over the default route in plain DNS, aimed at a server that lived only inside the vanished tunnel. (What a DNS leak test lists is another article's job.)

To remove a stale entry, run what wg-quick's own down would have run: resolvconf -d wg0 -f on openresolv, resolvconf -d tun.wg0 -f on Debian's. We did not run these by hand. The safer habit is to stop tunnels with wg-quick down and never with ip link del.

Why does wg-quick stop at the DNS line and delete the tunnel?

wg-quick treats a failed resolvconf call as fatal, and its error trap deletes the interface it has just created. We met two causes: no resolvconf on the machine at all (exit code 127), and, on Ubuntu 26.04, a script-based resolvconf that wg-quick's AppArmor profile lets start but not finish (exit code 2).

The raw output for the first, a machine with no resolvconf:

[#] ip link add dev wg0 type wireguard
[#] wg setconf wg0 /dev/fd/63
[#] ip -4 address add 10.9.0.2/24 dev wg0
[#] ip link set mtu 1420 up dev wg0
[#] resolvconf -a wg0 -m 0 -x
/usr/bin/wg-quick: line 32: resolvconf: command not found
[#] ip link delete dev wg0

And openresolv under the profile, from the failing line on:

[#] resolvconf -a wg0 -m 0 -x
/usr/sbin/resolvconf: 75: .: cannot open /etc/resolvconf.conf: Permission denied
[#] ip link delete dev wg0

One step after resolvconf failed, the interface was gone again: the script runs under set -e with trap 'del_if; exit' INT TERM EXIT. All 3 runs agreed, and the missing-resolvconf case behaved the same with and without the profile. wg-quick(8), which we read on 2 December 2026, says nothing about a missing resolvconf.

Fix it by deleting the line or installing whichever resolvconf your distribution packages. Ubuntu 26.04's archive carries neither openresolv nor Debian's resolvconf (apt-cache policy prints Candidate: (none)); the command ships with systemd-resolved. For these rows we took both packages from Debian. On Ubuntu 22.04 that error is the default: the systemd package there ships resolvectl but no resolvconf command (its file list), and the archive's universe component carries Debian's resolvconf and openresolv instead.

What does Ubuntu 26.04's AppArmor profile let wg-quick run?

A short list of programs and two calls to systemd-resolved, which is not enough for a script-based resolvconf. Canonical wrote that profile, and it enforces. Its allowlist names resolvectl, resolvconf and the iptables binary, then wg, ip, nft and sysctl, a few coreutils, and exactly two D-Bus calls to systemd-resolved:

file mrix /usr/bin/resolvectl,
file mrix /usr/sbin/resolvconf,
dbus (send) ... member="SetLink{DNSEx,Domains}"

That lets resolvconf start, but the scripts behind it then fail on their own files, and hooks fail on anything outside the list:

  • openresolv could not open /etc/resolvconf.conf.
  • Debian's could not create its lock file under /run/resolvconf/, and wg-quick itself was refused a read of /etc/resolvconf/interface-order.
  • A hook that ran sleep or id was denied as well (the kernel log shows four exec denials: three for sleep, one for id).

Each sleep denial is followed about 1.6 ms later by a denied RevertLink call to systemd-resolved. That fits wg-quick's error cleanup asking resolved to drop the link's DNS just before it deletes the link; we did not trace it further. The profile's sysctl rule permits a write to one key only, net.ipv4.conf.all.src_valid_mark. That is why the handshake article records the same profile stopping an ip_forward write in PostUp.

How do you check what your WireGuard DNS line set?

Read the resolver program's own record of what it set, then capture port 53 on every interface while you look up a name no one has used before.

  1. Identify the program behind resolvconf with readlink -f "$(command -v resolvconf)"; a result ending in resolvectl is systemd-resolved. Otherwise, dpkg -S on that path names the package on Debian and Ubuntu. If it prints nothing, there is no resolvconf, and wg-quick will refuse any config with a DNS line (exit code 127).
  2. Read what it stored. systemd-resolved: resolvectl status, then find the tunnel link's server and ~.. The others: cat /etc/resolv.conf, plus resolvconf -l on openresolv or Debian's.
  3. Open a terminal and run sudo tcpdump -ni any port 53.
  4. In another, run getent ahostsv4 <unique-name> (what applications use) and dig <unique-name>.
  5. Read the interface column of the capture.
  6. After any crash, read the state again. An entry whose interface is gone is the stale one.

getent and dig keep different clocks. In the Debian crash getent waited 5.005 s on the dead server, and dig +time=2 waited 2 s.

Programs with their own resolver can differ again, and a browser with secure DNS skips all of this (which resolver answers is in that article). If the tunnel is up and names fail while addresses work, the handshake article has the check. ForestVPN users who set a custom DNS can start at our help page.

How can a VPN's DNS server be silent while the tunnel looks fine?

Because something past the tunnel's far end throws the query away, and the tunnel's counters record the query arriving, never the drop. Around 4 and 5 September 2026, one of our exit servers had nothing answering at the DNS address our apps use inside the tunnel. Names failed, yet handshakes, packet counters and the server's status all read healthy.

The sequence, from our commit history and the comments in our exit package's firewall file:

  1. Our address plan of 2 September held 100.64.0.53 back for a resolver, with the caveat "if an exit runs one".
  2. From 4 September, the configuration our control plane gives a device names a single DNS server, 100.64.0.53.
  3. Nothing on the exit listened there. A query was decrypted, routed back out through the tunnel interface, and dropped by the policy drop default of the firewall's forward chain.
  4. Run on the exit, dig @100.64.0.53 reported that no servers could be reached. Meanwhile fv show, our server's status command, listed the tunnel as handshaked, the client's queries arriving and decrypting fine.
  5. A phone connected through that exit saw one page request hang for the entire session; it finished 0.2 s after teardown, when lookups dropped back to the Wi-Fi's resolver.

Our old test for that address never went red. It asserted that we hand out 100.64.0.53, and we do.

4 September, before the rule

  1. Device asks 100.64.0.53
  2. Decrypted at the exit
  3. No listener; routed back to the tunnel interface
  4. Dropped by the forward chain

With the rule

  1. Device asks 100.64.0.53
  2. Decrypted at the exit
  3. Rewritten to a public resolver
  4. Answer returns as 100.64.0.53
One missing rule: the same query, without and with it

Where we lost

We lost twice. One firewall rule was the whole promise, no client or tunnel code knew it existed, and it was missing.

Then the code that picks the status the app shows read this session as Working. When no data had arrived at all and sending had been quiet for between 5 and 120 seconds, the code fell through to the answer "data is flowing in both directions".

The fix's commit message is blunt: "The more thoroughly a connection failed, the more confidently we called it healthy." The firewall rule was committed on 4 September and the verdict fix on 5 September (UTC). The rule ships in our exit package; the verdict code is in the core our published apps share.

Where this comes from
Sources
Our own commit history and the comments in our exit package’s firewall file, read on 2 December 2026
Not known
How long the address was silent in production and how many sessions met it

How do you make a VPN's DNS address answer without running a resolver?

With one nftables DNAT rule: queries to the address are rewritten to a real resolver, and conntrack rewrites each reply back, so the device only ever sees the address it was given. That is how we fixed our exits: the rule sits in our exit package's firewall, which has carried it since 4 September 2026 (UTC), and it rewrites queries for 100.64.0.53 to a public resolver.

iifname "fvpn*" ip daddr 100.64.0.53 meta l4proto { tcp, udp } th dport 53 dnat to <upstream>

The upstream resolver's address is left out of that line. Handing a VPN client a DNS address makes a promise, and a healthy handshake does not show that anything honours it.

  1. Address plan reserves 100.64.0.53

    For a resolver, if an exit runs one.

  2. Control plane hands it to devices

    As the only DNS server.

  3. 21:45 The DNAT rule is committed

    The measurement is recorded in its comment.

  4. 04:24 The test that proves an answer comes back
  5. 08:35 Verdict fix
  6. Test asserts probe, then fault

    23:33 and 23:52.

  7. Rerun for this article

    Both modes as expected.

How do you test that a VPN's DNS server really answers?

Send a real DNS query through the real tunnel to that address and require an answer, and keep a control run that must get none. Our test does both behind the firewall rules we ship, with a control that deletes just the DNS rule and black-holes the address, so it stays silent as it did in production instead of drawing an ICMP error; on 2 December 2026 the shipped rules resolved a name and the control got nothing.

The setup uses Linux network namespaces, our client and exit binaries, and the exit's firewall file loaded unmodified. The upstream is a stand-in inside the test, so no real resolver was touched. The test runs in our network-fault suite on every full pass. This is its output, trimmed and with each counter group joined onto one line:

The same test, with and without the rule

Control: DNS rule removed

dns_resolver: loaded nftables.conf with the DNS DNAT rule stripped (reconstructing the bug)
dns_resolver: tunnel established, datapath healthy (mode=broken)
dns_resolver: mode=broken query result: no-answer
  resolving (in flight)   tx_packets=10 rx_packets=1 rx_data_packets=0
      state=Idle  liveness_probe_warranted=true
  resolving (8s backoff)  tx_packets=14 rx_packets=3 rx_data_packets=0
      state=Idle  liveness_probe_warranted=true
liveness_probe (dead resolver): tx_probes=1 rx_probes=0
  backoff + unanswered probe
      state=BlockedAfterHandshake confidence=Confirmed may_switch=true

Packaged rules

dns_resolver: loaded the real, shipped nftables.conf
dns_resolver: tunnel established, datapath healthy (mode=fixed)
dns_resolver: mode=fixed query result: 192.0.2.10
  resolving (in flight)   rx_data_packets=7 rx_data_wire_bytes=763
      state=Working
  resolving (8s backoff)
      state=Idle  liveness_probe_warranted=false
      because=no data either way: the application is quiet, which is not a fault
How we ran it
Run
2 December 2026, both modes, against the packaged firewall file
Upstream
A stand-in inside the test; we show its answer as the documentation address 192.0.2.10

Compare the tabs. In the control the tunnel kept exchanging packets (1 received, then 3) and only the data counter sat at 0. Counters could not call that a fault; the verdict's own reason reads "only a liveness probe can separate a quiet application from a path that has stopped carrying". A liveness probe, which is itself a DNS query through the tunnel, made it a confirmed fault.

Eight seconds of quiet therefore mean opposite things in the two tabs. Our test has asserted that probe step since 9 November. What our app shows in that state today is in the connected-but-no-internet article.

Why forward a VPN's DNS address instead of running a resolver on the server?

Forwarding is the smallest change that makes the address answer: no new process, no address to assign and no start-up race with the tunnel, which is why our exits do it. A resolver on each exit stays our upgrade path, and devices would need no config change for it.

Two other options were ruled out:

  • The hosting provider's own resolver as upstream, ruled out in the rule's comment: it would add one more clue pointing at that hoster for every site a client visits.
  • Sending your lookups through the resolver our apps use for our own service names. Our DNS design record, written nine days later, rules that out because that resolver asks on the local network: "it would leak".

What do these runs mean for your own WireGuard setup?

Four checks, in the order we would run them.

  1. Work out which program answers to resolvconf before you trust a recipe: the DNS line is only a request to it.
  2. Stop tunnels with wg-quick down; deleting the interface leaves its entry behind under openresolv and Debian's resolvconf.
  3. A split tunnel plus a DNS line is not split DNS on systemd-resolved: on our machine every name we looked up went to the tunnel's server.
  4. Test the answer rather than the config: resolve a name along the real path, and keep a control that has to fail.

What don't we know yet?

  • Links managed by NetworkManager or systemd-networkd. According to the manual, a narrower routing domain on another link (say, a Wi-Fi link's search domain) outranks ~.. Our management link had one and we never looked up a name inside it.
  • A full tunnel. Our config covered a single subnet; with AllowedIPs = 0.0.0.0/0, wg-quick's separate routing table decides how packets to each resolver travel, and we did not run it.
  • What happens when the DNS server sits outside AllowedIPs with the tunnel up. We saw only the crash case, where the query took the default route.
  • IPv6 lookups and IPv6 resolver addresses. We asked for A records over IPv4 only.
  • Other distributions out of the box, PostDown variants, and the split-DNS recipe from earlier.
  • The Windows, macOS, iPhone and Android apps, and wg-quick's macOS and BSD scripts. On Android, Private DNS can decide which resolver answers while a VPN is on.
  • How long the incident lasted and how many sessions it reached. Our records hold one exit, one phone and commit times, not deploy times.
  • An exit that replies with ICMP errors instead of staying silent would leave every passive counter looking healthy; our test reproduces silence only.

Questions and answers

Can I put a hostname in the WireGuard DNS line?

Not as a server. wg-quick treats any value that is not an IP address as a search domain. If the line holds only names, wg-quick skips resolvconf and sets nothing at all; beside an address, a name is added as a search domain. That is from the wireguard-tools source; our runs used one address.

Can the WireGuard DNS line list two servers or an IPv6 server?

Yes. The wg-quick manual allows a comma-separated list of IPv4 and IPv6 addresses, and wg-quick writes one nameserver line per address. Whether a second server is ever asked is up to the resolver program and its timeouts; our runs used a single IPv4 server.

Does the DNS line work the same in the WireGuard apps for Windows, macOS, iPhone or Android?

Not through this mechanism. This post covers wg-quick on Linux. wireguard-tools ships separate wg-quick scripts for macOS, FreeBSD and OpenBSD, and the graphical apps handle the line in their own code. We tested none of them.

Is it a DNS leak if my WireGuard config has no DNS line?

It can be. Without the line, wg-quick leaves the system’s resolver as it was, so lookups go wherever they went before the tunnel. In our split-tunnel runs they went to the local network’s resolver, outside the tunnel, in 3 of 3 runs. Add the line, or set the tunnel’s server another way.

Sources

  1. wireguard-tools: wg-quick/linux.bash (source of wg-quick on Linux) (read December 2, 2026)
  2. wg-quick(8): the DNS key and PostUp (read December 2, 2026)
  3. wg(8): Endpoint and endpoint resolution (read December 2, 2026)
  4. wireguard-tools: reresolve-dns README (read December 2, 2026)
  5. resolvectl(1): resolvconf compatibility mode (read December 2, 2026)
  6. systemd-resolved.service(8): routing domains (read December 2, 2026)
  7. openresolv: resolvconf(8) (read December 2, 2026)
  8. Debian resolvconf: resolvconf(8) (read December 2, 2026)
  9. resolv.conf(5): timeout and attempts (read December 2, 2026)
  10. Pro Custodibus: Troubleshooting WireGuard DNS Issues (2023-09-12, their advice) (read December 2, 2026)
  11. Ubuntu packages: file list of systemd in 22.04 (jammy) (read December 2, 2026)
  12. ArchWiki: WireGuard (their advice) (read December 2, 2026)

How this was made

AI-assisted drafting from our own test runs of 2 December 2026 on a Linux virtual machine and from our engineering records of September and November 2026, checked against the raw captures, logs and code, with automated and editorial review.

All posts

Back to top

Ask us anything