FakeDNS is a DNS mode in V2Ray: when it receives a query, it immediately returns a fake IP from a reserved range (such as 198.18.0.0/15) and defers the real resolution to the outbound stage, reducing DNS round trips and lowering first-packet latency. It works best with TUN mode, but be aware that IP-based routing rules may fail.
How FakeDNS Works
FakeDNS is a special DNS mode in V2Ray. When enabled, V2Ray immediately returns a fake IP from a reserved range (such as 198.18.0.0/15) instead of waiting for a real DNS resolution. This lets apps start connections right away, cutting down on wait time.
A Simple Analogy
Traditional DNS is like looking up an address before leaving home — you spend time checking the address every time. FakeDNS is like grabbing any house number and heading out, then asking for the exact address once you arrive. For scenarios that involve frequent access to many domains (such as browsing the web or using chat apps), the latter noticeably reduces waiting.
Receive DNS Query
An app requests resolution for a domain, and V2Ray's DNS module intercepts the query.
Return Fake IP
V2Ray immediately returns a fake IP from the reserved range, and the app connects right away.
Restore Domain at Outbound
Traffic enters the routing stage, and V2Ray maps the fake IP back to the real domain using the mapping table.
Forward by Domain
Routing rules match the outbound by domain, and traffic goes through the proxy or direct.
Scenarios Where FakeDNS Helps
FakeDNS is especially useful for scenarios that require frequent domain resolution, such as browsing the web or using chat apps. Traditional DNS needs multiple round trips, while FakeDNS returns results immediately, significantly reducing latency.
Which Scenarios Benefit Most
For scenarios with many domains and frequent lookups — web browsing, video streaming, instant messaging — FakeDNS offers the biggest gains. For online gaming or certain financial apps that validate real IPs, FakeDNS can actually cause problems. Whether to enable it depends on your main use case.
Enabling FakeDNS
RecommendedDNS queries are answered instantly, with low first-packet latency — ideal for high-frequency resolution scenarios like web browsing, chat, and video.
Disabling FakeDNS
Every resolution goes through real DNS, so latency is slightly higher, but IP-based rules work correctly.
Working with Routing Rules
When using FakeDNS, it's best to prioritize domain rules and avoid IP rules. Since FakeDNS returns fake IPs, IP-based rules may not work correctly. In v2rayN, you can enable FakeDNS via "Settings" → "DNS", and adjust rules in "Routing".
Domain Rules
RecommendedMatch by domain, which aligns naturally with FakeDNS's mapping mechanism and gives accurate routing.
IP Rules
Match by IP, but since FakeDNS returns fake IPs, these rules may fail.
If your routing rules include IP-based rules, FakeDNS may not match them correctly. Put domain rules before IP rules.
Pairing FakeDNS with TUN Mode
FakeDNS works best when paired with TUN mode. TUN mode takes over all traffic, and FakeDNS can accelerate every DNS query. But note that FakeDNS isn't suitable for everything — for example, IP-based routing rules may not match fake IPs correctly.
In TUN mode, all apps' DNS queries are intercepted by the kernel, so the benefits of FakeDNS are amplified. If you run both TUN mode and FakeDNS, put domain rules at the top of your routing rules to ensure accurate routing.
How to Enable FakeDNS
In v2rayN, go to "Settings" → "DNS" → "Enable FakeDNS". Once enabled, v2rayN adds a fake-dns server to the generated config. In v2rayNG, go to "Settings" → "DNS" → "Enable FakeDNS".
{
"dns": {
"servers": [
{
"address": "fake-dns",
"domains": [
"geosite:geolocation-!cn"
]
}
]
}
}
In the example above, fake-dns is configured to handle resolution for domains outside mainland China. This way, non-mainland domains get fake IPs immediately, while mainland China domains still use the real DNS servers.
Want all domains to go through FakeDNS?
You can change domains to ["geosite:geolocation-!cn", "geosite:cn"], or simply omit the domains field. But note that if you hand mainland China domains over to FakeDNS too, their resolution will also be deferred to the outbound stage, which may affect direct connection speed.
Limitations of FakeDNS
FakeDNS isn't a cure-all. For scenarios that require real IPs (such as apps that validate IP addresses), FakeDNS can cause issues. It also increases kernel memory usage, because the kernel has to maintain the mapping table between domains and fake IPs. On low-spec devices, weigh whether to enable it.
Easy-to-Miss Issues
The fake IPs returned by FakeDNS belong to reserved ranges (such as 198.18.0.0/15). If an app or game hardcodes a check on the target IP, or uses a "connect directly by IP" strategy, you may see connection errors. In such cases, add the relevant domains to the direct rules, or simply turn off FakeDNS.
Recommended Setup
- DNS Server
- fake-dns + real DNS fallback
- Routing Rules
- Domain rules first
- Use Cases
- TUN mode + high-frequency resolution
Not Recommended
- DNS Server
- fake-dns only
- Routing Rules
- Heavy IP rules
- Use Cases
- Apps sensitive to real IPs
Some Apps Won't Open After Enabling
These apps may be validating real IPs. Try turning off FakeDNS, or add the relevant domains to the direct rules.
IP-Based Rules Not Working
FakeDNS returns fake IPs, so IP-based matching fails. Switch to domain rules and put them before IP rules.
Higher Memory Usage
The kernel needs to maintain the mapping table between domains and fake IPs. On low-spec devices, turn off FakeDNS and use regular DNS instead.
When Is It Worth Enabling
If you use TUN mode to take over all traffic and your routing is mostly domain-based, FakeDNS can noticeably reduce first-packet latency. On the other hand, if your routing relies heavily on IP rules, or your apps are sensitive to real IPs, keep it off.
Does FakeDNS Leak DNS?
No. FakeDNS only defers resolution to the outbound stage; the real resolution is still done by the DNS servers you configure, and domains are not exposed in plaintext to the proxy server.
Can FakeDNS and Regular DNS Be Used Together?
Yes. You can have FakeDNS handle only certain domains (such as geosite:geolocation-!cn), while other domains go through real DNS servers.