How the Fake-IP Address Pool Works
In mihomo (formerly Clash Meta), dns.enhanced-mode determines how the built-in DNS handles address lookups. Fake-IP mode can return a synthetic address to an application first, then use that address to recover the domain when the connection reaches the core. The example below uses an IPv4 A record. When troubleshooting IPv6, also check AAAA responses and whether IPv6 traffic reaches the core.
- Receive the query. An application looks up
example.com. The request must reach the core's DNS module; if the browser uses its own encrypted DNS, the query may bypass this path. - Assign an address. If the domain isn't filtered, the core assigns a synthetic address from the pool, such as
198.18.0.23, and stores the mapping to the domain. This example doesn't mean every lookup returns the same address. - Recover the domain. The application tries to connect to the synthetic address. Once the connection reaches the core, the core looks up
example.comin its mapping and evaluates rules in order. Even when different domains share a CDN IP, each can be routed by its own domain name. - Establish the connection. After a rule selects an outbound, the core handles the real destination. A direct connection needs a usable real address; how a proxy outbound resolves the destination depends on the protocol, outbound, and DNS settings. Rules that match on destination IP may also trigger a real lookup during evaluation.
A response in the 198.18.0.0/16 range doesn't mean the remote site uses that address. First check whether it came from the configured Fake-IP pool, then verify that the connection reached the core. Don't add a one-off synthetic response to hosts as if it were a permanent address.
Fake-IP vs. redir-host
With redir-host, the real DNS result must be available before the query can be answered, though a valid cache entry can supply it. The application then connects to the real IP. If the connection carries only an IP, whether the core can identify the original domain depends on whether it has a matching DNS mapping, whether applicable traffic sniffing is enabled, and whether the protocol exposes recognizable information. When multiple domains share an IP, the IP alone can't tell you which one the application accessed.
| Comparison | Fake-IP | redir-host |
|---|---|---|
| IPv4 address returned to the application | Unfiltered domains can receive a synthetic address from the pool | Receives the real DNS result |
| How traffic is routed by domain | The original domain can be recovered when connecting to the synthetic address | When a connection carries only an IP, routing depends on a mapping or applicable sniffing |
| DNS lookup latency | A synthetic response can be returned first; a real lookup may still occur during rule evaluation or outbound processing | The real result must be available before the response is returned; a cache hit avoids a new upstream query |
| Best suited for | TUN captures connections and routing is primarily based on domain names | Many applications or internal services need to read real IP addresses directly |
Don't compare only the time taken by two DNS lookups. Fake-IP may return a DNS response sooner, but the page still has to wait for the outbound connection and TLS handshake. For a meaningful comparison, use the same app, outbound policy, and destination domain, then check the DNS response, connection logs, and actual load result.
fake-ip-filter YAML examples
If only a few internal domains need real addresses, start with a filter list instead of switching the entire DNS mode. The snippet below is for mihomo cores that support fake-ip-filter-mode. Merge the fields into your existing dns section, keep your current upstreams and per-domain DNS settings, and don't create a second section with the same name.
dns:
enable: true
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16
fake-ip-filter-mode: blacklist
fake-ip-filter:
- 'nas.lan'
- '+.home.arpa'
- Exclude a single host by exact match.
'nas.lan'matches only this hostname. If file sharing depends on just this device, start with the exact domain rather than adding every local network suffix. - Exclude a group of domains by suffix.
'+ .home.arpa'is written without a space in practice:'+.home.arpa'. It matcheshome.arpaand its subdomains. Use this pattern only for suffixes you know are managed by your internal DNS. - Check the filter mode. In
blacklistmode, matching entries don't receive Fake-IP addresses. Older cores may not recognize the mode field, so check which core the client uses and confirm that the filter entries remain in the active configuration before loading it.
Filtering changes only the DNS response; it doesn't make the connection direct, and it doesn't make public DNS aware of internal hosts. If nas.lan can only be resolved by your router, check whether nameserver-policy sends the query to the right internal resolver, then verify the outbound rule in the connection logs. If an internal service uses .local multicast DNS, also check whether the app can discover it on its network segment. A filter entry can't replace multicast discovery.
Choosing settings for TUN, system proxy, and LAN
Domain-based routing with TUN: check both paths
Check both DNS queries and application connections. Even if DNS returns a synthetic address, the application may time out if the TUN route doesn't send that address range to the core. Conversely, even if the connection enters TUN, an app's built-in resolver may get a real IP first, leaving no Fake-IP mapping to look up. Change one setting at a time while troubleshooting; don't switch DNS modes, proxy nodes, and rules all at once.
Browser using the system proxy: check how requests reach the proxy
When a browser sends an HTTPS request through an explicit HTTP proxy, the CONNECT request usually includes the destination domain. This type of connection may not need a synthetic address to recover the domain first. If the browser works but another app doesn't, check whether that app uses the system proxy. Changing DNS modes won't automatically route apps that ignore the system proxy.
LAN services: start with exact filters before considering a global switch
If a NAS admin page, internal dashboard, or printer service won't open, first check whether the app uses a domain name, a static IP, or a local discovery protocol. A filter list is relevant only when the domain lookup goes through the core and returns a synthetic address. If many apps need real IPs, or your setup can't reliably route connections to synthetic addresses back to the core, try redir-host. After switching, verify internal DNS resolution and confirm that domain-based rules still match.
Verify DNS responses, connection logs, and cached results
First confirm that the current configuration is actually enabled. In an environment with dig, you can temporarily set the core's DNS listen to 127.0.0.1:1053 and query that port directly. Here, 1053 is a local test port, not an HTTP or SOCKS proxy port, and it won't change the system DNS automatically. If the port is already in use, choose a free one and update the command to match.
dig @127.0.0.1 -p 1053 example.com A +noall +comments +answer
dig @127.0.0.1 -p 1053 nas.lan A +noall +comments +answer
- Find out which path the response took. With Fake-IP enabled as shown, an unfiltered lookup for
example.comshould usually return an address from the pool.nas.lanrepresents an internal hostname configured on your network; replace it with one that actually exists. If the result isNXDOMAIN, check whether the upstream resolver knows the domain. If the query times out, first check that the core is listening and can reach its upstream. - Retest with the actual app. Querying the core directly shows only how that port responds; it doesn't prove the browser uses that DNS server. Reopen the target service and check the client's connection logs for the destination (domain or IP), matched rule, and outbound. If no connection appears, first check the system proxy settings or TUN capture scope.
- Rule out stale addresses. After switching modes, an app may keep using an old address or reuse an existing connection. Close its connections, clear the DNS cache if needed for your system, then make a fresh query and connection. If filter settings disappear after a subscription update, check whether you added them to the client's override configuration or only edited a subscription file that gets replaced during updates.
If the DNS response looks right but the connection still fails, check the outbound under logs and connection troubleshooting. If the response itself is wrong, start with the DNS troubleshooting steps and check the resolver and cache. Change one thing at a time to pinpoint whether the issue is DNS resolution, rule matching, or the outbound.