This guide is for v2rayN users who can connect to nodes normally but still encounter DNS errors, intermittently inaccessible websites, or unexpected DNS test results. It first separates system resolution from core resolution, then provides split-DNS settings, verification steps, and troubleshooting methods. By the end, you can identify which resolver handles a query, which outbound it uses, and why it returns its current address.
First distinguish system DNS, core DNS, and remote resolution
In v2rayN, open “Settings” → “Parameter Settings” and check the active core type, system proxy mode, and TUN status. DNS splitting depends not only on which servers you enter, but also on whether domain requests reach the Xray core. A standard system proxy mainly handles an application’s HTTP or SOCKS traffic, while some apps still query the operating system DNS directly. TUN mode covers more network requests, but you must also check DNS hijacking and routing rules.
System DNS is the resolver currently used by the network adapter or operating system. Core DNS is the top-level dns object in the generated configuration; it selects DNS servers according to domain rules. Remote resolution means the query is sent through a proxy outbound to the target resolver, not merely that the server address was changed to one outside mainland China. If the query packet still leaves through a direct connection, entering a remote server does not make it remote resolution.
| Layer | Primary responsibility | Where to check | Common issue |
|---|---|---|---|
| Application layer | Determines whether to use system resolution, built-in secure DNS, or proxy resolution | Browser and application network settings | Bypasses system and core rules |
| System layer | Sends ordinary UDP/TCP 53 queries to the specified server | Network adapter and system network status | Stale DNS entries or multiple active adapters |
| Core layer | Selects a resolver by domain, geographic tag, and query type | v2rayN’s current runtime configuration | Rule order or tags do not match |
| Outbound layer | Determines whether queries go direct or through a proxy node | Routing rules and core logs | Remote resolver incorrectly assigned to direct traffic |
Conclusion: confirm that queries reach the core first
Review the current runtime configuration and core logs before changing anything. If the test domain produces no DNS record at all, first check the app’s built-in resolver, system proxy coverage, or TUN handling instead of repeatedly switching DNS servers.
Configure local DoH for mainland domains and remote resolution for overseas domains
Set up a low-latency local DoH resolver for mainland domains, then a remote DoH resolver for everything else that must be reached through the proxy. Split by domain sets rather than by the returned IP: this selects the resolver before the query is sent, preventing overseas domains from being exposed to a local resolver and receiving misleading results.
- Open “Settings” → “Parameter Settings”, confirm that the Xray core is enabled, and note the local SOCKS listening port. The common default is
10808, but use the value shown on the current parameter page. - Open v2rayN’s DNS settings and select the configuration area for the active core. Interface labels may vary slightly by version. After editing, inspect the generated runtime configuration rather than relying only on the editor.
- Bind the mainland DoH server to a domain rule such as
geosite:cn, and usegeoip:cnto constrain the expected returned addresses. - Place the remote DoH later in the matching order as the resolver for overseas and unmatched domains. Also ensure that the DoH domain or destination connection uses a proxy outbound.
- Save the configuration and restart the core. Test one clearly mainland domain first, then one overseas domain; do not draw conclusions from a single site.
The snippet below shows the core structure of the Xray dns object. It is a structural example and should not replace v2rayN’s complete generated configuration. In practice, merge it through the client’s custom DNS section while preserving the existing log, inbound, outbound, and routing sections.
{
"dns": {
"queryStrategy": "UseIP",
"disableCache": false,
"hosts": {
"dns.local.example": "223.5.5.5"
},
"servers": [
{
"address": "https://dns.alidns.com/dns-query",
"domains": [
"geosite:cn"
],
"expectIPs": [
"geoip:cn"
],
"skipFallback": true
},
{
"address": "https://1.1.1.1/dns-query",
"domains": [
"geosite:geolocation-!cn"
]
},
"https://1.1.1.1/dns-query"
]
}
}
When queryStrategy is set to UseIP, the core can request A and AAAA results according to network availability. If the local network has unreliable IPv6 but IPv6 queries are forced, resolution may succeed while the connection times out. IPv4-only environments can choose the appropriate strategy supported by the current core, but do not confuse query strategy with routing outbound selection.
Conclusion: restrict the local resolver to mainland rules and use the remote resolver as the default fallback
Put the narrower geosite:cn rule first, then set the remote resolver as the default. After saving, use logs to verify which server handles each domain type instead of guessing from the result alone.
Make sure remote DNS queries actually use the proxy outbound
Remote DoH is still an HTTPS connection. If routing sends its destination to a direct outbound, the query leaves through the local network. In the routing settings, explicitly proxy the remote resolver’s domain, while keeping the local DoH direct to preserve low latency for mainland queries.
- In “Settings” → “Routing Settings”, check the order of custom rules. The proxy rule for the remote DoH domain must come before broad direct-connection rules.
- The local DoH domain can be set to direct using
geosite:cnor an explicit domain, and the connection usually uses port443. - If traditional DNS uses UDP 53, make sure TUN and the firewall do not let packets bypass the core. DoH uses HTTPS, making it easier to apply routing rules alongside ordinary TCP traffic.
- If a subscription node uses a domain as its server address, preserve a basic resolution path for the initial connection. Otherwise you can create a loop: the proxy must connect before the node can be resolved, but the node must be resolved before the proxy can connect.
During troubleshooting, open v2rayN’s log window and temporarily raise the core log level enough to observe DNS queries and routing matches. Then clear the system cache and visit the test domains in sequence. Look for the query type, matched DNS server, outbound tag, returned address, and timeout reason. Restore a lower log level afterward to reduce routine output.
| Test item | Expected path | Example observation | What an anomaly means |
|---|---|---|---|
| First resolution of a mainland domain | Local DoH → Direct | About 18–45 ms | Over 500 ms often indicates an incorrect proxy path or repeated fallback |
| First resolution of an overseas domain | Remote DoH → Proxy | About 90–260 ms | An unexpected address returned immediately may indicate local DNS was used |
| Resolving the same domain again | Core cache | Usually under 5 ms | A fresh query every time may mean caching is disabled or the TTL has expired |
| Node domain resolution | Basic resolution → Establish connection | Completed during core startup | A timeout at startup may indicate a circular resolution dependency |
Prioritize hosts, fakeDNS, and caching
hosts overrides specified domains before a regular DNS query begins. It is useful for fixed internal service addresses, temporarily bypassing broken resolution, or mapping one domain to another. It is not suitable for maintaining addresses for large, frequently changing sites: a fixed IP can bypass nearby routing and may break connections after the service changes addresses.
fakeDNS is commonly used with TUN. It first returns a synthetic address to the application, often from the 198.18.0.0/15 pool. The core then maps that synthetic address back to the original domain and routes the connection. This preserves domain information and avoids cases where the application resolves a real address at the system layer before giving the core only an IP. Enable it according to the current TUN configuration and core support.
The cache stores resolution results until their TTL expires, reducing duplicate queries and initial page-load delays. If old results remain after changing DNS rules, the new configuration may be working: a stale record may still exist in the system, application, or core cache. Restart the core first, then clear the operating system DNS cache and fully restart the application used for testing.
- Hosts override
- Returns a specified address or alias before querying regular servers. Best for a small number of clear, maintainable domain mappings.
- fakeDNS
- Returns a synthetic address to the application while retaining the original domain mapping in the core. Mainly solves domain identification for TUN traffic.
- DNS cache
- Reuses existing results according to their TTL. This reduces latency but can temporarily keep showing old results after a configuration change.
{
"dns": {
"hosts": {
"internal.example": "192.168.10.20",
"alias.example": "target.example"
},
"disableCache": false,
"disableFallback": false
}
}
After configuring hosts, check both DNS resolution and the actual connection. A correct address with an inaccessible website may indicate that the target requires the proper TLS domain, reverse-proxy entry point, or port. hosts changes address selection only; it does not rewrite certificate validation, the HTTP Host header, or the server’s listening configuration.
Conclusion: keep caching enabled and clear it briefly during troubleshooting
Disabling the cache for long periods increases query volume and initial-load latency. After changing rules, use the sequence “restart the core, clear the system cache, restart the test application” instead of leaving caching disabled.
Locate resolution failures and unmatched rules by symptom
Break the issue into four categories: “no query was sent,” “the query used the wrong outbound,” “the returned result was unexpected,” and “resolution succeeded but the connection failed.” Website accessibility alone is not proof of a DNS issue; TLS handshakes, routing rules, node status, and the destination service can look identical.
System proxy is enabled—why does the test still show local DNS?
First check whether the application uses its own secure DNS, then see whether the core log contains the test domain. If there is no log entry at all, open “Settings” → “Parameter Settings” and confirm the system proxy mode. To cover more programs, configure TUN and DNS interception for the current network environment.
An overseas domain resolves, but the returned address is clearly wrong. What should I do?
In the current runtime configuration, confirm that the domain matched the remote DoH and verify that the remote DoH connection uses a proxy outbound. Then clear the system and application caches and retest with a domain that has never been queried to rule out stale records.
Some local network device names stop opening after TUN is enabled. What should I do?
Put local network domains and private-address rules in the direct-connection scope, and retain the local network resolver. For fixed devices, add a small number of hosts mappings if needed. Also confirm that geoip:private routing is not overridden earlier by a remote proxy rule.
Remote DoH keeps timing out, but the node itself connects. Why?
Check the DoH domain’s routing rule, port 443, and IPv4/IPv6 query strategy. If the log shows an unreachable IPv6 address first, adjust the query strategy to match the network, then confirm that the proxy outbound can reach the resolver.
Why didn’t the setting enter the runtime configuration after restarting?
Confirm that you edited the DNS section for the active core and check the JSON syntax. When v2rayN generates the configuration, it may merge presets with custom content, so use the runtime configuration shown after startup as the source of truth. If fields are missing, fix the configuration hierarchy and restart the core.
Command-line tests provide supporting evidence, but nslookup queries the system DNS by default and may not pass through the Xray core. It is useful for checking the operating system’s current resolver, but cannot by itself prove a remote DoH path. To verify core-level split DNS, combine the command output with v2rayN core logs and observations of the network exit.
- Record the DNS settings, routing mode, core type, and listening port before making changes.
- Change one variable at a time—for example, adjust the resolver first, then the routing rules.
- Restart the core and confirm there are no JSON parse errors, port conflicts, or DNS initialization failures.
- Test one mainland domain and one overseas domain separately, recording the matched server and outbound tag.
- Finally, restore the normal log level and save a working copy of the configuration.