V2Ray FakeDNS Explained: Fake IPs, Domain Recovery, and Use Cases

FakeDNS maps each domain to a reserved-range fake IP, then restores the domain for outbound routing. Learn how it works with TUN, when to use it, and what can go wrong.

At a glance

FakeDNS uses a local address range to map domains queried by apps. With TUN enabled, the client must handle both DNS queries and connections to fake IPs to recover the domain before routing. When troubleshooting, test these paths separately: getting a fake IP confirms address allocation, not that the connection was intercepted or routed correctly.

How fake IP allocation and domain recovery work

Take an A record lookup for example.org. Regular DNS returns a real address that can be used to connect. With FakeDNS, the lookup may return 198.18.0.8, while a local mapping records the association with example.org. This is an example address, not the domain’s actual DNS result or a publicly reachable server.

Domain lookupFake IP allocationConnection interceptionMapping lookupRule matchingOutbound connection

The app then connects to 198.18.0.8. A FakeDNS-aware interception component looks up the original domain, allowing routing to select an outbound based on domain rules. The target domain can be passed to a proxy outbound that supports domain targets, or resolved to a real address before a direct connection is made. Which side performs DNS resolution depends on the outbound implementation and settings; the fake IP should not be the final connection target.

198.18.0.0/15
Benchmarking subnet commonly used for IPv4 fake IP pools
131,072
Total number of addresses in this subnet; not the mapping table’s capacity
53
Standard DNS port, used with UDP and TCP

Domain recovery looks up the local mapping table; it does not perform a PTR reverse lookup or wait for the app to send a TLS handshake. If an app still uses a cached fake IP after the core that created it has restarted without preserving the mapping, the old address may no longer be recoverable. DNS cache lifetime and core mapping lifetime are not the same.

DNS and connection interception in TUN mode

TUN is a virtual network interface that receives IP traffic. A destination IP alone does not reveal the domain the app originally accessed. For FakeDNS to work, the app’s DNS query must reach a resolver that can create the mapping, and its connection to the fake IP must pass through a component that can read that mapping. Enabling TUN alone or changing the DNS server alone does not guarantee both paths are in place.

DNS query

Test domain
example.org
Record type
Query A first, then AAAA if needed
Example fake IP
198.18.0.8; the address assigned may differ
Where to check
Client DNS logs and system resolver results

A match in the fake IP pool confirms only the query path. Next, verify the app’s connection.

Connection interception

App destination
Fake IP returned by the lookup, e.g. 198.18.0.8:443
Interception requirement
The fake IP range must use the intended TUN route
Routing basis
Once recovered, example.org can match domain rules
Where to check
Active routes and core connection logs

With a direct outbound, the final connection should still use a real address.

In v2rayN, first check the main window to confirm that TUN is enabled, then verify which core is running and which configuration is actually in effect. Importing a subscription only adds connection profiles; it does not confirm that DNS or TUN settings are active. Check configuration fields and supported features against the core in use: do not copy a DNS snippet from one implementation directly into another.

An app may bypass the system resolver and send DNS queries over HTTPS. These queries do not use the traditional DNS port 53, so intercepting that port alone will not cover them. Conversely, if only A queries use FakeDNS while AAAA queries return real addresses, a dual-stack app may connect directly to an IPv6 destination. When troubleshooting, record both query results separately; one A record does not tell you how all of the app’s traffic is routed.

Use cases and routing exceptions

FakeDNS is most useful when an app does not use an explicit proxy, its traffic is captured by TUN, and routing needs to match domains rather than destination IPs. Multiple domains can share a real IP, while one domain may resolve to different addresses depending on region or load. Destination IP alone may not distinguish these requests; preserving the queried domain lets routing rules match the intended hostname directly.

Connection methodRecommendationWhy
TUN interception with domain-based routingEnable it and verify each stepThe app looks up a domain and connects to the returned address; both the query and connection can be intercepted.
App passes the domain directly to an explicit proxyUsually not neededThe proxy already knows the target domain, so there is no need to create a fake IP and look it up again.
Corporate or local network servicesKeep real DNS resolution where neededDomains that rely on internal DNS must use the correct resolver. After real addresses are returned, confirm that the traffic uses the intended interface.
Testing real IPs or connecting directly to an IPFakeDNS not requiredA fake IP does not indicate public reachability, and a direct IP connection has no original domain to recover.

When setting exceptions, distinguish DNS policy from traffic policy. Routing an internal domain directly does not automatically send its DNS queries to internal DNS. Likewise, having internal DNS return a real address does not guarantee that traffic will leave through the internal interface. Verify both separately, especially when a corporate VPN or virtual machine network is also running. If an existing network uses all or part of 198.18.0.0/15, check for overlapping routes to prevent the same address from matching two interception rules.

Fake IP returned, but connections fail: troubleshooting steps

Choose a domain you’re allowed to test, then note the active node, TUN status, and the app’s DNS settings. The examples below only show how the system-configured DNS server responds to A and AAAA queries; they do not reflect browser caches or an app’s own encrypted DNS. After querying, reconnect from the affected app and compare the client logs from the same time.

nslookup -type=A example.org
nslookup -type=AAAA example.org
  1. Check the DNS response. Compare the returned address with the actual fake IP pool. If system queries and app behavior differ, first check whether the app uses its own resolver or is still using cached data; don’t change nodes yet.
  2. Check whether the connection reaches the core. If the app connects to a fake IP but the core shows no corresponding entry, verify that the fake IP range uses the intended interface. On Windows, run route print to view active routes and check for more specific routes pointing to another interface.
  3. Check the domain and outbound. If the connection reaches the core, check whether the logs show the original domain and the expected outbound. If the domain was recovered correctly, troubleshoot subsequent timeouts or certificate errors as outbound, real DNS, or server connectivity issues—not as fake IP pool problems.

DNS returns a 198.18 address, but the site still won’t load?

Close existing tabs, reopen the test site, and compare the core connection logs. If there is no matching inbound entry, check the TUN route first. If there is an entry but the destination remains a fake IP, check whether DNS allocation and connection recovery are handled by the same mapping component.

After restarting v2rayN, do only previously opened sites fail?

On Windows, run ipconfig /flushdns to clear the system DNS cache, then quit and restart the affected app. This system command does not clear an app’s separate cache. When testing again, check the logs for a new query and connection.

Why does a command-line test work while an app ignores domain rules?

Check whether the app uses its own DNS, a cached address, or a direct IP connection. Compare the destination address used by the app with the system query result. If the target is a real IPv6 address, investigate the AAAA resolution path and IPv6 interception rather than expanding the IPv4 pool.

Why are requests still going to fake IPs after FakeDNS is turned off?

First confirm that DNS now returns real addresses, then clear system and app caches and reconnect. If requests still go to old addresses, check whether the app has cached its destination or another DNS component is still returning fake IPs.

Download client