At a glance

This guide is for cases where websites load through a proxy but DNS tests still show your local ISP. Start by comparing direct and proxied results on the same test page. Then check the three possible DNS paths: browser Secure DNS, Windows system resolution, and the proxy core's DNS. Finally, verify TUN capture, remote DNS routing, and traffic sniffing. Focus on the actual query path, not the country shown on the test page.

1. How to Identify a DNS Leak: Separate DNS Queries from Connections

DNS translates domain names into IP addresses. Routing web connections through a proxy does not mean the preceding DNS queries also use the proxy. For example, an app might query the router at 192.168.1.1:53, then send the returned IP address to a local proxy. The page loads, but the DNS query has already gone through the local network. This split path is what you need to investigate.

App requests a domainDNS resolution path is selectedDNS query is sentDestination address is returnedWeb connection is established

Online DNS leak tests typically have your browser visit a set of randomly generated subdomains, then ask the test provider's authoritative DNS server to observe which resolver makes the recursive query. The results usually show the recursive resolver or its exit point, not every packet sent by your computer's network adapter. A resolver appearing in a different country from your proxy exit does not, by itself, prove a leak.

2. Online DNS Leak Tests: Run Three Reproducible Comparisons

Open dnsleaktest.com in your browser. Run the Standard test first, then check again with the Extended test. The test page receives network information related to the test, so don't enter subscription links, node credentials, or internal work domains. The steps below are a logging template, not results from tests conducted for this guide.

Test setupWhat to recordPurpose
Turn off TUN and clear the system proxyPublic IP, resolver IPs, and ISP nameEstablish a direct-connection baseline for the current network
Enable the system proxy and keep the same nodeChange in public IP and whether baseline resolvers still appearCheck the browser's proxy route
Enable TUN and keep the same nodeResolver list, core logs, and browser DNS settingsCheck what TUN captures and where DNS queries exit
  1. Record a baseline

    On a trusted network, first turn off “Enable TUN” in the main window, then select “System Proxy” → “Clear System Proxy.” Record the test results; note that this test sends traffic directly over your current network.

  2. Keep variables constant

    Use the same working node and browser profile throughout. Note whether the browser's Secure DNS is enabled. Don't change the node, resolver, and routing rules at the same time during comparisons.

  3. Clear the cache

    Run Clear-DnsClientCache in PowerShell as an administrator. Fully quit and reopen the browser to reduce interference from cached DNS records and reused connections.

  4. Test in separate rounds

    Test the system proxy first, then TUN. Run two tests for each configuration and record the time and resolver IPs. Don't rely only on country labels or treat results from an old tab as a fresh test.

Takeaway: Look for local resolvers that appear repeatedly

If the proxy exit has changed but both tests still show an ISP resolver from the direct-connection baseline, investigate the local DNS path first. If only the public resolver's region differs, check which service it belongs to before switching nodes.

3. System Proxy vs. TUN: Different Capture Scopes

In v2rayN, “System Proxy” → “Auto Configure System Proxy” mainly affects apps that follow Windows proxy settings. It does not capture DNS system-wide. An app may ignore the system proxy or resolve a domain through Windows before connecting to a proxy port. Apps using SOCKS also need to be set to resolve domain names through the proxy; entering the correct proxy address alone isn't enough.

The paths in this guide refer to the common v2rayN 7.x desktop interface; labels may change in later versions. “Enable TUN” in the main window turns on virtual network adapter capture. The TUN implementation, DNS hijacking rules, and routing behavior depend on the core actually running. Using Xray for a node does not mean Xray also provides the TUN layer; check the startup logs to confirm.

4. Remote DNS: Configure Both the Resolver and Its Route

In v2rayN, open “Settings” → “DNS Settings” and first confirm that you're editing the configuration for the core in use. Xray and sing-box use different DNS configuration formats; don't paste an entire JSON block from one core into the other's settings. Custom configuration sections may also bypass some GUI options, so check the configuration actually generated and loaded.

For remote resolution, you can use a DoH address provided by the service, such as https://1.1.1.1/dns-query. DoH encrypts queries between the client and resolver, but does not ensure that the connection goes through a proxy. If your goal is for the DNS service to see the proxy exit IP, verify the route used by that HTTPS connection—not just that its URL starts with HTTPS.

