DOWNCLASH.COM · CONFIG DOCS

Clash Config Docs Center — The Complete config.yaml Field Reference

A field-by-field breakdown of the full config.yaml structure: basic port settings, proxies nodes, proxy-groups, rules, rule-providers, and dns/tun configuration — each field includes its type, default value, and a configuration example, built as a reference you can come back to.

Fields Covered: 40+ Sections: 6 Applies To: mihomo / Clash Premium

01 Basic Port & Runtime Fields

These fields sit at the top level of config.yaml and control the core's basic runtime behavior.

FieldTypeDefaultDescription
portNumber7890The HTTP proxy listening port.
socks-portNumber7891The SOCKS5 proxy listening port.
mixed-portNumberNoneA mixed port supporting both HTTP and SOCKS5 — we recommend configuring just this one port and pointing your system proxy here.
allow-lanBooleanfalseWhether to allow other devices on the LAN to connect to this machine's proxy port — needed for router or sharing setups.
bind-addressString*Used together with allow-lan to specify which network interface to listen on; * means listen on all interfaces.
modeStringruleRun mode: rule (route by rules), global (send everything through the same node), direct (all direct connections).
log-levelStringinfoLog verbosity: silent / error / warning / info / debug.
external-controllerStringNoneThe listening address for the external control API (e.g. 127.0.0.1:9090) — the dashboard relies on this interface.
secretStringNoneThe secret key required to access the external-controller interface — recommended if you're exposing this interface on your LAN.
ipv6BooleanfalseWhether to enable IPv6 support, including IPv6 outbound connections and rule matching.
Tip:We recommend using only mixed-port instead of configuring port and socks-port separately — one less port number to remember.

02 proxies Node Fields

Each node is an entry in the proxies list. Different protocols share some common fields and also have their own protocol-specific fields.

FieldApplies ToDescription
nameAllThe node's name, used as a unique identifier in proxy groups and the UI — try not to duplicate names.
typeAllProtocol type: ss (Shadowsocks), vmess, trojan, snell, socks5, etc.
server / portAllThe node's server address and port.
cipherss / snellEncryption method, e.g. aes-256-gcm, chacha20-ietf-poly1305.
passwordss / trojan / snellConnection password or key.
uuid / alterIdvmessAn identity field specific to the VMess protocol.
udpAllWhether UDP forwarding is enabled — affects whether UDP-based traffic (games, voice, DNS) can go through the proxy.
tls / skip-cert-verifyand moreWhether TLS encryption is enabled, and whether to skip certificate verification (may be needed for self-signed certificates).
networkand moreTransport protocol, e.g. tcp, ws (WebSocket), grpc.
# Example config for a Trojan node
proxies:
  - name: "HK-01"
    type: trojan
    server: example.com
    port: 443
    password: "your-password"
    udp: true
    skip-cert-verify: false

03 proxy-groups Fields

FieldDescription
nameThe proxy group's name, referenced as a target in rules.
typeselect (manual selection), url-test (auto-select lowest latency), fallback (failover), load-balance (load balancing), relay (multi-hop chaining).
proxiesThe list of node names in this proxy group — can also reference other proxy group names for nesting.
urlThe test URL used by url-test / fallback types, usually a lightweight availability-check endpoint.
intervalThe interval (in seconds) between automatic latency tests.
toleranceThe tolerance value (in milliseconds) for url-test — latency differences within this range won't trigger frequent node switching.
useReferences a node list from a Proxy Provider instead of a manually listed proxies array.
# Example auto latency-test proxy group
proxy-groups:
  - name: "PROXY"
    type: url-test
    proxies: ["HK-01", "SG-01", "JP-01"]
    url: "http://www.gstatic.com/generate_204"
    interval: 300
    tolerance: 50

04 rules Fields

Rules follow a consistent format: TYPE,MATCH_VALUE,TARGET, matched from top to bottom, stopping at the first hit.

Rule TypeExampleDescription
DOMAINDOMAIN,ad.example.com,REJECTExact match on a full domain.
DOMAIN-SUFFIXDOMAIN-SUFFIX,github.com,PROXYMatches the domain and all its subdomains — the most commonly used.
DOMAIN-KEYWORDDOMAIN-KEYWORD,ad-track,REJECTMatches if the domain contains the given keyword.
GEOIPGEOIP,CN,DIRECTMatches by the country/region of the target IP.
IP-CIDR / IP-CIDR6IP-CIDR,192.168.0.0/16,DIRECTMatches by an IPv4/IPv6 address range.
SRC-IP-CIDRSRC-IP-CIDR,192.168.1.100/32,DIRECTMatches by the source IP of the request — commonly used to route multiple LAN devices differently.
DST-PORT / SRC-PORTDST-PORT,443,PROXYMatches by target/source port number.
PROCESS-NAMEPROCESS-NAME,chrome.exe,PROXYMatches by the process name that made the request — desktop only.
RULE-SETRULE-SET,reject,REJECTReferences a rule set already defined under rule-providers.
MATCHMATCH,PROXYThe catch-all rule — must be the last line.

05 rule-providers Fields

A rule provider keeps a large batch of rules in a remote file that clients periodically fetch and update, avoiding manual upkeep.

FieldDescription
typehttp (remote URL) or file (local file).
behaviordomain (domain list), ipcidr (IP range list), classical (mixed list with full rule syntax).
urlThe remote address to use when type is http.
pathThe local file path where the rule set is cached.
intervalThe auto-update interval, in seconds.
# Define a remote rule set and reference it in rules
rule-providers:
  reject:
    type: http
    behavior: domain
    url: "https://example.com/reject.txt"
    path: ./ruleset/reject.yaml
    interval: 86400

rules:
  - RULE-SET,reject,REJECT
  - MATCH,PROXY
Tip:For more on choosing and maintaining rule sets, see the blog post The Complete Guide to Rule Providers.

06 dns & tun Fields

dns Configuration Fields

FieldDescription
enableWhether to enable the core's built-in DNS server (replacing the system DNS) — recommended when using Fake-IP.
listenThe local listening address for the core's DNS service, e.g. 0.0.0.0:53.
enhanced-modefake-ip or redir-host — determines how DNS resolution interacts with rule-based routing afterward.
fake-ip-rangeThe virtual address range used by Fake-IP, usually a private address range to avoid conflicts.
nameserverThe list of upstream DNS servers used for normal resolution.
fallbackThe backup DNS list used when a nameserver's result is judged to be polluted.

tun Configuration Fields

FieldDescription
enableWhether TUN mode is enabled — requires admin/root privileges or system network extension authorization.
stackThe network stack implementation: gVisor (userspace, better compatibility) or System (OS-level, higher performance).
auto-routeWhether to automatically take over the system routing table — no need to configure routes manually when enabled.
auto-detect-interfaceAutomatically detects the outbound network interface, avoiding routing conflicts between the virtual and physical adapters.
Tip:TUN mode and Fake-IP usually work best together — see the advanced configuration guide for setup steps and common issues.
Need something more advanced? The advanced configuration guide covers TUN mode, advanced proxy group usage, Fake-IP, and in-depth rule provider setup.