Before your computer connects to example.org, it has to ask a resolver for the IP address. That question goes out in plain text by default, usually to your ISP. So even with a VPN or proxy carrying your actual traffic, the resolver can end up with a neat, timestamped list of every domain you looked up. That's a DNS leak: the tunnel is fine, but the lookups slipped out beside it.

How leaks actually happen

The common causes are mundane.

The operating system ignores the VPN's resolver. Windows has a feature called Smart Multi-Homed Name Resolution that sends DNS queries out on every network adapter at once and uses whichever answers first. With a VPN up, that means one copy goes through the tunnel and one goes straight to your ISP. Good VPN clients block this; some don't.

IPv6 is another one. A VPN that only tunnels IPv4 leaves IPv6 lookups and connections going out over your normal connection if your ISP gives you an IPv6 address.

Then there's the client reconnecting. When the VPN drops and reconnects, there can be a few seconds where the system falls back to the router's DNS. Without a kill switch, anything that happens in that window leaks.

Finally, applications doing their own thing. Browsers with DNS over HTTPS turned on send lookups to their chosen provider regardless of the system setting. That can help or hurt depending on the situation, which I'll come back to.

Testing for a leak

The test sites work by making your browser look up a set of random, unique subdomains under a domain they control. Their authoritative nameserver then sees which resolvers asked for those names and reports them back to you. If any of the resolvers belong to your ISP while the VPN is on, you're leaking.

Useful sites: dnsleaktest.com (use "Extended test", not "Standard"), ipleak.net, and browserleaks.com/dns. Do it like this:

  1. With the VPN off, run the extended test and note which resolvers and ISP names appear. That's your baseline.
  2. Connect the VPN and run it again. You should see only the VPN provider's resolvers, or a public resolver the VPN uses, and none of the baseline names.
  3. Test IPv6 separately. ipleak.net shows your IPv6 address if you have one.
  4. Repeat after the VPN reconnects, and after your laptop wakes from sleep. Leaks love transitions.

Browser-based tests only check the browser. To test the system resolver from a terminal, look up a unique name and watch your interface with tcpdump while the VPN is up:

sudo tcpdump -ni en0 port 53
# in another terminal
dig leaktest-$(date +%s).example.com

Replace en0 with your physical interface (eth0, wlan0, or whatever ip link shows). If you see the query on the physical interface rather than only on the tunnel, it's leaking. Note that this catches classic port 53 DNS only, not DoH, which looks like ordinary HTTPS.

Tor and DNS

Tor Browser doesn't resolve names locally. It hands the hostname to the Tor client over SOCKS5, and the exit relay does the lookup. Your ISP never sees the name. Onion addresses can't be resolved by DNS at all, so they never leave Tor.

Problems start when you route other software through Tor. Plenty of programs resolve the hostname themselves and then pass only the IP to the proxy. With curl, for example, these two lines behave differently:

curl --socks5 127.0.0.1:9050 https://example.org/            # resolves locally: leaks
curl --socks5-hostname 127.0.0.1:9050 https://example.org/   # Tor resolves it

The same distinction appears as socks5:// versus socks5h:// in proxy URLs used by Python requests and many other tools. The "h" means the hostname is sent to the proxy. Wrappers like torsocks intercept the resolver calls for you, which is why they exist; our piece on torsocks and proxychains goes through the details. Tails and Whonix solve it at the system level by blocking all non-Tor traffic, which is the safest approach if this matters to you.

DNS over HTTPS: fix or new problem?

DNS over HTTPS (DoH) and DNS over TLS encrypt the lookups, so your ISP can't read them on the wire. In Firefox it's under Settings, Privacy & Security, "DNS over HTTPS", with options for Default, Increased and Max Protection. Android has "Private DNS" in network settings, which uses DNS over TLS.

That solves eavesdropping by the local network. It doesn't hide your lookups from the DoH provider, who now sees everything instead of your ISP. And with a VPN running, a browser using DoH to a third party bypasses the VPN's resolver, which some VPN leak tests will flag as a leak even though the queries are encrypted. Whether that's a problem depends on who you trust more: the VPN, the DoH provider, or neither. For real anonymity, Tor is still the cleaner answer because no single party sees both who you are and what you looked up.

A last practical point: a "no leak" result on Tuesday says nothing about Wednesday's OS update. If you depend on a VPN for anything sensitive, rerun the extended test now and then, especially after updates or switching networks. WebRTC leaks are the other half of the same checkup.

#dns-leaks #vpn #tor #dns-over-https