FakeDNS Explained: How It Works, When to Use It, and What to Check

Learn how FakeDNS maps domains to virtual IPs, why it helps with TUN routing, and how it can conflict with some apps and DNS caches.

At a glance

FakeDNS can help when transparent traffic interception leaves you with a destination IP but no original domain. For v2rayN and v2rayNG users setting up TUN or VPN routing, this guide explains virtual IP mapping, which requests still need regular DNS resolution, and how to verify the setup with logs and cache clearing. If domain-based routing already works, there’s no need to enable FakeDNS just to add another switch.

How FakeDNS Works: Preserving Domains with Virtual IPs

FakeDNS is neither a proxy protocol nor encrypted DNS. Regular DNS returns the real address for a domain; FakeDNS assigns a virtual IP from a dedicated pool and records the domain-to-IP mapping. When an app connects to that address, the traffic-intercepting core uses the mapping to recover the original domain before routing the connection and selecting an outbound.

Domain lookup Virtual IP assignment App connects Domain recovered from mapping Routing rule selects an outbound

Xray must handle both the DNS request and the subsequent connection. For example, an app looks up example.com and gets 198.18.0.1 from the pool. The connection to that address must then pass back through the core that holds the mapping. This IP is an illustrative assignment, not the domain’s real address or a server address to enter in a node configuration.

TUN and Domain-Based Routing: What FakeDNS Solves

With v2rayN’s system proxy, apps typically use an HTTP or SOCKS proxy directly and can pass the domain to the proxy. TUN captures traffic at the network layer, where the core may see only the resolved IP. FakeDNS helps preserve the domain information needed to match domain-based routing rules in this situation.

v2rayNG receives device traffic through Android’s VPN interface, but VPN capture does not automatically enable FakeDNS. Whether DNS reaches the core, whether the core assigns a virtual IP, and whether the connection’s domain is recovered are three separate conditions. TLS or HTTP sniffing can also reveal some domain information, but its effectiveness depends on the protocol and app behavior; it isn’t a reliable replacement for every connection.

Explicit proxy path

Traffic entry point
HTTP or SOCKS inbound
Where the domain comes from
Destination domain supplied by the app
What to check
Whether the app uses a proxy and performs remote DNS resolution
When to enable it
Usually unnecessary if the domain is already passed through intact

A SOCKS app may resolve the domain locally and pass only the IP. Don’t infer behavior from the proxy type alone.

TUN and VPN path

Traffic entry point
Virtual network interface
Where the domain comes from
FakeDNS mapping or other available metadata
What to check
DNS interception and virtual IP routing
When to enable it
Consider it when domain-based routing needs to be reliable

Virtual IP mapping works only if both DNS queries and subsequent connections are intercepted.

VLESS and VMess handle proxy connections; FakeDNS handles local DNS and destination information. Switching proxy protocols won’t fix a broken mapping path. v2flyNG uses the V2Fly core, so check configuration options and field support against the actual core. Don’t assume an Xray example works unchanged across all three clients.

Address Pools and Config Fields: Three Numbers to Know

53
Traditional DNS server port (UDP/TCP)
131072
Total number of addresses in an IPv4 /15 subnet
65535
poolSize value in the example below

Xray’s FakeDNS configuration can use 198.18.0.0/15 as an IPv4 address pool. This subnet is reserved for benchmarking and isn’t a regular address range for reaching public services. The total number of addresses in the subnet and poolSize are different things: the prefix length determines the former, while the latter sets the mapping pool’s capacity in the implementation.

{
  "fakedns": [
    {
      "ipPool": "198.18.0.0/15",
      "poolSize": 65535
    }
  ]
}

This Xray snippet shows only the top-level address pool definition; it is not a complete, runnable configuration. Integration also requires a fakedns server entry in the built-in DNS settings and support for restoring domains on the inbound that receives connections, such as sniffing.destOverride support for fakedns. Adding the address pool alone won’t redirect system DNS automatically.

When to Use FakeDNS

FakeDNS is most useful for transparent traffic interception when routing depends on domains that aren’t available directly from the app. It can reduce the impact of prior real DNS resolution on domain detection, but it doesn’t guarantee faster page loads. The selected outbound, server reachability, and resolution of the real destination can all affect the connection.

