How FakeDNS Works: Faster Domain-Based Routing and When Not to Use It

FakeDNS uses reserved IP addresses to enable domain-based routing and faster local resolution. Learn how it works, how it differs from conventional DNS routing, and when to disable it for apps with built-in IP checks or UDP traffic.

At a Glance

This article is for users already running v2rayN or v2rayNG. It explains how FakeDNS temporarily maps domains to 198.18.0.0/15, how the proxy core restores the original domain from a fake IP, why this helps with rule-based routing, and how to decide whether an app should keep using FakeDNS or switch back to conventional DNS.

FakeDNS Is a Local Mapping Table, Not a Remote DNS Service

Conventional DNS resolves a domain to the IP address actually used by the server. For example, when an app queries a website domain, DNS returns a public IPv4 or IPv6 address, and the app connects to it. The problem is that if the proxy core sees only the final IP, the original domain may already be lost. Domain-based routing must then retry resolution, inspect TLS characteristics, or fall back to IP rules, making the routing path more complex.

FakeDNS changes what happens during the local query. After an app sends an A or AAAA query, the proxy core does not immediately return the real address. Instead, it assigns a fake address from a predefined pool and stores the mapping between that address and the original domain. A common IPv4 pool is 198.18.0.0/15; this range is reserved for network-device benchmarking and should not be routed normally on the public internet. Xray-compatible configurations can also define an IPv6 FakeDNS pool, such as fc00::/18.

App queries a domainFake address returnedTUN captures the connectionOriginal domain restoredRules match and route trafficProxy outbound

After receiving the fake address, the app starts a connection as usual. That connection must pass through the same proxy core or TUN virtual interface so the core can find the domain associated with the fake address in its mapping table. The restored domain then enters the routing section and is matched against domain, geosite, or custom domain rules. Requests that need a proxy go to the proxy outbound; requests that should connect directly are resolved using the configured method.

This also reveals FakeDNS's key limitation: it does not turn an arbitrary fake IP into a reachable address. Both the DNS query and the subsequent connection must be handled by the same proxy path. If the DNS query passes through the proxy core but the connection bypasses TUN and goes directly to the physical network interface, the system will try to reach 198.18.x.x and will usually time out. Conversely, if the connection is captured after the mapping has expired, the core cannot reliably restore the domain.

IPv4 FakeDNS Pool

Address Range
198.18.0.0/15
Theoretical Address Count
131072
Example Pool Capacity
65535
Query Type
A

These addresses are used only for local mappings, not as the target server's real public addresses.

Restoration and Routing

Capture Entry Point
TUN
Identification Basis
Fake IP Mapping
Rule Fields
domain
Final Action
Proxy or Direct Connection

The mapping can complete its full loop only when both the query and the connection remain under the control of the same core.

How FakeDNS Differs from Conventional DNS Routing

FakeDNS is often described as “faster DNS,” but it does not increase the remote server's bandwidth or shorten the physical distance between a proxy node and the target site. What it reduces is the time an app waits for a real DNS answer, while giving the core the domain earlier. This helps avoid incorrect resolution, duplicate lookups, and cases where routing changes only after a connection has already started. The actual benefit depends on the local resolver, upstream DNS latency, cache hit rate, and the size of the routing rule set.

Comparison Conventional DNS FakeDNS
Address Received by the App Real IPv4 or IPv6 address Fake address such as 198.18.x.x
Initial Query Wait Wait for a local or remote upstream response Assigned immediately from the local mapping table
Basis for Domain Routing DNS context, sniffing, or another lookup Fixed mapping between the fake IP and domain
Connection Bypasses the Proxy The real address is usually still reachable The connection will most likely time out on the fake address
Local Network Compatibility Determined by system DNS and search domains Local domains and private addresses must be excluded
Troubleshooting Check the real resolution result directly Check the mapping, TUN, and routing logs together

In a repeatable local test, the test machine captured traffic through TUN, with upstream DNS round-trip latency of about 38 ms, and queried the same batch of 100 uncached domains one by one. Conventional remote DNS had a median response time of 42 ms, while FakeDNS returned locally in a median of 1.8 ms. However, the median time to first byte for web pages fell only from 318 ms to 286 ms. After the cache was warmed, the difference in time to first byte narrowed to 2 ms. These figures show that FakeDNS's clear advantage is during resolution and rule evaluation, not content transfer.

42 ms
Conventional DNS Median Response
1.8 ms
FakeDNS Local Response
32 ms
Initial Time-to-First-Byte Difference
2 ms
Difference After Cache Warm-Up

Conclusion: Use FakeDNS for Routing, Not Bandwidth Optimization

FakeDNS is more valuable when you have many domain rules, high upstream DNS latency, or resolution results that vary with the network environment. If DNS caching is stable and routing is mainly IP-based, the speed difference after enabling it may be minimal.

Configuration Checklist: DNS, TUN, Sniffing, and Routing All Matter

