Networking and developer tooling notes
Concepts
5 min read

DNS Leaks Explained: What They Are and How to Test for One

A DNS leak is when your device sends DNS queries to a resolver outside your VPN or proxy tunnel while the rest of your traffic goes through it. Test it with dig, nslookup or tcpdump, and fix it by making lookups follow the same path as connections.

Editorial team

A DNS leak happens when your device sends its DNS queries to a resolver outside your VPN or proxy while the rest of the traffic goes through it. The sites you visit still see the tunnel's IP, but the resolver, often your ISP's or your router's, can see which names you look up. You can test for it in a few minutes with dig, nslookup or a packet capture. This article reflects the state of things as of November 2026.

What exactly is a DNS leak?

Almost every connection by hostname starts with a DNS lookup that turns a name into an IP address. A leak is when that lookup travels outside the tunnel to a resolver you did not intend to use, while the connection itself goes through the tunnel. The resolver learns which domain names you request, but not the page content, which HTTPS still protects.

It helps to separate three things people lump together as leaks: a DNS leak (name lookups escape), an IP leak (the destination sees your real address, for example over IPv6 or WebRTC), and a plain disconnect (nothing is tunneled at all). This article is about the first one. For the second, see how to check what IP and location a website sees.

Why do DNS leaks happen?

Most leaks come from a mismatch between where an application's connection goes and where the operating system sends its lookups. The tunnel carries the connection, but the lookup is made by a different component that never heard about the tunnel. These are the usual causes:

  • Proxy settings that not everything honors. A system proxy is a request that applications may follow or ignore, and the OS resolver is not an application that follows it. TUN mode vs system proxy explains what each approach actually captures.
  • Local resolution before SOCKS5. With a socks5:// URL, curl and many other tools resolve the hostname on your machine and send only the IP to the proxy. The socks5h:// form hands the hostname to the proxy instead.
  • Split routing. If a rule sends a domain direct, its lookup usually goes direct too, and lookups can happen before any rule is evaluated.
  • Multiple network adapters. Some Windows versions can query the DNS servers of several adapters and use whichever answers first, so a lookup may leave through the physical adapter even with the VPN adapter up.
  • Browser secure DNS. Chrome, Edge and Firefox can send lookups with DNS over HTTPS (DoH) to a provider chosen in the browser settings, independent of the OS resolver.
  • IPv6. A router can advertise an IPv6 DNS server that the tunnel does not cover.
  • Reconnects. During a short tunnel drop, queries go out over the normal path.

How do I test for a DNS leak?

Ask the network which resolver is actually contacting authoritative servers on your behalf, once with the tunnel off and once with it on. If the resolver address belongs to your ISP or router while the tunnel is up, lookups are escaping. Here are three methods, from quickest to most conclusive.

1. Ask a DNS server who is asking

dig +short whoami.akamai.net
nslookup whoami.akamai.net

The name whoami.akamai.net answers with the address of the recursive resolver that reached Akamai's authoritative server, which is exactly the address a leak exposes. Run it with the tunnel off and note the result, then run it again with the tunnel on. If the address is unchanged and belongs to your ISP, lookups are not using the tunnel. Flush the local cache first if a result looks stale (ipconfig /flushdns on Windows, resolvectl flush-caches on Linux with systemd-resolved). Web-based leak test pages work on the same idea: they make your browser resolve unique random names and show which resolvers asked.

2. Check which resolvers are configured

resolvectl status      # Linux with systemd-resolved
scutil --dns           # macOS
ipconfig /all          # Windows

Look at which DNS servers are attached to which adapter. A physical adapter that still lists your router with higher priority than the tunnel adapter is a strong hint.

3. Watch port 53 on the physical interface

sudo tcpdump -n -i eth0 'udp port 53 or tcp port 53'

Replace eth0 with your physical interface (ip link lists them), then run dig example.com in another terminal. Plain-text DNS leaving the physical interface while the tunnel is up is a definitive leak. Tunnel traffic itself shows up as encrypted packets to the server, not as port 53. Encrypted DNS (DoH on port 443, DNS over TLS on port 853) will not show here, so check browser settings separately.

How do I fix a DNS leak?

Make the lookup travel the same way as the connection. The right fix depends on the cause, and a TUN-mode client or a hostname-forwarding proxy setting covers most cases. This table maps each cause above to a fix.

