FakeDNS assigns a temporary IP to link a DNS query to the connection that follows, allowing a transparent proxy to route traffic by domain. Two things must be in place: FakeDNS must answer the query, and an inbound that can read its mapping table must capture connections to the virtual IP. When troubleshooting v2rayN TUN or a custom inbound, check both paths. If you just need reliable direct access to LAN services, start by keeping normal DNS resolution.
How FakeDNS Recovers a Domain from a DNS Query
Suppose an app looks up the A record for example.com. With normal DNS, it gets the IPv4 address returned by the resolver. If FakeDNS handles the query, it might instead get a virtual address such as 198.18.0.7. This address is just an example to illustrate the process, not the site's actual IP. The component answering the query also records the mapping between the virtual IP and the domain.
The app then connects to 198.18.0.7:443. At this point, the transparent inbound sees the destination IP and port in the packet—not the domain from the earlier lookup. If a matching entry exists and the inbound can use it to recover the destination, the core can retrieve example.com and apply domain-based routing rules. The selected outbound and DNS policy determine where the real address is resolved. The virtual IP itself is not a destination that can be reached through an external server.
FakeDNS doesn't identify domains by inspecting web traffic, and it isn't a form of encrypted DNS. If an app's built-in encrypted DNS bypasses this resolution path, no matching virtual IP mapping is created. Likewise, an app that connects directly to a hard-coded IP has no domain for the mapping table to recover.
What TUN and Transparent Inbounds Do
TUN is a virtual network adapter that receives IP traffic routed to it by the operating system; it is not a DNS resolver. For FakeDNS to work, you also need to know what answers DNS queries, which route the virtual IP pool uses, and whether the inbound receiving the connection can restore the domain. Seeing TUN enabled in the client doesn't confirm that all three are working.
Transparent Capture and FakeDNS Resolution
- DNS response
- Selected queries return a virtual IP
- Connection capture
- Virtual IP pool routes to the appropriate inbound
- Domain lookup
- Inbound restores the domain from the same mapping
- What to check
- Check the destination and outbound tag in the routing logs
Useful for capturing app traffic that doesn't provide a domain but needs domain-based routing.
Explicit Proxy and Normal DNS
- App entry point
- Apps such as browsers use an HTTP or SOCKS proxy
- Domain lookup
- For example, an HTTPS CONNECT request includes the hostname
- Direct connection
- Apps that aren't captured continue using normal DNS
- What to check
- Check whether the app passes the proxy a domain or an already resolved IP
If the proxy request already includes the domain, you don't need an extra FakeDNS layer just to match domain rules.
For a hand-written Xray configuration, check the fakedns address pool, which replies are selected in dns.servers, and whether the inbound receiving the connection has fakedns set as a restoration type in sniffing.destOverride. Configuring an address pool alone doesn't handle both DNS routing and inbound restoration. With v2rayN, the actual path depends on the version, selected core, and generated configuration. Don't copy Xray inbound fields directly into a TUN configuration for another core.
When to Avoid FakeDNS
Direct connections don't always conflict with FakeDNS. If a connection is captured and its domain restored, the core can still select a direct outbound based on the rules and connect using the real IP. The more common failure is a direct connection that bypasses the inbound: the app gets a virtual IP from the shared DNS path, but its traffic misses the component that restores the address, so it can't reach the actual service.
- Corporate VPNs or internal domains: Use the DNS server specified by your organization to resolve internal domains, and route the real addresses through the corporate network. If the corporate VPN already has a subnet that overlaps the virtual IP pool, resolve the routing conflict before considering FakeDNS for other domains.
- LAN devices or excluded processes: Printers, file shares, and apps explicitly excluded from TUN shouldn't receive addresses that can only be restored by a proxy inbound. Check DNS exceptions and connection bypass rules together; changing just one may still leave connections timing out.
- Apps or rules that rely on real IPs: Some software checks the resolved address to determine where it belongs; some configurations choose a route based on the destination IP range. Don't mistake the virtual pool for a real server subnet. If you need to compare real IPs, keep normal DNS for the relevant domains first, then check that routing gets the real address at the right stage.
- Frequent core restarts or network changes: A core restart may clear virtual mappings while the operating system or app still has old answers cached. Those stale IPs can fail even when the node and subscription haven't changed. If your service can't tolerate brief interruptions, establish a working baseline with normal DNS first.
Troubleshooting FakeDNS: Responses, Inbounds, and Caches
Choose a domain that reliably reproduces the issue, keep the node and routing rules unchanged, and change one thing at a time. First record the address the app receives, then check whether the connection reaches the expected inbound, and finally check available core logs for the restored domain or matched outbound tag. This helps distinguish a DNS path issue from a connection that wasn't captured or a failure that occurred after the domain was restored.
Why Am I Still Getting the Real IP?
On Windows, run Resolve-DnsName example.com -Type A to check the result from the current system DNS path, then compare it with the affected app. If the command returns a real address, the domain may be configured for normal DNS, or the query may not be reaching FakeDNS. If only the browser behaves differently, check its Secure DNS settings; the command's result doesn't show what the browser resolved on its own.
Why Does the Connection Time Out Even with a Virtual IP?
First check that the address belongs to the virtual pool in the current configuration, then see which network adapter the system routes that subnet through. If there's no inbound log entry, check routing or process exclusion rules. If the inbound sees the connection but doesn't restore the domain, check its restoration settings and whether the mapping still exists. If the logs show the right domain and outbound tag, investigate outbound connectivity.
Why Won't a Previously Working Site Load After I Turn Off FakeDNS?
First confirm that new queries are getting normal DNS responses. Then, on Windows, run ipconfig /flushdns to clear the system DNS cache, and fully quit and reopen the affected app so it resolves the domain and reconnects. This command doesn't clear a browser's separate DNS cache or make existing connections switch to a new address.
One Site Keeps Failing. Should I Turn Everything Off?
First compare the domain using normal DNS while keeping the same node and outbound policy. If only FakeDNS resolution fails, check A and AAAA responses separately, then trace the path taken by the failing connection. Add a domain-specific normal DNS exception only after confirming that the app bypasses the inbound or genuinely relies on the real address.