Sep 9, 2026 · Advanced · About 12 min

FakeDNS Explained: Virtual IPs, How It Works, and When to Use It

Learn how FakeDNS intercepts DNS queries and returns virtual IPs, how it works with domain-based routing and TUN mode, and when to leave it off.

At a glance

FakeDNS uses locally assigned virtual addresses to preserve domain information. It is neither a public DNS service nor a proxy protocol. This guide is for users with a working connection who are considering changes to TUN or domain-based routing. Follow the query-to-connection flow, check the configuration requirements, then troubleshoot caching, DNS interception, and LAN access. If you have no specific need for it, keep your current working setup with real address resolution.

How FakeDNS Works: Virtual IPs as Mapping Keys

A standard DNS lookup resolves a domain to the real address of its destination. FakeDNS instead picks an address from a local pool, maps it to the domain, and returns the virtual address. For example, a query for the A record of example.org might return 198.18.0.1. This is only an example; the actual allocation order depends on the implementation and runtime state.

Domain lookup Virtual IP assignment Connection interception Domain recovery Routing rule

The application then connects to that virtual IP. A component intercepting the traffic reads the destination address, looks up the associated domain, and passes it to the routing and outbound logic. The key is not simply returning a “special IP”: the DNS query and the subsequent connection must pass through a processing chain that can access the same mapping.

198.18.0.0/15 is a reserved range for benchmarking, spanning 198.18.0.0 to 198.19.255.255. It is not a range of regular public service addresses. FakeDNS often uses it, though implementations may use different pools. If a virtual address bypasses interception and is sent directly to the physical network, it generally cannot reach the original website.

TUN and Domain-Based Routing: Interception, Recovery, and Matching

TUN receives IP packets at the network layer. When it first intercepts a connection, the available information is often limited to the destination IP, port, and transport protocol. If the application has already resolved the domain, the domain may no longer appear in the packet. FakeDNS stores the domain-to-address mapping in advance, giving domain rules a way to identify the destination.

  1. Intercept DNS: The application's queries must enter the intended DNS processing chain. Traditional DNS commonly uses UDP port 53, but may also use TCP port 53. Handling only one does not mean all queries are intercepted.
  2. Intercept connections: TCP or UDP traffic to the virtual address pool must enter the appropriate TUN, routing, and core processing chain. Exclusion rules must not bypass it.
  3. Recover the domain: The component handling the connection must be able to access the mapping. In Xray, the relevant settings involve FakeDNS and inbound sniffing; adding a name to the DNS list alone is not enough to complete the flow.
  4. Apply routing rules: Once the domain is recovered, domain rules, IP rules, and fallback rules determine the outbound route. Protocols such as VMess and VLESS handle proxy transport afterward; they do not create the mapping.

When a browser accesses an HTTPS site through the system HTTP proxy, its CONNECT request can include the target hostname. SOCKS5 can also use a domain-name address type. These routes may already pass the domain to the proxy, so FakeDNS may not be necessary. If an application resolves the domain locally and submits only an IP, check how the domain information can be recovered.

Check First: Does the Domain Reach the Routing Layer?

If your current system proxy route already matches domain rules, leave it as is. Consider FakeDNS only if domain information is missing after TUN interception and both DNS queries and connections can enter the same processing chain.

Configuration Check: The Address Pool and Recovery Path Must Work Together

v2rayN is a desktop client, v2rayNG uses the Xray core, and v2flyNG uses the V2Fly core. The client interface, selected core, and TUN integration component are separate layers. The client name alone does not tell you whether a configuration field is supported. The keys below illustrate how Xray settings relate to each other; they do not imply that all three clients have identically named options, and they are not a complete configuration to import.

Virtual IP allocator

Configuration object
fakedns
Example address pool
198.18.0.0/15
Example capacity
poolSize: 65535
DNS service entry
fakedns

Capacity is an example setting, not a promise about node count or concurrency. Defining an address pool is not enough; the relevant queries must also use it.

Connection handler

Inbound configuration
sniffing
Enable field
enabled: true
Recovery type
destOverride: ["fakedns"]
Interception scope
Connections to the virtual address pool

Check the inbound that actually handles the traffic, rather than adding a field to an inbound that receives none.

This Xray-native JSON snippet shows only the link between the address pool and built-in DNS. It omits inbound, outbound, routing, and interception settings, so it cannot replace the complete file generated by your client. If another component handles TUN and DNS, follow that component's configuration structure instead of mixing fields.

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

Use Cases and Side Effects: Virtual IPs Don't Suit Every Application

