Skip to content

DNS configuration ​

DNS settings choose resolvers and determine whether applications receive real or Fake IP addresses. This fragment uses DoH; replace the resolvers with services reachable from your network.

yaml
dns:
  enable: true
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  default-nameserver:
    - 1.1.1.1
  nameserver:
    - https://cloudflare-dns.com/dns-query
  proxy-server-nameserver:
    - https://cloudflare-dns.com/dns-query
  fake-ip-filter:
    - '+.lan'
    - '+.local'

Resolver roles ​

FieldWhat it resolvesWhen to use it
default-nameserverDNS service hostnamesIP-based bootstrap resolver for named DoH/DoT endpoints
nameserverOrdinary destinationsDefault resolver list
nameserver-policyMatching domainsSeparate DNS for intranet domains or specific sites
proxy-server-nameserverProxy server hostnamesPrevent DNS/proxy dependency loops, especially with rule-following DNS
proxy-server-nameserver-policySpecific proxy hostnamesRequires nonempty proxy-server-nameserver
direct-nameserverDirect outbound destinationsSeparate resolvers for direct connections
direct-nameserver-follow-policyPolicy use for direct resolutionOnly relevant with direct-nameserver
fallback / fallback-filterConditional alternative answersSelect by domain or primary answer; this is more than retrying after a timeout

Resolver formats include 1.1.1.1 (UDP), tcp://1.1.1.1, tls://1.1.1.1 (DoT), and https://cloudflare-dns.com/dns-query (DoH). Include nonstandard ports in the address. system uses system DNS; see Apple behavior below.

Domain policies, hosts, and resolution modes ​

yaml
hosts:
  printer.home.arpa: 192.168.1.20
dns:
  use-hosts: true
  nameserver-policy:
    '+.home.arpa': 192.168.1.1

Merge this into your configuration: hosts is top-level; put nameserver-policy inside the existing dns section instead of adding a duplicate section. Replace LAN addresses with your device and resolver addresses.

enhanced-mode: fake-ip returns mapped addresses; redir-host uses real answers. With fake-ip-filter-mode: blacklist, matching domains receive real IPs. With whitelist, only matching domains receive Fake IPs. Usually leave the range and TTL unchanged.

EasyTier overlay DNS on macOS ​

Clash Core SDK snapshot 7ea70d1 adds easytier://<node-name> for EasyTier overlay hostnames, for example easytier://Node in a nameserver-policy entry. The name must match an EasyTier outbound. This resolver is for overlay IPv4 A records and IPv4 PTR lookups, not general public DNS. The iOS/iPadOS/tvOS SDKs do not include the EasyTier implementation. See the EasyTier DNS and routing example.

Follow routing rules for DNS ​

Add respect-rules: true inside the existing DNS section and retain an independently reachable proxy-server-nameserver. The selected proxy must be able to connect first. Avoid casually combining this with prefer-h3.

cache-algorithm accepts lru or arc. ipv6: false affects AAAA answers, subject to the app's IP Stack setting.

Platform behavior and field status ​

DNS stays enabled while connected. System and DHCP sources prefer resolver addresses captured before connection; unavailable entries are filtered or repaired, and a policy losing every address may return a name error. dns.ipv6 also depends on global IPv6 and the app IP Stack setting.

DNS listen opens an additional TCP/UDP DNS service and is unnecessary for ordinary use. Proxy authentication, allow-lan, and controller secret do not provide uniform protection for it.

31 fields shown

