A DNSDNS The internet’s phone book. It turns a name people can remember, like example.com, into the number address computers use to find the server. More about DNS → leak test shows which DNS resolver really answers your computer’s lookups, so you can tell whether they go where you intended (usually through a VPN or a company network) or slip out to your internet provider instead. This guide is for anyone using a VPN, a work tunnel or a custom DNS setting who wants to check it with their own eyes, on Windows, macOS or Linux.
A DNS leak happens when your device sends DNS questions to a resolver outside the tunnel or setting you chose, usually your internet provider’s. To test, connect your VPN and run **dig +short TXT o-o.myaddr.l.google.com** (or Resolve-DnsName -Type TXT o-o.myaddr.l.google.com on Windows): the address it returns is the resolver that asked on your behalf. If that address belongs to your internet provider rather than your VPN or chosen DNS service, you have a leak.
What a DNS leak is
Every time you open a website, your device first asks a DNS resolver to turn the name (such as example.com) into an IP addressIP address The number address of a device on the internet, like 203.0.113.10. Computers use it to find each other, the way post uses street addresses. More about IP address →. Whoever runs that resolver sees every name you look up, even when the page itself is loaded over HTTPS.
When you connect to a VPN, the VPN software normally tells your device to send those questions through the tunnel to a resolver the VPN chooses. A DNS leak is when some or all of the questions still go somewhere else, most often to the resolver your router or internet provider handed out before the VPN started.
The pages still load, so nothing looks wrong. That is why you need a test: the only symptom is that a party you meant to avoid can still see the names you visit.
Why it matters
- Privacy: your internet provider (or the café Wi-Fi) can log the sites you visit, which is often the exact thing the VPN was meant to prevent.
- Wrong answers: a work VPN may rely on its own resolver for internal names such as intranet.example.com. If queries leak, those names fail to resolve or resolve to the wrong place.
- Filtering: if you set a filtering resolver for your family or office, a leak quietly bypasses it.
How a DNS leak test works
Your browser never tells a website which resolver it uses, so a test has to be cleverer. It asks your device to look up a special name on a nameserverNameserver The server that holds all of a domain’s settings. Whoever runs your nameservers controls where your website and email point. More about Nameserver → run by the tester. When the question arrives, that nameserver does not see your address. It sees the address of the resolver that forwarded the question. It writes that address into the answer and sends it back.
So the answer tells you, from the outside, which resolver really did the work. Online DNS leak test pages do the same thing in your browser: they make your browser look up several random names, then list every resolver address that asked for them, usually with the owner of each address.
You can run the same check from a terminal, with no website involved. Google’s nameservers answer a TXT lookup for o-o.myaddr.l.google.com with the address of the resolver that asked, and Akamai’s answer the same idea for whoami.ds.akahelp.net.
Large resolvers send queries from many different addresses, so you may see a different address each time you run a test. What matters is who owns the address, not the exact number.
How to run a DNS leak test
Do the test twice: once with the VPN off, to see what normal looks like, and once with it on.
1. Note your normal resolver
With the VPN disconnected, run the test command for your system.
On macOS and Linux (dig is in the dnsutils package on Ubuntu and Debian, and bind-utils on AlmaLinux and Rocky):
dig +short TXT o-o.myaddr.l.google.com
dig +short TXT whoami.ds.akahelp.net
On Windows, in PowerShell:
Resolve-DnsName -Type TXT o-o.myaddr.l.google.com
Resolve-DnsName -Type TXT whoami.ds.akahelp.net
The Google answer looks something like this:
"198.51.100.25"
If your resolver passes on part of your own address (a feature called EDNS Client Subnet), you may see a second line starting edns0-client-subnet followed by a range such as 203.0.113.0/24. That range is your own network, not the resolver. The Akamai answer has two parts, "ns" and the resolver address.
Write the resolver address down. This is your internet provider’s resolver, or whichever one your router uses.
2. Find out who owns the address
Look the address up with whois, which is built into macOS and most Linux systems:
whois 198.51.100.25
Read the OrgName, org-name or descr lines. You are looking for a recognisable owner: your broadband provider, a public DNS service, or your VPN service. An online IP lookup tool shows the same owner information if you do not have whois.
3. Connect the VPN and test again
Connect the VPN, wait a few seconds, then run exactly the same commands. Look up the owner of every address you get.
| What you see with the VPN on | What it means |
|---|---|
| Addresses owned by your VPN service or the resolver it says it uses | No leak. DNS goes through the tunnel. |
| The same provider addresses as in step 1 | Full leak. DNS is not using the tunnel at all. |
| A mix of both | Partial leak. Some queries go through the tunnel and some do not. |
| A public resolver you set yourself, such as in your browser | Not the VPN’s resolver, but chosen by you. See the browser section below. |
Run the test three or four times. Partial leaks often only show up on some runs.
4. Check your system’s DNS settings
The test tells you whether there is a leak. Your settings tell you why. Each system can list the resolvers it is configured to use.
On Linux systems that use systemd-resolved (Ubuntu and most current desktops):
resolvectl status
On macOS:
scutil --dns
On Windows, in PowerShell:
Get-DnsClientServerAddress
Look at which network interface each resolver is attached to. A healthy VPN setup shows the VPN’s resolver on the tunnel interface (often named tun0, wg0 or after the VPN). A leak usually shows the router or provider resolver still listed on the Wi-Fi or Ethernet interface, and still being used.
Why DNS leaks happen
| Cause | What is going on |
|---|---|
| The VPN does not set DNS | Some setups (especially hand-written configurations) carry traffic but never change the resolver, so the old one stays in use. |
| Windows asks every adapter | Windows can send the same question to the DNS servers of all network adapters at once and use the fastest answer. The query to your normal adapter leaks. |
| IPv6 is not tunnelled | If the VPN only handles IPv4, your device may still reach an IPv6 resolver on your home network directly. |
| Browser secure DNS | Firefox and Chrome can send lookups straight to their own DNS over HTTPS resolver, skipping the system setting entirely. |
| Linux routing domains | With systemd-resolved, if the VPN interface is not set as the default route for DNS, other names still go to the Wi-Fi interface’s resolver. |
| A stale cache | Answers fetched before the VPN connected can be reused until their TTL runs out. This is not a leak of new queries, but it can confuse a test. |
How to fix a DNS leak
Work through these in order and test again after each one.
- Use the VPN’s own DNS protection. Most VPN apps have a setting named something like DNS leak protection or use VPN DNS only. Turn it on, reconnect, and test again. For a hand-written WireGuard configuration, add a
DNS =line to the[Interface]section so the resolver changes when the tunnel comes up. - Clear old answers. Flush your DNS cache and restart the browser so you are testing fresh lookups.
- Check the browser. In Firefox, the DNS over HTTPSHTTPS The secure version of the web, shown by the padlock. Everything sent between you and the site is scrambled so nobody in between can read or change it. More about HTTPS → setting is under Settings, Privacy & Security. In Chrome, it is Use secure DNS under Settings, Privacy and security, Security. Either set it to use your system’s resolver while the VPN is on, or choose the resolver you deliberately want and accept that the browser will use it.
- Handle IPv6. If the test or
resolvectl statusshows an IPv6 resolver outside the tunnel, turn on the VPN’s IPv6 support or IPv6 leak protection. Turning IPv6 off on the adapter works as a last resort but can break other things on your network. - On Windows, stop the parallel queries. On Pro and higher editions, open the Group Policy Editor and go to Computer Configuration, Administrative Templates, Network, DNS Client. Set Turn off smart multi-homed name resolution to Enabled, then restart. Test again: some VPN clients need their own fix as well.
- On Linux, make the tunnel the default for DNS. With systemd-resolved, the special routing domain
~.on an interface tells it to send all names there. A well-behaved VPN client sets this itself. To test the idea by hand (the setting lasts until the interface restarts):
sudo resolvectl dns wg0 198.51.100.53
sudo resolvectl domain wg0 "~."
Replace wg0 with your tunnel interface and the address with your VPN’s resolver. Then check resolvectl status and run the leak test again. If this fixes it, make the change permanent in your VPN or NetworkManager settings rather than by hand.
If you are on a company VPN, talk to your IT team before changing DNS settings. Internal names often only work through the company resolver, and some leaks are actually deliberate split DNS, where only internal names go through the tunnel by design.
Common problems
| Symptom | Cause | Fix |
|---|---|---|
dig: command not found | dig is not installed | Install dnsutils (Ubuntu, Debian) or bind-utils (AlmaLinux, Rocky), or use nslookup -type=txt o-o.myaddr.l.google.com instead |
| A different address every run | The resolver uses a large pool of addresses | Normal. Check the owner of each address rather than the number |
| Test shows your VPN, but the online test page shows your provider | Browser secure DNS or a browser extension is resolving names itself | Check the browser DNS setting and test in a private window with extensions off |
| Internal company names stop working after a fix | You forced all DNS through a resolver that does not know internal names | Undo the change and ask IT how split DNS is meant to work |
| Leak only appears after waking from sleep | The VPN reconnected without reapplying its DNS settings | Disconnect and reconnect, then report it to the VPN client’s support |
Official documentation
Related
- How DNS works: what a resolver does and why it sees every name you look up.
- DNS lookup: how to check any domain’s DNS records: more on dig, nslookup and Resolve-DnsName.
- How to flush your DNS cache: clear old answers before you test again.
- The proxy requires a username and password: another setting that can route your traffic somewhere you did not expect.
Something out of date? Software changes. If a step no longer works, tell us and we will check it and update the page.