Configuration stepWhat to checkCommonly missed issue
Resolver addressCheck the full DoH endpoint, including /dns-queryEntering only the service homepage returns a web page, not a DNS response
Query routingRoute remote DNS connections through the proxyDoH is encrypted but still connects directly over the local broadband connection
Bootstrap resolutionKeep a working bootstrap path for the node's domain and the resolver's domainThe proxy depends on DNS while DNS depends on a proxy connection that isn't established yet
Failure fallbackCheck whether failed requests fall back to system or ISP DNSSilently switching to local DNS when remote resolution fails

If you're using Xray's built-in DNS in regular https:// mode, check the routing rules to see which exit the resolver connection uses. https+local:// is a local mode, not an alternative way to force traffic through a proxy. If you use a DoH endpoint specified as an IP address, make sure the service certificate covers that address. Don't fix connection errors by disabling certificate validation.

5. Traffic Sniffing: Recover Domain Names, Not a Substitute for DNS Capture

Look for traffic sniffing options under “Settings” → “Parameter Settings.” Labels may vary by version, such as “Enable Traffic Sniffing.” Sniffing can recover destination domains from visible information such as HTTP Host headers and TLS handshakes to help match routing rules. It cannot undo a query an app has already sent to a local resolver.

The following shows only sniffing fields in an Xray inbound, to explain what the settings mean. It is not a complete configuration file and cannot be pasted into sing-box DNS settings.

{
  "sniffing": {
    "enabled": true,
    "destOverride": ["http", "tls"],
    "routeOnly": true
  }
}

Check the browser's Secure DNS setting separately. In Chrome, go to “Settings” → “Privacy and security” → “Security” and look for “Use secure DNS.” In Edge, search settings for “Secure DNS.” For troubleshooting, turn it off for one comparison test, then decide whether to enable it based on your final policy. Run the final checks with the settings you plan to keep; if you turn it back on after testing, test again.

6. Troubleshooting Logs and Command-Line Checks

An error in the core logs means a step failed; it doesn't necessarily mean a leak occurred. Check the destination, timestamp, and outbound tag to identify the problem. The examples below show common error snippets. Prefixes and suffixes may vary between core versions, so don't expect an exact match with the full log line.

Error: lookup example.com: no such host

Cause and fix: The domain doesn't exist, or the current resolution path can't resolve it. Check the spelling, compare against a known working domain, and then verify that DNS rules aren't sending the query to the wrong resolver.

Error: context deadline exceeded

Cause and fix: The operation timed out. This can affect both DNS requests and proxy connections. Check the destination in the same log entry; if it's a DoH endpoint, check its route, proxy connectivity, and bootstrap resolution requirements.

Error: x509: certificate has expired or is not yet valid

Cause and fix: The system clock or service certificate validity period may be incorrect. Sync the Windows date and time, then check the endpoint certificate. Don't disable TLS certificate validation.

To see which DNS addresses Windows is currently using, run the following commands in PowerShell. They show network adapter settings and test system resolution; they are not equivalent to testing a proxied browser. In particular, a query sent to a manually specified resolver may go directly to that address if TUN isn't capturing it.

Get-DnsClientServerAddress -AddressFamily IPv4
Get-DnsClientServerAddress -AddressFamily IPv6
Clear-DnsClientCache
Resolve-DnsName example.com -Type A
Resolve-DnsName example.com -Type AAAA

Seeing the router's DNS address in the network adapter list doesn't by itself prove a leak, because TUN may intercept requests sent to it. Conversely, seeing a public DNS address doesn't prove that queries go through the proxy. For a packet capture, check the physical adapter for direct UDP/TCP port 53 and TCP port 853 traffic. You can't distinguish DoH over HTTPS from regular web traffic by port 443 alone; also check the destination address and core logs.

Takeaway: Fix the failing route before assessing leaks

If remote DNS times out, first make it work reliably through the specified outbound route, then disable local fallbacks that don't match your policy. Simply removing the fallback could turn an occasional leak into a failure to resolve every domain without fixing the underlying routing problem.

7. Final Checklist: Test Your Everyday Setup

After making changes, save the settings and restart the core if prompted by the client. If you changed TUN routes or the virtual adapter, toggle TUN off and on again. Final checks should cover more than one website: test after a restart, when switching networks, and over IPv6. A single test page shows only how that browser request behaved; it cannot guarantee the behavior of every background app.

A reliable setup has three parts: app traffic enters through the intended interface, domain queries use the intended resolver, and resolver connections use the intended outbound route. TUN, DoH, and traffic sniffing each handle a different part of the process. Checking each one is more effective than repeatedly switching public DNS addresses, and makes it easier to verify the setup after client upgrades.