FieldTypeiOSmacOStvOSPlatform notes
dns.cache-algorithmStringSupportedSupportedSupportedSets the DNS cache algorithm or size; use a valid algorithm name and value.
dns.cache-max-sizeIntegerSupportedSupportedSupportedSets the DNS cache algorithm or size; use a valid algorithm name and value.
dns.default-nameserverListManaged / limitedManaged / limitedManaged / limitedSets DNS servers. system/dhcp sources use pre-connection system DNS addresses; unavailable entries are filtered or repaired.
dns.direct-nameserverListManaged / limitedManaged / limitedManaged / limitedSets direct or fallback resolvers; system/dhcp entries are replaced or filtered. Fallback is used according to its conditions.
dns.direct-nameserver-follow-policyBooleanSupportedSupportedSupportedControls whether direct DNS follows resolver policies.
dns.enableBooleanManaged / limitedManaged / limitedManaged / limitedDNS stays enabled while Clash is connected; false does not disable it.
dns.enhanced-modeStringSupportedSupportedSupportedSelects the DNS enhancement mode; Fake IP settings apply when that mode is used.
dns.fake-ip-filterListSupportedSupportedSupportedControls which destinations use or bypass Fake IP; requires Fake IP mode.
dns.fake-ip-filter-modeStringSupportedSupportedSupportedControls which destinations use or bypass Fake IP; requires Fake IP mode.
dns.fake-ip-rangeStringSupportedSupportedSupportedSets a valid IPv4 Fake IP range; it may also supply the default tunnel IPv4 address.
dns.fake-ip-range6StringManaged / limitedManaged / limitedManaged / limitedSets the IPv6 Fake IP range; effective IPv6 settings must also enable it.
dns.fake-ip-ttlIntegerSupportedSupportedSupportedSets the response TTL for Fake IP mode.
dns.fallbackListManaged / limitedManaged / limitedManaged / limitedSets direct or fallback resolvers; system/dhcp entries are replaced or filtered. Fallback is used according to its conditions.
dns.fallback-filter.domainListSupportedSupportedSupportedSets fallback conditions; GeoIP/GeoSite conditions require their data resources.
dns.fallback-filter.geoipBooleanSupportedSupportedSupportedSets fallback conditions; GeoIP/GeoSite conditions require their data resources.
dns.fallback-filter.geoip-codeStringSupportedSupportedSupportedSets fallback conditions; GeoIP/GeoSite conditions require their data resources.
dns.fallback-filter.geositeListSupportedSupportedSupportedSets fallback conditions; GeoIP/GeoSite conditions require their data resources.
dns.fallback-filter.ipcidrListSupportedSupportedSupportedSets fallback conditions; GeoIP/GeoSite conditions require their data resources.
dns.fallback-lazy-queryBooleanSupportedSupportedSupportedControls fallback DNS query scheduling; separate from lazy node health checks.
dns.ipv6BooleanManaged / limitedManaged / limitedManaged / limitedAffected by the app’s IP Stack settings; DNS IPv6 also requires global IPv6. Tunnel IPv6 capture is a separate setting.
dns.ipv6-timeoutIntegerSupportedSupportedSupportedControls IPv6 waiting in relevant DNS queries, not the overall VPN connection timeout.
dns.listenStringAdvancedAdvancedAdvancedCreates a TCP/UDP DNS listener. Proxy authentication, allow-lan, and controller secret do not provide shared access protection for it.
dns.listen-routing-markIntegerUnsupportedUnsupportedUnsupportedNo effect; this routing mark is not used on Apple platforms.
dns.nameserverListManaged / limitedManaged / limitedManaged / limitedSets DNS servers. system/dhcp sources use pre-connection system DNS addresses; unavailable entries are filtered or repaired.
dns.nameserver-policyMappingManaged / limitedManaged / limitedManaged / limitedSelects resolvers by domain. Addresses are also filtered; if none remain, that policy may return name-not-found.
dns.prefer-h3BooleanSupportedSupportedSupportedPrefers HTTP/3 for DNS connections that support it.
dns.proxy-server-nameserverListManaged / limitedManaged / limitedManaged / limitedSets DNS servers. system/dhcp sources use pre-connection system DNS addresses; unavailable entries are filtered or repaired.
dns.proxy-server-nameserver-policyMappingManaged / limitedManaged / limitedManaged / limitedSelects resolvers by domain. Addresses are also filtered; if none remain, that policy may return name-not-found.
dns.respect-rulesBooleanSupportedSupportedSupportedRoutes relevant DNS requests by rules; proxy-server-nameserver does not recursively apply this setting.
dns.use-hostsBooleanSupportedSupportedSupportedUses mappings from top-level hosts for DNS queries.
dns.use-system-hostsBooleanSupportedSupportedSupportedUses system hosts readable by Clash; does not enable editing system hosts on iOS/tvOS.

Reference: mihomo.