FakeDNS can reduce the need for some connections to obtain real addresses locally and help domain rules identify requests that have become IP connections. It does not automatically speed up remote resolution or fix unavailable nodes, incorrect TLS settings, or misordered routing rules. Judge whether it helps by domain recognition and application compatibility—not by whether DNS replies appear faster.

Use caseMain impactRecommendation
Domain-based routing with TUNThe mapping can restore domain information for IP connectionsVerify the full path through DNS, the virtual subnet, and the recovery handler
LAN services and internal domainsService discovery or internal DNS lookups may be intercepted incorrectlyKeep real DNS resolution and a direct route for internal domains and subnets
Corporate network using an overlapping subnetThe virtual pool may conflict with existing routesCheck the routing table; change the pool or disable the feature if the implementation allows
Application validates DNS resultsThe app may reject reserved addresses or cache virtual IPsUse real address resolution for that app, then test sign-in and connectivity again
Application uses encrypted DNSQueries may bypass interception of standard port 53 trafficCheck the app's DNS settings. Don't mistake encrypted connections for standard DNS and forcibly redirect them

An app that connects directly to an IP literal never looked up a domain, so FakeDNS cannot supply one. Multicast name discovery on a LAN is also different from ordinary unicast DNS. Changing port 53 rules alone may not fix printer access, file sharing, or internal service discovery.

Trade-off: Keep Real DNS Resolution for Internal Services

If your work network relies on internal DNS, first check the resolution and connection paths for internal domains, DNS servers, and related subnets. If sign-in or service discovery breaks, disable FakeDNS first; don't mask the issue by expanding proxy coverage.

Testing: Check DNS, Mapping, and Outbound Routing Separately

Use the same test domain, keep the node and routing rules fixed, and change one setting at a time. Seeing a virtual IP only confirms that one query received a virtual response; a website loading does not prove every app used the same route. Check the DNS result, interception logs, and matched routing rule together.

  1. Establish a baseline: Turn off FakeDNS and record whether the test domain is reachable, its current DNS result, and the outbound rule used. Keep a recoverable copy of your settings and don't change server addresses in your subscription.
  2. Check the DNS response: Turn it on and query the same domain. Confirm that the A record falls within the configured virtual address pool. If you still get a real IP, check caches, app-specific DNS, and DNS routing before changing the pool.
  3. Check domain recovery: Start a new connection and check whether the logs associate it with the original domain and expected outbound route. If you see only a direct connection to the virtual IP, check the recovery handler and subnet routing first.
  4. Check compatibility: Test a website, an internal service, and a non-browser app separately. Test UDP apps independently too; a successful TCP connection in a browser does not verify UDP.

On Windows, first check the DNS result currently in use, then clear the system DNS cache after switching setups. The commands below query and clear the cache, respectively; they are not performance tests and don't guarantee a specific address.

nslookup example.org
ipconfig /flushdns

Clearing the system cache does not clear browser or app caches. After FakeDNS is disabled or the mapping component restarts, an app may still hold an old virtual IP. If its mapping has disappeared, connections using that address will fail. To roll back, stop the affected apps, clear the system cache, then reopen the apps and test again.

FAQ: Troubleshooting Problems After Enabling FakeDNS

Does a 198.18.x.x address mean DNS is broken?

Check the actual address pool first. If FakeDNS is enabled and configured to use 198.18.0.0/15, this may be expected. Start a connection and check domain recovery and outbound logs. If those addresses keep appearing after you disable the feature, clear system and app caches and check for another DNS interception component still running.

Why does my browser work, but other apps lose network access?

Check whether each app uses its own DNS, is excluded from TUN, or rejects reserved addresses. First switch the affected app back to real address resolution, then restart it and test again. Don't expand interception to every app just because the browser works.

Does enabling FakeDNS mean I no longer need remote DNS?

No. The virtual IP allocator handles only local mapping. Direct outbounds or remote proxies may still need to resolve domains to establish the actual connection. Check which component performs final resolution and how DNS traffic is routed. Make sure proxy server hostnames don't depend on a proxy connection that hasn't been established yet.

Pages still won't load after I turn it off. Should I reinstall the client?

Restore the original DNS and interception settings, run ipconfig /flushdns, then close and reopen your browser. Check whether the system proxy still points to a local service that has stopped. On Android, stop and restart the client's VPN connection and affected apps, then test again. Old caches and leftover interception are usually worth ruling out first.

The key test is whether you can explain the connection path, domain rules match as expected, and everyday apps work reliably. FakeDNS is just one way to coordinate DNS with traffic interception; subscription import, node selection, system proxy, and TUN settings still need to be checked separately.

Download v2rayN