FakeDNS uses virtual addresses to keep track of the domain an app originally tried to reach. This guide is for users configuring v2rayN TUN or troubleshooting connection failures after switching modes. Follow where the mapping is created, decide whether your routing setup needs it, and distinguish DNS, connection, and outbound issues.
How FakeDNS Works: Mapping Virtual IPs Back to Domains
A TUN interface receives network-layer packets. For apps that resolve a domain before connecting, the destination field usually contains only an IP address by the time the connection reaches TUN. Since multiple domains can share the same real IP, that address alone cannot reliably reveal which domain the app originally looked up. FakeDNS preserves that information during the DNS query instead of trying to infer it later from the real address.
- Intercept the query. The app sends an A or AAAA query. It receives a synthetic response only if the query follows the configured DNS path and matches a rule that uses virtual addresses. Enabling TUN does not mean every query takes this path; app caches and built-in encrypted DNS can change the route a query actually takes.
- Assign an address. For example, if the IPv4 virtual address pool is
198.18.0.0/15, a response might return198.18.0.10. This illustrates the mapping; it is not a fixed response. The range is reserved for network device benchmarking, not for ordinary public destinations, and does not mean a server is actually hosted at that address. - Recover the domain. The app then connects to the virtual address. The component handling that connection looks up the still-valid mapping and passes the original domain to the routing logic. It checks a local mapping table; it does not send a PTR reverse lookup to a DNS server. Where the real address is resolved after an outbound is selected depends on that outbound and its settings.
So seeing a virtual address only confirms that a synthetic response was returned; it does not mean the site is reachable. The subsequent connection must also enter a processing path that can access the mapping. After a core restart, an app may still have the old address cached even though its mapping is gone. The result can be a successful lookup followed by a connection timeout.
Standard DNS vs. FakeDNS: Responses and Routing Inputs
| Comparison | Standard DNS | FakeDNS |
|---|---|---|
| Address returned | Returns the destination address from the DNS response | Returns a virtual address from the pool when a synthetic-response rule matches |
| Domain information | If only an IP is available later, another source of domain information is needed | A valid mapping lets the later connection recover the original query name |
| Real address resolution | Usually completed before the destination connection is established | Can be deferred until an outbound is selected, then handled by the relevant component |
| What to check | Check that the resolver returns an address suitable for the destination network | Check that the query and connection pass through the same mapping path |
Standard DNS can also work with domain-based routing. For example, an app that supports HTTP proxies may send the destination domain in its CONNECT request; a SOCKS-capable app may likewise pass the domain to the proxy instead of a resolved address. Protocol sniffing is another source of domain information, such as reading a visible TLS server name, but not every connection includes one that can be identified. FakeDNS relies on a previous query record, so it cannot recover a domain from a connection to an IP entered directly.
Bottom line: confirm that domain matching is the problem
Use the same app to access the same destination, then check the destination and outbound shown in the logs. If the domain is already identified and the expected rule matches, keep your current DNS setup and investigate the outbound. Switching to FakeDNS will not fix an outbound timeout.
When to Enable or Disable FakeDNS in v2rayN TUN
TUN path for domain-based routing
- Query types
- Check A and AAAA separately
- Example IPv4 pool
198.18.0.0/15- Requirements
- Both the query and subsequent connection must follow a compatible processing path
- What to verify
- Routing logs link the connection to its original domain
Test virtual IP mapping only if the app exposes just the destination IP, preventing domain-based rules from matching.
Paths that require real addresses
- Typical destinations
- LAN devices and internal services
- Resolution method
- Keep a standard resolver that can resolve the domain
- Example response
192.168.1.20, depending on your network- What to verify
- Returns the real address, and the connection uses the expected interface
If your current setup cannot preserve real DNS resolution for internal names, use standard DNS instead.
In v2rayN, first check whether TUN is enabled, then review the options available in your version under Settings → Parameter Settings. Do not assume this is a fixed path to a FakeDNS switch: the visible options vary by version and selected core, and the client UI label may not match the core configuration field. Check the active configuration, actual DNS responses, and logs to confirm whether it is working.
If an app such as a browser already sends domain names to the proxy through the system proxy and routing works, there is usually no need to switch to TUN for FakeDNS. Conversely, test mapping only if the app ignores the system proxy, TUN is genuinely needed to capture its traffic, and logs show that only an IP remains when the connection arrives. For internal apps, keep real addresses when they check whether a destination is on a private network or pass DNS results to programs that TUN does not capture.
Virtual IP Returned, but the Site Won't Load: Troubleshoot the Three Stages
- Check the response first. In Windows PowerShell, run
Resolve-DnsName example.com -Type Ato check the IPv4 response for a public test domain. ReplaceAwithAAAAto check IPv6 separately. The absence of an AAAA record is not a problem by itself. The command only shows the result from its own DNS path; it does not guarantee that a browser or another app received the same response. Check the failing app's actual request too. - Next, check the connection. Keep the app, domain, and node the same, and change only the DNS setup. After switching, quit and reopen the test app. If the system cache still has an old response, run
ipconfig /flushdnsin Windows. This clears only the Windows DNS client cache; it does not clear an app's own cache or reset the core's mapping table. - Finally, check the outbound. In the same test, check whether the logs show the destination connection, recover the domain, and select the expected outbound. If there is no connection entry, check the traffic interception path first. If the virtual IP arrives without a domain, check the mapping. If the domain is recovered and the right outbound is selected, investigate that outbound's real-address resolution and reachability. Change one setting at a time so cache changes are not mistaken for a routing fix.
Why do DNS lookups still return public IPs with TUN enabled?
First check whether the destination matches a synthetic-response rule, then test it once with a system lookup and once in the affected app. If the results differ, check the app's DNS settings and cache. A standard DNS response may be expected by your rules; not every query needs a synthetic response.
Why does only the page that was already open keep spinning after I turn off TUN?
An existing page or browser process may still be reusing an old connection or trying to connect to a cached virtual address. Quit the browser completely, clear the system DNS cache, and reopen it. Before refreshing the page, check that a new lookup returns a real address.
Why do internal domains work intermittently after I connect to the company network?
First, make internal domains use the resolver specified by your company network, and note the addresses it returns. Check the DNS response and routing with TUN both enabled and disabled. If the virtual address pool overlaps with a network covered by existing routes, disable virtual address mapping for the test. Do not replace the internal resolver with a public DNS server.