At a glance

A change in your web traffic's exit IP doesn't mean DNS lookups follow the same route. This guide is for v2rayN users troubleshooting browser DNS, DNS routing, or TUN interception. Compare browser and system lookups, route the built-in resolver's upstream traffic through a chosen outbound, then verify that FakeDNS address mappings work end to end.

DNS Leak Tests: Compare Your Exit IP and Query Path

A leak occurs when a query takes a path other than the one you intended. Sending local network names to an office resolver by policy isn't a leak. Conversely, a test page may show the expected public resolver even when your device sent the query directly. Test pages typically reveal the recursive resolver's exit, not whether traffic from your device to that resolver passed through a proxy.

53
Traditional DNS: UDP/TCP ports
443
DoH: typically uses HTTPS ports
853
DoT: default TCP port
  1. Establish a baseline

    In the Windows v2rayN tray menu, select “Clear system proxy.” If TUN is enabled, turn it off first. In the same browser, note your web exit IP and the resolvers shown by a DNS test page; also check whether Secure DNS is enabled. Use a test page that generates a new subdomain for each run to avoid misleading cached results.

  2. Change only the proxy

    Select “Set system proxy” from the tray menu and run the test again in the same browser, leaving Secure DNS unchanged. If your web exit IP changes but the resolver does not, that only means both tests observed the same resolver; it doesn't prove there's a leak.

  3. Inspect device traffic

    Check queries on your physical network adapter at the test time, including destination addresses and ports. A leak is confirmed if a protected test domain is sent as a plaintext query to your local gateway and that gateway isn't an allowed resolver. An outbound connection on port 443 alone doesn't prove it's DoH.

  4. Test system lookups separately

    Run Resolve-DnsName -Name example.com -Type A -DnsOnly in PowerShell to inspect the system's resolver path, then repeat with a new domain. This command doesn't test browser Secure DNS, and it isn't expected to follow the browser's HTTP proxy settings.

How to tell: check whether queries leave the intended path

Compare the test page results, physical adapter destination addresses, and core logs from the same test run. If only the proxy node should receive traffic but your adapter shows a direct connection to a specific resolver, first determine whether the browser, system, or core initiated it. Don't blindly switch DNS addresses.

DNS server groups and outbound rules

dns.servers configures upstream resolvers used by the core. It doesn't change your system adapter's DNS settings or automatically take over browser Secure DNS. Only queries handled by the built-in resolver are affected. The following is a merged configuration snippet for v2rayN with the Xray core, not a complete node configuration. Check that your current core supports these fields, and preserve your existing inbounds, outbounds, and other routing rules.

This example sends a single internal suffix to the assumed-reachable gateway 192.168.1.1 and uses DoH for other queries. Replace the sample suffix and gateway with your actual values, and confirm the gateway provides DNS service. If your internal network relies on single-label hostnames, configure the system search suffix separately; this domain rule won't expand names for you.

{
  "dns": {
    "tag": "dns-upstream",
    "disableFallbackIfMatch": true,
    "servers": [
      {
        "address": "192.168.1.1",
        "port": 53,
        "domains": ["domain:home.arpa"],
        "skipFallback": true
      },
      "https://1.1.1.1/dns-query"
    ]
  },
  "routing": {
    "rules": [
      {
        "type": "field",
        "inboundTag": ["dns-upstream"],
        "ip": ["192.168.1.1/32"],
        "port": "53",
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "inboundTag": ["dns-upstream"],
        "outboundTag": "proxy"
      }
    ]
  }
}

FakeDNS and routing: Map virtual addresses back to domain names

FakeDNS returns virtual addresses for the core to map. When an application connects to one, the traffic must return to the same core that holds the mapping so it can recover the original domain and apply routing rules. Don't assume that enabling the system proxy captures DNS and connections from every application. Verify the actual interception scope of TUN or a transparent inbound before changing FakeDNS.

In Xray versions that support top-level fakedns configuration, use the snippet below to create an IPv4 pool and test it with a single domain first. The dns.servers entry here is an addition, not a replacement for the real upstreams in the previous section. Add it to your existing array for deployment.

{
  "fakedns": [
    {"ipPool": "198.18.0.0/15", "poolSize": 65535}
  ],
  "dns": {
    "servers": [
      {
        "address": "fakedns",
        "domains": ["domain:example.com"],
        "skipFallback": true
      }
    ]
  }
}

Common errors: Distinguish timeouts, resolution failures, and port conflicts

Find the first failing log entry, then check its destination address and port. Upstream resolution failures, node handshake timeouts, and listener errors can all make websites unavailable, but changing a DNS address won't fix all three.

Error: context deadline exceeded

Cause and fix: An operation timed out. If the context points to the DoH endpoint, first confirm the connection uses the expected proxy outbound and the node is working, then test again. Simply increasing the timeout may not help.

Error: no such host

Cause and fix: The current resolution path couldn't find an address for the target host. Check the logs to determine whether the failed name is the node hostname or an application domain, then troubleshoot bootstrap resolution or the server group accordingly.

Error: address already in use

Cause and fix: The local listening address and port are already in use. If the logs point to DNS listening on port 53, check for UDP conflicts with Get-NetUDPEndpoint -LocalPort 53 and inspect TCP listeners as well. Avoid binding to a service that's already using the port.

Retest browsers, internal domains, and settings after a restart

The test page shows an unfamiliar resolver. Should you change your configuration right away?

Note the resolver address and test time, then compare them with connections from your device. A resolver's recursive exit may differ from the address used to connect to it. If your physical adapter shows no traffic to an unexpected resolver, use the core logs to investigate further. Don't judge by the organization name or location shown on the test page alone.

Should you turn off browser Secure DNS?

To diagnose the built-in resolver path, search for “Secure DNS” in your browser settings, temporarily turn it off, and run a comparison test. Turning it off won't automatically route system queries through the core. When you're done, restore the setting based on whether browser queries should be handled by the core or use a separate encrypted path.

Public websites work, but internal domains don't resolve. What should I do?

On a trusted local network, use Resolve-DnsName -Name home.arpa -Server 192.168.1.1 -DnsOnly to verify the query path. For an actual test, substitute the full name of an internal host with a DNS record and the correct resolver. If the gateway returns a record but the core query fails, check the suffix match, outbound tags, and gateway rule order.

How can I confirm my changes persist after restarting v2rayN?

Go to “Settings” → “Parameter settings” to check which core is in use, and confirm whether the current node loads a custom configuration or one generated by the client. Direct edits to a temporary generated file may be overwritten when you restart or switch nodes. After restarting, test with an uncached domain and check the upstream connection and outbound—not just the text shown in the settings UI.