For readers who can already connect to a node with v2rayN and need to troubleshoot DNS issues. Using the Xray core as an example, first check whether DNS queries reach the core, then choose separate upstreams for local and other domains, and finally use the logs to verify DNS queries and website connections follow the expected paths.
First, Find Out Which Layer Resolves the Domain
Changed DNS settings in v2rayN, but your browser still gets the same result? Don’t switch upstreams just yet. The system proxy provides a proxy entry point only to apps configured to use it; it does not take over system-wide DNS. Your browser may use Secure DNS on its own, or an app may resolve a domain through the system before connecting. Conversely, even if the core receives the destination domain, it may pass that domain to the proxy outbound for remote resolution. Only DNS queries actually made by the core’s built-in resolver use the upstreams configured by the rules below.
This flow applies only when the built-in DNS resolver is involved. It does not mean the website connection is split-routed: DNS rules decide which resolver returns an IP, while routing rules decide which outbound handles the connection. A domain resolved by local DNS can still connect through a proxy; using remote DoH does not mean the website traffic also goes through the proxy.
- In the v2rayN main window, open Settings → DNS Settings and make sure you’re editing the configuration for Xray. Fields and editing options vary by version. If the interface only provides an address field, don’t paste an entire JSON block into it.
- Before testing, note your current DNS, routing, and system proxy settings, and save a restorable copy of the configuration. First use the current node to open a site that normally works, confirm the node is operational, and then change DNS.
- Choose one browser for comparison and note its Secure DNS setting. If you want to observe how the core handles DNS, change this setting only for the test and restore it afterward. Don’t enable TUN, switch nodes, and change DNS at the same time, or it will be difficult to tell which change affected the result.
Split DNS for Domains in China and Other Domains
Set the local DNS resolver as the preferred upstream for specified domains, and remote DoH as the default option for domains that don’t match. Here, “in China” refers to domains in the rule set—not IP addresses classified by geographic location after resolution. For office intranet hosts, router admin pages, or hostnames resolvable only on your local network, add explicit domain matches rather than relying on geographic rules to cover them automatically.
Local Resolution
- Upstream
localhost- Domain Match
geosite:cnand any intranet domains you need- Standard fallback
skipFallback: true
Use the system resolver; first confirm that it can resolve the required local domains on your current network.
Other Domains
- Upstream
https://1.1.1.1/dns-query- Domain Match
- No
domainsfield; used as a candidate when no rule matches - Connection Path
- Determined by core routing; it cannot be inferred from the IP address prefix
First make sure the DoH endpoint is reachable, then check whether the returned address is what you expect.
The following is the dns section from a complete Xray configuration, not a standalone configuration you can launch. If the custom editor accepts only a DNS object, enter the object under the outer dns key. If you’re editing the full core configuration, merge it at the top level. Don’t use this snippet to overwrite existing inbounds, outbounds, or routing rules.
{
"dns": {
"disableFallbackIfMatch": true,
"servers": [
{
"address": "localhost",
"domains": ["geosite:cn", "domain:home.arpa"],
"skipFallback": true
},
{
"address": "https://1.1.1.1/dns-query"
}
]
}
}
skipFallback excludes the local upstream from standard fallback candidates without affecting its handling of explicitly matched domains. disableFallbackIfMatch prevents standard fallback upstreams from being added when a domain rule matches an upstream. With this example, if local resolution fails, the query won’t automatically fall back to remote DoH. This also prevents matched intranet domains from being sent to a public resolver.
Choosing Between DoH and FakeDNS
DoH sends DNS queries to a resolver over HTTPS. It can reduce the risk of plaintext queries being tampered with along that connection, but it can’t fix an incorrect result already cached by an app or guarantee that the resolver returns the right answer. This example uses an IP address for the DoH endpoint, avoiding an extra lookup for the resolver’s hostname. HTTPS still requires certificate validation; don’t disable it to work around handshake errors.
FakeDNS does not provide encrypted DNS resolution. The core first assigns a synthetic IP to a domain, then looks up the original domain from its mapping when an app connects to that address. It’s useful when app traffic is intercepted and only the destination IP is available, so the domain needs to be recovered for routing. Both the DNS query and the app’s subsequent connection to the synthetic address must reach the core that handles the mapping; otherwise, the address returned to the app won’t work.
Verify Real DNS Resolution Before Testing Synthetic Addresses
If the issue is an incorrect answer for one domain, first test DoH with FakeDNS disabled. Test FakeDNS separately only after confirming that TUN interception is active and the logs still show that the core can’t obtain the domain needed for routing. Don’t judge whether FakeDNS works by checking if another machine can access the synthetic address.
- The core can route DoH using
https://;https+local://bypasses core routing. To specify a DoH outbound, check the order of rules and the actual outbound tag in your existing routing configuration, and use the logs as the source of truth. - If DoH goes through a proxy and the node server itself needs a DNS lookup before it can connect, keep a working bootstrap resolution path for the node’s domain. Otherwise, you can end up in a loop: resolving requires connecting through the proxy, but connecting through the proxy requires resolving first.
- If TUN has taken over system DNS, check whether the system resolver used by
localhostsends the same query back to the core. If you find a loop, restore connectivity with the previous interception settings, then check whether the local upstream is independently reachable.
Verify the Changes and Roll Back if Needed
Troubleshoot in three stages: system DNS results, core DNS logs, and connection outbound. Test at least one domain that clearly matches the local rule and one public domain that doesn’t. Keep browser settings and the node consistent across both tests where possible. Compare the upstream, response status, and outbound path—not just whether the page loads.
- Run these two commands in Windows PowerShell and note the IPv4 and IPv6 results returned by the system. They query A and AAAA records, respectively, and show only the system’s DNS resolution path; they can’t prove on their own that v2rayN is using remote DoH. A site without an AAAA record has not necessarily failed to resolve.
- Save and reload the core, then visit the test domains with the browser you selected earlier. Search the logs by domain to see whether the core made a DNS query. If there’s no record, first check the log level, then see whether the browser resolved the domain on its own, used a cached result, or left resolution to the remote server.
- If the logs show successful resolution but the page still won’t load, check the outbound selected for the connection and any connection errors. Different resolvers may return different CDN addresses, so different answers alone don’t prove DNS hijacking.
- If the core won’t start after your changes or both test domains time out, restore the original DNS settings and reload the core. If you also changed routing, restore the affected routing rules. Once connectivity is back, reintroduce one change at a time.
Resolve-DnsName -Name example.com -Type A -DnsOnly -NoHostsFile
Resolve-DnsName -Name example.com -Type AAAA -DnsOnly -NoHostsFile
Common DNS Issues
Why Can’t I Reach an Intranet Host After Adding a China Domain Rule?
Use the system resolver to look up the intranet host’s fully qualified domain name; avoid short hostnames that depend on a search suffix. If the system can resolve it but the core doesn’t use the local upstream, check whether the domain matches a full: or domain: rule. If the correct address is returned but the connection fails, check the outbound routing rule for intranet traffic.
Remote DoH Keeps Timing Out. Should I Try Another Address First?
First check the connection from the core to the resolver: can it reach port 443, or does the TLS handshake fail after connecting? If it can’t connect, check the outbound and whether the node is working. For handshake failures, start with the system clock, endpoint address, and certificate errors. The two types of error require different troubleshooting steps.
Why Am I Still Getting the Old IP After Saving?
Close the old page and restart the browser to avoid reusing an existing connection. If you’ve confirmed that queries use the Windows system resolver, run ipconfig /flushdns and try again; this clears only the system cache, not the browser’s or the core’s cache. Finally, compare with a domain you haven’t visited before.
Why Is the App Still Using a Synthetic Address After I Turned Off FakeDNS?
Check that the core has reloaded and that TUN isn’t still using the previous interception settings. Then quit and reopen the affected app so it makes a new connection and DNS query. Test again after confirming the app received a real address; don’t add an old synthetic address to a static mapping.