The note is generated by CatDesk.
What is Fake-IP
Fake-IP is a DNS resolution strategy used by proxy tools like Clash (Mihomo), Clash Verge, and similar transparent proxy software. Instead of performing a real DNS lookup when an application requests a domain, the proxy immediately returns a fabricated IP address from a reserved subnet (typically 198.18.0.0/16). The proxy maintains an internal mapping table between these fake IPs and the original domains, so when traffic is later routed to a fake IP, the proxy knows which domain the traffic was actually destined for.
The Problem Fake-IP Solves
In a traditional proxy setup (called “redir-host” mode), the flow looks like this:
App requests google.com
→ System DNS resolves google.com → 142.250.80.46 (real IP)
→ Proxy sees traffic to 142.250.80.46
→ Proxy matches rules and forwards accordingly
This approach has two significant issues:
DNS Leak — Even though your traffic goes through the proxy, the DNS query itself was sent in plaintext to your local DNS server. Your ISP (or anyone on the network) can see every domain you visit.
DNS Latency — Every new connection must wait for DNS resolution to complete before the proxy can route it. If the DNS server is slow, your browsing feels sluggish.
How Fake-IP Works
With fake-ip mode enabled, the flow becomes:
App requests google.com
→ Clash intercepts the DNS query
→ Clash immediately returns 198.18.0.5 (fake IP from pool)
→ Clash records: 198.18.0.5 → google.com
→ App connects to 198.18.0.5
→ Clash intercepts the connection, looks up 198.18.0.5 → google.com
→ Clash applies routing rules using the domain name
→ Remote proxy server does the REAL DNS resolution
The key insight: the application never touches a real IP address. The proxy resolves the domain on the remote end (the proxy server), so your local network never sees the actual DNS query or the real destination IP.
Configuration
A typical fake-ip configuration in Clash/Mihomo:
| |
The fake-ip-range defines the pool of fake IP addresses. The 198.18.0.0/16 range is ideal because it belongs to a reserved block (RFC 2544 benchmarking) that no legitimate internet service would use, so there’s no conflict with real traffic.
The fake-ip-filter: When Fake-IP Breaks Things
Fake-IP is elegant but not universal. Some applications and network scenarios break when they receive a fake IP instead of a real one.
When fake-ip causes problems
Internal/corporate networks — If your company uses internal DNS to resolve domains like *.sankuai.com to private IPs (e.g., 10.x.x.x or 33.x.x.x), and you have IP-based routing rules like IP-CIDR,10.0.0.0/8,DIRECT, the rule will never match because the domain was mapped to 198.18.x.x instead of the real internal IP.
LAN services — Local network devices (printers, NAS, smart home hubs) that rely on mDNS or local DNS to discover each other will fail if they get a fake IP.
System services — Windows network discovery, macOS Bonjour, NTP time sync, and captive portal detection all need real IPs to function.
Applications with IP validation — Some apps verify that the resolved IP makes sense (e.g., belongs to a known range), and will reject connections to 198.18.x.x.
WebSocket/long-lived connections — If the fake-ip cache entry expires while a connection is still active, reconnection logic may fail.
The solution: fake-ip-filter
The fake-ip-filter is a list of domain patterns that should bypass the fake-ip mechanism entirely. For these domains, Clash performs a real DNS resolution and returns the actual IP to the application.
| |
When a domain matches fake-ip-filter, Clash uses the configured nameserver to resolve it to a real IP. This ensures that IP-CIDR rules in your routing configuration can match correctly.
Fake-IP vs Redir-Host: Comparison
| Aspect | Fake-IP | Redir-Host |
|---|---|---|
| Speed | Faster (no DNS wait before connection) | Slower (DNS resolution blocks connection) |
| DNS Privacy | No leak (remote resolves) | Leaks to local DNS server |
| IP-based rules | May not match (needs fake-ip-filter) | Always matches (real IPs) |
| Compatibility | Breaks some apps/services | Works with everything |
| Cache pollution | Possible if fake-ip expires mid-session | Not affected |
| Configuration complexity | Higher (must maintain filter list) | Lower (just works) |
Fake-IP Cache and Lifecycle
Fake-IP addresses are not permanent. The proxy maintains a mapping pool with a limited size (65,535 addresses for a /16 range). The lifecycle:
- App requests
example.com→ Clash assigns198.18.0.42 - Mapping stored:
198.18.0.42 ↔ example.comwith a TTL - When TTL expires or the pool is full, old mappings are evicted (LRU)
- If the same domain is requested again after eviction, it may get a different fake IP
This is usually transparent, but can cause issues with applications that cache DNS results aggressively on their side.
Real-World Example: Meituan Intranet + Proxy Coexistence
This is a practical case where fake-ip-filter is essential. The Meituan intranet uses private IP ranges (10.0.0.0/8, 33.0.0.0/8) that must be accessed directly (not through any proxy). Without fake-ip-filter:
Browser requests mlp.sankuai.com
→ Clash returns 198.18.0.99 (fake)
→ Rule "IP-CIDR,10.0.0.0/8,DIRECT" does NOT match 198.18.0.99
→ Traffic goes through proxy → proxy can't reach internal server → connection fails
With fake-ip-filter including *.sankuai.com:
Browser requests mlp.sankuai.com
→ Clash resolves via internal DNS → 10.192.19.165 (real)
→ Rule "IP-CIDR,10.0.0.0/8,DIRECT" MATCHES
→ Traffic goes directly to 10.192.19.165 → success
Additionally, the system proxy bypass list must include the internal IP ranges so that traffic to these IPs doesn’t even enter the proxy stack:
| |
Debugging Fake-IP Issues
When something doesn’t work with fake-ip enabled, here’s how to diagnose:
Check if a domain is getting a fake IP:
| |
Check the Clash log — Look for DNS resolution entries. Clash logs which domains were resolved via fake-ip and which went through normal resolution.
Verify your rules match — If a domain should go DIRECT but isn’t, it likely needs to be in the fake-ip-filter so that IP-CIDR rules can see the real IP.
Test with redir-host temporarily — Switch to redir-host mode. If the problem disappears, it confirms the issue is fake-ip related, and you need to add the problematic domain to fake-ip-filter.
Summary
Fake-IP is an optimization that trades compatibility for speed and privacy. It works beautifully for general web browsing and proxy routing, but requires careful configuration of the fake-ip-filter for any domain that needs to resolve to a real IP — particularly internal corporate domains, LAN services, and applications that validate IP addresses. The key rule: if a domain’s real IP is needed for correct routing or application logic, put it in the filter.