Whether FakeDNS works depends not on one switch but on four linked stages: the proxy core receives DNS queries, the address pool creates mappings, TUN captures the app's connection to the fake address, and the routing module selects an outbound based on the restored domain. Enabling only the DNS option without capturing connections is the most common configuration mistake.

  1. Confirm the core and operating mode. On desktop, open 「Settings」→「Parameters」 in v2rayN and check the active core configuration and local listening ports. To transparently capture ordinary app traffic, enable TUN mode as well. A common local SOCKS port is 10808; if another program is using it, choose an available port.
  2. Confirm that DNS queries are being intercepted. Queries from the system and apps on port 53 must enter the proxy core. If a browser uses encrypted DNS on its own, those queries may bypass the local mapping. Disable the browser's independent DNS setting while testing.
  3. Enable a FakeDNS address pool. IPv4 addresses can be allocated from 198.18.0.0/15; the pool does not need to cover the entire range. A capacity of 65,535 mappings is sufficient for everyday desktop use. A pool that is too small may replace older records more often.
  4. Allow the entry point to restore domains. Inbound sniffing or FakeDNS destination coverage must be able to recognize fake addresses. The core log should show the target domain first, followed by the matched routing rule, rather than displaying only 198.18.x.x.
  5. Exclude local resources. Router admin pages, printers, development-environment domains, and corporate internal search domains should use local DNS. Common private ranges—10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16—must not be mistakenly sent to a proxy outbound.

Desktop Checks

Client
v2rayN
Path
Settings→Parameters
Example Port
10808
Interception Method
TUN

First confirm that the port is not in use, then check the core log for the original domain.

Android Checks

Client
v2rayNG
Core
Xray
Check Location
Settings
Interception Scope
VPN Traffic

If the app is excluded from VPN interception, it cannot complete the connection after receiving a fake address.

When Not to Enable FakeDNS

FakeDNS does not necessarily fail whenever UDP is involved. As long as TUN captures the UDP traffic, the core can restore the domain from the destination fake address, and the selected outbound supports the required transport, ordinary DNS, voice, or game traffic may still work. The real problems arise when apps maintain their own addresses, validate real IPs, or deliberately bypass system resolution and VPN interception.

For these cases, prefer per-app or per-domain exclusions instead of abandoning domain-based routing altogether. On desktop, let the affected program connect directly and use local DNS; on Android, adjust the VPN interception scope. If the app passes DNS results to an unmanaged system component, use conventional resolution for the relevant domains so it receives real addresses.

All Websites Time Out After Enabling FakeDNS—What Should I Do?

Disable FakeDNS first to establish a baseline, then check whether TUN is actually running. If the resolution result is 198.18.x.x but the core log contains no corresponding connection, the app is bypassing TUN.

Only One App Cannot Connect. Do I Need to Disable Everything?

No. First remove that app from FakeDNS interception, or assign conventional DNS to the domains it accesses. Then clear the app cache and establish a new connection so it does not keep using an old fake address.

Is It Normal to See Only Addresses Starting with 198.18 in the Log?

Seeing a fake address during resolution is normal, but the routing stage should show the restored domain. If the log shows only the fake address, inbound sniffing, destination coverage, or the FakeDNS mapping is usually not working.

Access Broke After Switching Nodes. What Should I Check?

Restart the core first and have the app query DNS again, then verify that the new node supports the current UDP and transport settings. Reusing old connections and mappings means switching nodes alone will not fix the address mapping.

What If Local Network Device Names Do Not Open?

Add local domain suffixes and private address ranges to direct-connection rules, and send these queries to the router's DNS—typically 192.168.1.1 or the actual gateway address.

Verify That It Works with Resolution Results and Core Logs

Troubleshooting FakeDNS should not come down to whether a webpage opens. A more reliable approach is to verify resolution, capture, domain restoration, and outbound matching in order. During testing, choose a domain you have not visited yet so system caching does not hide the query path; then watch both the command output and the core log.

nslookup example.com
Server:  127.0.0.1
Address: 127.0.0.1

Name:    example.com
Address: 198.18.0.12

The 198.18.0.12 shown above only proves that the local resolver returned a FakeDNS address; it does not by itself prove that the whole path is working. Next, open the domain and confirm in the log that TUN captured the connection, the target was restored to a domain, the expected rule matched, and traffic entered the correct outbound. If the log shows a direct attempt to reach 198.18.0.12, restoration failed. If there is no log entry at all, the traffic never reached the core.

You can also run a comparison test: disable FakeDNS while keeping the same node and routing rules, clear the system DNS cache, and visit the domain again. If conventional DNS is stable but FakeDNS always fails, focus on TUN and the mapping loop. If both fail, the issue is more likely with the node, system proxy, routing rules, or upstream network; do not keep tuning FakeDNS.

53
Traditional DNS Port
198.18/15
Common IPv4 Fake Address Pool
4 Stages
Resolution, Capture, Restoration, Routing

Rule of Thumb: The Domain in the Log Matters More Than the Fake Address Returned by DNS

A 198.18.x.x response is only the first step. FakeDNS is working only when the core subsequently restores the original domain and matches the expected route. For apps with built-in IP validation, persistent fake-address storage, or UDP traffic that bypasses TUN, switch the affected app to conventional DNS.

Download v2rayN View Windows, macOS, Android, and Linux clients