FakeDNS is useful when traffic interception needs to recover domain names from IP connections. It is not a speed boost that should be enabled for every connection. First, understand how DNS queries, virtual IP mapping, inbound sniffing, and routing work together, then check which core v2rayN is actually using. This guide covers Xray configuration fields, Windows verification steps, and cache cleanup after disabling FakeDNS—with a focus on avoiding the “DNS resolves, but the connection times out” problem.
How FakeDNS works: it returns an address without looking up the real IP first
Standard DNS looks up a domain's A or AAAA record with an upstream server and gets the real address before a connection is made. FakeDNS instead keeps a local mapping between domains and virtual IPs. When an app looks up a domain, FakeDNS assigns and returns an address from a specified pool. That address is not the website's server and cannot be used on its own, without the mapping.
Suppose an app looks up example.com. FakeDNS returns an address from its local pool, such as 198.18.x.x. When the app connects to that address, the traffic must pass through a processing path that can access the same mapping table. Xray can then recover the original domain, match domain-based rules, and send the request through the appropriate outbound. If the connection bypasses that path, the system will simply try to connect to a virtual IP that does not host the website.
That is why FakeDNS is often used with TUN: a virtual network interface can capture IP traffic destined for these addresses. But TUN only provides the interception path. It does not automatically ensure DNS queries reach FakeDNS, or that different cores share the same mapping. DNS queries and subsequent connections must complete the same loop.
Address pool and mapping capacity: what three numbers mean
Xray's FakeDNS configuration lets you set ipPool and poolSize. The IPv4 example below illustrates what these settings mean; it does not imply that every client uses the same defaults. The address pool and mapping capacity are separate limits. A large subnet does not mean mappings can never be evicted.
198.18.0.0/15 is a reserved range for network benchmarking, not a public website address or a private subnet typically used on home networks. It can still conflict with routes if an enterprise test network or another tunnel uses the same range. Check your local routing table before enabling it; “reserved” does not mean “conflict-free.”
{
"fakedns": [
{
"ipPool": "198.18.0.0/15",
"poolSize": 65535
}
],
"dns": {
"servers": [
"fakedns"
]
}
}
This is a partial Xray configuration, not a complete client configuration. It does not define inbounds, outbounds, DNS interception, or routing rules, nor does it provide real DNS resolution for destinations that should connect directly. Do not treat it as a ready-to-use configuration file. Mappings exist only at runtime, so do not assume an old virtual IP will still map to the same domain after the core restarts.
Takeaway: verify the full path before changing capacity
If DNS returns a virtual IP but the page will not load, first check whether traffic returns through the same processing path and whether the domain is restored successfully. Increasing poolSize will not fix DNS bypass, missing inbound sniffing, or a virtual subnet that is incorrectly sent through a direct route.
FakeDNS, regular DNS, and domain sniffing compared
FakeDNS is neither encrypted DNS nor HTTP or TLS sniffing. FakeDNS creates a mapping; sniffing extracts a possible domain from connection data. Xray uses its mapping table to recover domains, so it does not need to read a hostname from the application layer on every connection. Even so, if an app connects directly to a real IP without first making a corresponding domain lookup, FakeDNS cannot infer the domain.
| Method | Primary purpose | Limitations |
|---|---|---|
| Regular DNS | Looks up the destination's actual A or AAAA address | Direct connections still need a reachable address |
| FakeDNS | Returns a virtual IP and saves a domain mapping | Subsequent connections must pass through the corresponding mapping-aware path |
| HTTP/TLS sniffing | Identifies hostnames from protocol data | Limited by the protocol, encryption, and available handshake data |
| DoH、DoT | Protects DNS queries in transit | Does not automatically create virtual IP mappings or route traffic by domain |
For domains that need a proxy, FakeDNS can avoid making the client wait for the real IP first. If the proxy outbound sends the domain to a remote server, resolution can happen later in the chain. Direct connections still need a real address. Resolution work may simply move elsewhere; it does not disappear from the connection entirely. Page load times also depend on node latency, packet loss, server response times, and the number of resources, so FakeDNS cannot guarantee a fixed speed increase.
- Good fit: Apps mainly make IP connections, TUN is reliably intercepting traffic, and domain rules need more complete matching information.
- Not a priority: Your browser already passes domains through the proxy protocol, the system proxy works as expected, and you are not losing domain names.
- Use caution: Enterprise intranets, local network device discovery, software that relies on real DNS results, and setups running alongside other virtual network adapters.
- Does not replace: Correct subscription settings, working nodes, accurate system time, or server-side support.
Before enabling FakeDNS in v2rayN: check the core and DNS path
v2rayN is the client interface; Xray is a core it can run. Seeing a “TUN” option in the interface does not mean that mode will use Xray's fakedns field. Some modes use different configuration-generation paths, so the fields and traffic interception may differ. Check the core name and version in the startup log, along with the configuration load results, before using the Xray fields in this guide.
- Keep a baseline: Back up your current configuration. Turn off TUN and use the existing system proxy to verify that the same node can reach the target website. Note your current DNS, routing mode, and local ports.
- Review settings: In v2rayN, check the core and inbound settings under “Settings” → “Parameter Settings,” then review the existing entries under “Settings” → “DNS Settings.” Menu names may vary by version; use the labels shown in your client.
- Check the generated configuration: Confirm that the active configuration includes the expected
fakedns, DNS server list, and inboundsniffingfields. Do not assume a feature is active just because a single toggle is on. - Check what gets intercepted: DNS queries must enter the intended local processing path, and connections to the virtual subnet must also be intercepted. Check whether browser secure DNS, app-level DoH, or IPv6 queries bypass that path.
- Test one change at a time: Save and restart the core as required by the client. First test one proxied destination and one direct destination, then test a local network service. Change only one category of settings at a time.
Xray address mapping
- Address pool field
fakedns[].ipPool- Capacity field
fakedns[].poolSize- DNS entry
fakednsindns.servers- Example range
198.18.0.0/15
These fields control mappings and resolution; they do not automatically create a system virtual network adapter.
Xray inbound domain recovery
- Sniffing toggle
sniffing.enabledset totrue- Domain recovery type
destOverrideincludesfakedns- Destination handling
- Check
routeOnlyand outbound requirements - Required condition
- The connection enters the path that holds the mapping
Using a domain only for route matching does not mean the connection destination has been replaced; the virtual IP must not be sent out as a public destination.
Pay particular attention to routeOnly: using the recovered domain for rule matching is different from using it as the connection destination. If the outbound still tries to connect to the virtual IP, the request may time out. Check the current core's configuration documentation and the complete outbound design; do not copy a single Boolean value in isolation.
How to verify: check resolution results and connection logs together
Seeing a 198.18.x.x address proves only that this particular lookup returned a virtual result; it does not prove that the proxy outbound succeeded. Conversely, a page may load because the browser bypassed system DNS. Verification needs to show both where the query went and where the connection was ultimately sent.
- Close any existing test tabs in your browser. In a Windows terminal, run
ipconfig /flushdns, then quit and reopen the browser so old cache entries do not affect the test. - Run the query below to check whether the system's current resolution path returns an address from the pool. Do not specify an external DNS server; that would test a different path from the one the system normally uses.
- Visit the same domain and check the core log for the destination domain and outbound tag. If needed, temporarily increase the log level, then restore it after testing to avoid logging excessive browsing activity.
- Now check a destination that should connect directly. Confirm that its virtual IP is not being used as the final server address, and verify that the local router and intranet services are still reachable.
ipconfig /flushdns
nslookup example.com
route print
nslookup is useful for checking regular DNS queries, but it does not show how browser built-in DoH behaves. Use route print to check which routes cover the virtual subnet. If the subnet is not listed separately, that alone does not prove interception failed—some TUN setups use a broader route. Check the interface, metric, and client logs together.
Acceptance criteria: proxy, direct access, and recovery after shutdown
Testing is complete only when proxied domains use the expected outbound, direct destinations remain reachable, and regular DNS works again after disabling FakeDNS and clearing the cache. A single speed test is no substitute for these three checks.
Common issues: cache, IPv6, and recovery after disabling FakeDNS
Why do websites time out after I turn off TUN?
The system or an app may still have a virtual IP cached, while the path that restores the domain has stopped. Restore your original DNS and system proxy settings, run ipconfig /flushdns, then fully quit and reopen the browser. If only one app is affected, clear its own DNS cache or restart it instead of repeatedly switching nodes.
Why does DNS still return a public IP with FakeDNS enabled?
First confirm that the query reaches the core configured with FakeDNS. Then check whether DNS rules select a real DNS server for that domain. Browser secure DNS, app-level resolution, or DNS on another network adapter may bypass FakeDNS. Do not blindly set system DNS to 127.0.0.1 just to force a virtual result; that address must have a listening service with a reliable lifecycle.
Why do some websites still fail when IPv4 works?
Check how AAAA queries and IPv6 connections are handled. An IPv4-only address pool does not mean IPv6 automatically follows the same policy; real IPv6 connections may take a different path. Keep DNS responses, interception scope, and routing rules aligned, and test A and AAAA queries separately. Disabling IPv6 is not a universal fix.
Why do old connections stop working after the core restarts?
The runtime mappings may have been rebuilt while the app still has the old virtual IP. Clear the cache, reconnect, and check the mapping recovery and outbound logs. To roll back, restore your backed-up DNS and routing configuration, restart the core as required by the client, and verify regular DNS and direct access. Do not stop after toggling off a single setting in the interface.
FakeDNS preserves domain information along specific traffic interception paths. It does not change VMess or VLESS authentication settings, repair a broken subscription, or make an unreachable node work. Consider enabling it only after your basic connection is stable, you have a clear need for domain-based routing, and you can verify and roll back the configuration. If your browser only stalls occasionally, first narrow down the cause by checking the system proxy, DNS, and routing steps in the troubleshooting guide.