Fake-IP returns a mapped address

In Clash-based cores, dns.enhanced-mode controls how enhanced DNS responds. In mihomo (formerly Clash Meta), setting it to fake-ip lets eligible A queries handled by the core's DNS return a synthetic IPv4 address immediately. The address is mapped to the queried hostname, but it is not the destination server's real IP. A common setting is fake-ip-range: 198.18.0.1/16, which draws addresses from 198.18.0.0/16. This range is reserved for network device benchmarking and must not be used as public server address space.

  1. Lookup: An app requests the A record for example.com. The core assigns an address from the pool and records the hostname-to-address mapping. The assigned address depends on runtime state and may differ across devices.
  2. Interception: The app connects to that address. If the connection comes back through an entry point such as TUN to the core holding the mapping, the core can look up example.com from the destination address.
  3. Outbound routing: The core checks rules in order. If DOMAIN,example.com,DIRECT matches, a direct connection still needs the real address. If the selected proxy supports requests by hostname, the proxy may resolve it remotely instead.

Fake-IP therefore reduces the time an app waits for its first DNS response: assigning a mapping does not require waiting for an upstream resolver to return the domain's real A record. The real address may still be resolved when the connection is established. Rules that need the actual destination IP, such as IP-CIDR rules, may also trigger resolution during rule matching. Total page load time includes outbound connection setup, the TLS handshake, and the app's response; it cannot be measured by DNS lookup time alone.

Fake-IP vs. redir-host

redir-host returns the resolved IP address to the app instead of assigning one from a fake-IP pool. If there is no cache hit or local override, the app usually has to wait for resolution before it can connect. This is separate from the client's system proxy and TUN settings: changing DNS mode does not change how traffic is routed into the client.

Comparison Fake-IP redir-host
A record seen by the app Unfiltered domains can receive a synthetic address from the pool. The resolved IP is returned; it may be a public or private address.
Hostname information after transparent interception The core can recover the hostname from the fake address for domain-based rule matching. If the entry point sees only the real IP, hostname recovery depends on DNS association, protocol sniffing, and other conditions. A shared IP may not uniquely identify the original hostname.
Connection bypasses the core The app usually cannot reach the real service using a synthetic address. The app can still try to connect to the real address through system routing, but that connection will not be subject to the core's rules.
Apps that depend on IP addresses If an app checks whether a returned IP is on a local network, you may need to filter the relevant domains. Suitable for apps that use resolved addresses directly for IP-based checks, provided the selected DNS resolver can resolve the domain.

When an explicit HTTP proxy receives a CONNECT request containing a hostname, it can use that hostname directly without recovering it from Fake-IP. For these requests, first check that traffic is actually going through the proxy and that the expected rule matches. Fake-IP mappings are more useful when TUN handles apps that provide only a destination IP and you need reliable domain-based routing.

Which domains should go in fake-ip-filter?

Filter hostnames that genuinely need their real addresses. For example, a NAS management tool may require nas.home.arpa to resolve to an address in 192.168.50.0/24 before it will connect. Some diagnostic tools also display or compare DNS responses directly. Confirm which hostnames are affected, then add them individually. Don't add an entire public domain suffix just because one connection timed out.

Here is a partial mihomo configuration. In blacklist mode, domains matching the filter list do not receive Fake-IP. The +.home.arpa suffix pattern is useful when the entire home network namespace needs to resolve to real addresses. If only one NAS is affected, narrow the entry to nas.home.arpa.

dns:
  enable: true
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  fake-ip-filter-mode: blacklist
  fake-ip-filter:
    - '+.home.arpa'

Filtering, resolution, and routing are separate

  • Filtering determines the response type. fake-ip-filter only determines whether matching domains receive synthetic addresses. It does not add a DIRECT rule or change system routing.
  • The resolver determines the actual response. If only your home DNS server knows that nas.home.arpa resolves to 192.168.50.20, use a setting such as nameserver-policy to send that query to your home DNS server. If filtering is followed by NXDOMAIN, first check which resolver received the query.
  • Rules and routing determine where the connection goes. After getting 192.168.50.20, check that the expected outbound was selected and that the system has a route to that subnet. Local network discovery that relies on mDNS multicast, including common .local names, cannot be restored just by changing unicast DNS filter entries.

This is a snippet to merge into your existing dns section, not a complete subscription configuration. If your client uses subscription overrides, check the final effective configuration and make sure the new entries haven't replaced the existing filter list. Older cores may support different filter mode fields; rely on the running core's configuration validation.

Troubleshoot DNS responses, connection interception, and rules in order

Check the DNS response first

If the running core listens locally on 127.0.0.1:1053 via dns.listen, query that port directly. These commands require dig to be installed locally. Replace the port if the effective configuration uses a different one. Specifying the server verifies the core's response; it does not prove that your browser uses the same DNS path.

dig @127.0.0.1 -p 1053 example.com A +short
dig @127.0.0.1 -p 1053 nas.home.arpa A +short

With the example configuration above, the first query should return an address in 198.18.0.0/16. If your home DNS is configured and the record exists, the second should return the NAS's real address, such as 192.168.50.20. These are expected results, not a speed test. If the command returns the expected results but the app behaves differently, check the app's DNS cache and the browser's Secure DNS setting. An app's encrypted DNS requests are not the same as regular port 53 queries, and TUN port hijacking does not automatically intercept them.

Then verify the connection reaches the same core

Reproduce the failure and look for the connection in the client's connection list or core logs. If the app received a fake address but no connection appears, check the TUN interception scope, routing to the fake-IP pool, and whether another VPN route overrides that range. If a connection appears but the hostname cannot be recovered, check whether the core was recently restarted or its configuration changed while the app still has an old DNS cache entry. Close and reopen the app, then test again and confirm it received a fresh response.

Finally, check the matched rule and outbound

If the connection record shows the destination hostname, check which rule matched and which outbound was selected. A domain rule placed too low may be preempted by an earlier rule. Conversely, if the expected policy matched but the connection still times out, investigate that outbound's connection setup and actual DNS resolution instead of expanding fake-ip-filter. To compare the two modes, use the same app, domain, network, and outbound; change only the DNS mode and record the DNS response, matched rule, and connection result for each.

Choose a DNS mode based on what traffic is intercepted

  • TUN intercepts both DNS and subsequent connections: If you mainly use domain-based rules, start with Fake-IP. Verify that a public domain matches as expected, then add exceptions for internal domains that genuinely need IP-based checks.
  • A device or app requires real IP addresses: If only a few hostnames are affected, keep Fake-IP and add precise filter entries. If many services depend on real addresses and maintaining exceptions is impractical, consider redir-host first.
  • DNS is centralized on a local gateway: For every device receiving DNS responses, confirm that its subsequent connections return to the core holding the mappings. Avoid returning synthetic addresses broadly to devices that use the gateway for DNS but bypass its traffic interception.

First identify the connection entry point, then check whether the app depends on real addresses. The first determines whether Fake-IP mappings can be used; the second determines the scope of exceptions. Checking these separately makes problems easier to isolate than switching modes as soon as you see an address starting with 198.18.