CauseFix
OS resolver bypasses the system proxyUse TUN mode so port 53 traffic from the OS enters the virtual adapter, then re-run the tests.
Local resolution with socks5://Use socks5h:// in curl, or enable "Proxy DNS when using SOCKS v5" in Firefox.
Browser DoH to an unrelated providerTurn off Secure DNS in the browser or choose a resolver that matches your setup.
Several adapters on WindowsSet DNS on the tunnel adapter and review the Group Policy "Turn off smart multi-homed name resolution".
IPv6 not covered by the tunnelConfirm whether your tunnel carries IPv6; as a test, disable IPv6 on the physical adapter and re-run.
Gaps during reconnectsUse your client's option to block traffic while the tunnel is down, if it has one.

For proxies, the difference is easy to see with curl:

curl -x socks5://user:password@proxy.example.com:1080 https://example.com
curl -x socks5h://user:password@proxy.example.com:1080 https://example.com

The first command resolves example.com locally and sends the proxy an IP. The second sends the proxy the hostname, so the proxy resolves it. An HTTP proxy always receives the hostname in its CONNECT request, so the proxy resolves it there. Differences between the two protocols are covered in HTTP vs SOCKS5 proxies.

Is every DNS leak a problem?

Not equally. The resolver sees domain names, and an ISP resolver may log them or rewrite answers. A resolver in the wrong region can also hand you a CDN node that is far from the tunnel's location. If the resolver is a public one you chose on purpose, the impact is small. Decide based on who the resolver is, not on the word "leak".

Where AnboVPN fits

AnboVPN's official clients support TUN mode, which takes over device traffic through a virtual adapter and is the setup best suited to keeping the operating system's own lookups on the same path as your apps. The clients also support app-level smart routing, so remember that anything you route direct will resolve direct as well. If you use the HTTP/SOCKS5 proxy connection with your own tools, use socks5h:// or an equivalent proxy-DNS option. Whichever mode you choose, run the tests above once to see what your own setup does. Clients are on the download page.

References

DNS
DNS leak
TUN mode
SOCKS5
Troubleshooting

FAQ

Can a DNS leak reveal my real IP address to websites?
Not directly. Websites see the IP of the connection, which still goes through the tunnel. A DNS leak exposes the domain names you look up to the resolver, which is often your ISP or router. The two problems are separate, so test them separately: check the resolver with a DNS test, and check the IP a site sees with an IP lookup page.
Does HTTPS protect me from DNS leaks?
HTTPS encrypts page content and URLs after the connection is made, but the DNS lookup before it is a separate plain-text exchange unless DoH or DNS over TLS is used. A resolver can still see the hostname you asked for. So HTTPS reduces what leaks but does not stop the lookup from leaving the tunnel.
Is using a public resolver such as 1.1.1.1 or 8.8.8.8 a DNS leak?
Not by itself. A leak means lookups bypass the path you intended. If you chose a public resolver and its queries go through the tunnel, that is a deliberate configuration. If you chose it but the queries leave through your physical adapter, your ISP can still see that traffic, so run the port 53 capture to find out which case you have.
Why does the test show my ISP even though the VPN is connected?
The usual reasons are an app or the OS resolver not following the tunnel (a system proxy only affects apps that honor it), a browser using its own secure DNS setting, a second network adapter answering first, or IPv6 DNS outside the tunnel. Switch to a TUN-mode setup, then re-run the whoami and tcpdump checks to find which one applies.

Related posts

Getting Started

How Much VPN Data Do You Need? A Practical Way to Estimate It

Measure what your devices actually transfer in a normal week, convert video bitrate with GB per hour = Mbps x 0.45, then add a margin of 15 to 20 percent. Only traffic routed through the VPN counts, so routing choices matter as much as habits.

Data plan
Traffic estimate
Bitrate
Troubleshooting

Why Does My VPN Keep Disconnecting? A Troubleshooting Checklist

VPN drops almost always trace back to a short list: the network underneath changing or going idle, a NAT or firewall closing the flow, an MTU mismatch, power saving, conflicting software, or an exhausted account. Test them in that order.

VPN troubleshooting
NAT timeout
MTU
Troubleshooting

How to Read traceroute and mtr Reports: Loss, Latency, Hops

traceroute and mtr list the routers between you and a destination using packets with increasing TTL. Trust only loss that continues to the last hop and latency jumps that stay high from one hop onward. Loss on a single middle hop is usually ICMP rate limiting.

traceroute
mtr
Packet loss
Concepts

Split Tunneling and Smart Routing: Send Only Some Traffic via VPN

Split tunneling sends only selected traffic, by app, address or domain, through the VPN or proxy and lets the rest use your normal connection. It keeps local devices and bulk downloads off the tunnel, but you must verify what each side really does.

Split tunneling
Smart routing
Routing table