· Troubleshooting · About 8 minutes

DNS Leak Detection and Configuration

Learn how to detect DNS requests bypassing your proxy and configure remote DNS, domain routing, and TUN mode in v2rayN and v2rayNG to prevent common leaks.

At a glance

A working proxy connection doesn't mean DNS queries are taking the expected route. If you're using the system proxy on desktop or still see your local resolver after connecting on Android, compare results in the same app with the client off and on. Then check DNS settings in the browser, client, and operating system. Change one setting at a time to pinpoint the cause.

First, identify which queries should not connect directly

A DNS leak occurs when a domain lookup that should go through the proxy takes an unexpected route. For example, a browser's web traffic may use the proxy while an app first asks your local router to resolve a domain, then connects to the resulting IP address. Conversely, if your routing rules explicitly send local network domains to the local resolver, seeing those queries connect directly does not mean proxied domains are leaking.

App queryTraffic captureDomain matchOutbound selectionRecursive resolver

Run a repeatable DNS comparison test

Use a DNS test page that generates a fresh query domain for each run and lists the recursive resolvers it detects. When using a public test service, don't submit subscription links, node credentials, or internal domain names. Reopening an ordinary webpage may use a cached result, so it doesn't prove that a new query was sent.

  1. Record a direct-connection baseline

    On a network where direct access is allowed, disconnect the client and run a test in the same browser. Record the public IP, the resolvers listed by the test page, and the browser's Secure DNS status. On Android, also note whether Private DNS is enabled.

  2. Change only the proxy mode

    Connect the client and keep the browser settings unchanged, then run a fresh test query. On desktop, test the system proxy first and TUN separately. On Android, start with a browser included in the VPN, then check the app where the issue actually occurs.

  3. Trace the resolution path

    Compare the test time with the client logs and look for a matching DNS query or proxy outbound record. If you can inspect your device's network traffic, check for requests to port 53 on the local gateway, but don't mistake background queries from other apps for the test query.

  4. Retest the app you actually use

    After the browser test passes, check whether your everyday apps use the same capture path. If an app can't load the test page, use its own network diagnostics or the client logs to verify its traffic. Don't assume the browser's result applies to other apps.

Test resultWhat it tells youNext step
The egress IP changed, but the resolver did notThis alone doesn't confirm a leak. Both routes may use the same public resolver.Check the provider configured for the browser's Secure DNS and which outbound connection it uses.
The test domain was sent to the gateway on port 53If this domain should be resolved through the proxy, this record supports a local bypass diagnosis.Check whether the app resolved the domain early, then review capture scope and direct-connection rules.
No port 53 traffic observedThis doesn't prove all DNS uses the proxy; the result may be cached or encrypted DNS may be in use.Run a fresh query and check which outbound connection the resolver uses.

In short: resolver location is only a clue

Don't judge a leak by the resolver's country or region. First identify the outbound connection used by the query. If you can only see the resolver list returned by the test site, treat the result as inconclusive.

v2rayN: Remote DNS, Routing, and TUN

First note the current core type and routing setup. The same option can generate different configurations with different cores, and a custom configuration may define its own DNS settings. Don't assume values entered in the client UI will override those settings. The steps below refer to common screens in v2rayN 7.x; menu names may vary slightly between minor releases.

v2rayNG: Check VPN Coverage and Android DNS

The Android VPN created by v2rayNG is not the same traffic entry point as the desktop system proxy. Even when the VPN icon appears in the status bar, apps excluded from per-app proxying may bypass it. First confirm that the affected app is covered, then investigate whether the remote DNS settings are the cause.

  1. Open the top-left menu and go to “Settings” → “Per-app proxy.” Check whether the current list means only selected apps are proxied or selected apps are bypassed. Seeing a browser in the list doesn't necessarily mean it will use the proxy.
  2. Under “Settings,” check “Remote DNS” and “Direct DNS.” If your version offers “Enable local DNS,” read its description to confirm whether the client handles queries. Don't assume from the field name that every app will use that resolver. Save your changes, disconnect, reconnect, and test a fresh domain.
  3. Check Android's “Private DNS” setting. A common path is “Settings” → “Network & internet” → “Private DNS”; if your device's menus differ, search for the setting by name. If the browser also has Secure DNS configured, note both settings and test them one at a time. Restore your preferred encrypted DNS settings afterward.
  4. If the problem occurs only after switching networks, test Wi-Fi and mobile data separately. Keep the same node, app, and routing profile to isolate differences in network access. Don't reset the node, DNS, and per-app list at the same time.

No connection after changing DNS? Roll back based on the error

A timeout in the logs could come from the node, the resolver, or the connection route. Check the destination and outbound records around the same time before reverting DNS; the last line of an error alone isn't enough to identify the cause.

Error: i/o timeout

Cause and fix: The request didn't complete before the deadline, which doesn't necessarily mean the resolver is at fault. If the record points to a remote DNS service, retest with the previous settings, then check which protocol, port, and outbound route the new service requires.

Error: no such host

Cause and fix: The lookup couldn't find the target host. Possible causes include a misspelled name, an internal domain sent to a public resolver, or a failed initial lookup for the node's hostname. First identify the name that failed in the logs, then restore the appropriate local or bootstrap resolution path.

Download the client