Use caseRecommendationWhat to verify
Route by domain after TUN captures trafficWorth evaluatingLogs recover the domain and the connection matches the expected rule
Browser uses an explicit proxy and passes the domainKeeping the current setup is also fineWhether the app already passes the domain to the proxy
Accessing corporate intranet domains and private IPsConfigure exceptions for regular DNS resolution firstThe intranet DNS, returned address, and direct route work together
App connects directly to a fixed IPFakeDNS can’t recover the original domainUse IP-based rules or another approach suited to the app
App has built-in encrypted DNSFirst check whether its queries bypass the built-in DNSIntercepting port 53 alone won’t cover DNS queries made inside the app

Use extra caution with FakeDNS for intranet domains. Corporate services may require a designated DNS server to return private IPs. Using regular DNS for these queries and setting the relevant connections to go direct often preserves existing access behavior more reliably. Configure exceptions in the DNS and routing implementation you actually use; adding a direct-route rule alone won’t change how DNS queries are resolved.

Before Enabling FakeDNS: Check DNS, Outbounds, and Caches

  1. Record a baseline. Note the client version, core version, DNS settings, and TUN or VPN status. Visit a domain and save the logs so you can compare results later.
  2. Check the DNS entry point. Confirm whether system DNS is intercepted. Secure DNS in browsers and app-level DoH may bypass it. For testing, you can temporarily set the test app to use system DNS, then restore its original setting afterward.
  3. Confirm that connections return to the core. Check whether the active TUN or VPN routes the virtual IP pool. With per-app proxy settings on Android, an excluded app might receive a virtual IP but be unable to send its connection back through the core.
  4. Check how real destinations are resolved. If the proxy server address is a domain, it needs a working bootstrap DNS path; it can’t rely on the proxy to resolve its own address before the connection is established. Direct connections may also need a real IP address.
  5. Change one variable at a time. Keep the node and routing preset unchanged, and adjust only the FakeDNS settings first. Don’t switch the core, protocol, DNS, and routing rules at the same time, or it will be hard to pinpoint the failure.

The settings screens in v2rayN and v2rayNG can change between versions. Rely on the active configuration and logs, not the location of a toggle in an old screenshot. If the current version doesn’t expose the required settings, stick with a verified mode. Custom configurations require understanding DNS, inbounds, and routing—not just adding a field.

Testing and Rollback: Check Resolution and Connections Separately

Test FakeDNS in two steps: first inspect the system’s DNS response, then check the actual connection to the same domain. On Windows, run the command below in Command Prompt. nslookup tests the DNS path it currently uses; it doesn’t show whether the browser’s own DNS uses that same path.

ipconfig /flushdns
nslookup example.com

FakeDNS mappings are generally runtime state. After a core restart, mapping eviction, or configuration change, an app may still have an old virtual IP cached while the new core no longer knows which domain it belongs to. Switching nodes repeatedly usually won’t help; clear the cache and reconnect first. Windows’ ipconfig /flushdns clears only the system DNS cache, not every app’s own cache.

Common Questions: Virtual IPs, App Conflicts, and Battery Use

Is a 198.18.x.x address a sign that DNS is broken?

If FakeDNS is enabled with an address pool of 198.18.0.0/15, this may be expected. First check whether the queried domain should use FakeDNS, then see whether the connection logs recover that domain. The address alone doesn’t indicate a failure, and it shouldn’t be saved as a website’s permanent IP.

Why do some apps still time out after I turn off FakeDNS?

The app may have cached an old virtual IP. Restore the original DNS settings, reconnect the client, run ipconfig /flushdns on Windows, then fully quit and reopen the app. On Android, force-stop the affected app before testing again; don’t start by clearing its data.

How do I troubleshoot a game or work app that won’t connect?

First test a regular-DNS exception for the domains the app needs, leaving all other settings unchanged. Some apps check address types, use fixed IPs, or perform their own resolution. Other websites working doesn’t rule out a compatibility issue. If regular DNS fixes it, check the app’s DNS and routing requirements.

Will enabling FakeDNS in v2rayNG use more battery or make connections faster?

Neither is guaranteed. FakeDNS maintains mappings and helps recover destinations, but battery use also depends on network wake-ups, app retries, and how long the VPN runs. Compare results with the same network, node, and app workload. If logs show frequent retries, fix the broken connection path instead of increasing the address pool.

Enable FakeDNS only when you can verify domain recovery and correct routing. If v2rayN, v2rayNG, or v2flyNG is already working reliably, there’s no need to change it just to add a feature. Before putting FakeDNS into everyday use, make sure you understand the DNS entry point, virtual IP routing, regular-resolution exceptions, and cache recovery.

Download v2rayN