The concepts that show up most often in config.yaml. Understanding rule-matching order and how traffic gets taken over is the line between "it works" and "it routes as expected."
YAML Config & Rules
The data format used by Clash config files, relying on indentation to express hierarchy and extremely strict about whitespace. Mixing tabs into indentation and missing a space after a colon are the two most common causes of config errors. Edit configs in a monospace-font editor with whitespace characters shown, and validate the config in the client before applying changes.
Rule-Based Routing Config & Rules
The match list in a config file's rules section, matching every connection to a designated outbound—a node, a proxy group, or DIRECT/REJECT—in top-to-bottom order. Common rule types include DOMAIN-SUFFIX, IP-CIDR, and GEOIP, with a final MATCH line catching everything else. Reversed order is the most common cause of routing failures.
Proxy Group Config & Rules
A unit that organizes multiple nodes into a single selectable option, with rules pointing to the group rather than a specific node, so switching nodes doesn't require touching the rules. Types include manual select, auto-testing url-test, failover fallback, and load-balance, mixed and matched as needed. Proxy groups can also nest inside one another to form a multi-level selection structure.
GeoIP / GEOSITE Config & Rules
Two built-in matching databases: GeoIP matches by IP location, with a typical rule looking like GEOIP,CN,DIRECT; GEOSITE matches by domain category list. These database files update separately from the core itself, and letting them go stale leads to inaccurate routing decisions. Most clients offer a one-click database update in settings—try that before digging into rules when routing misbehaves.
Fake-IP Config & Rules
A DNS handling mode: the core first returns a fake IP from a reserved range (198.18.0.0/16 by default) for a domain lookup, then applies domain-based rules once the app actually connects. This eliminates DNS resolution delay and prevents lookup results from being used to bypass routing. It's a good idea to flush the system DNS cache once after switching this mode.
TUN Mode Config & Rules
A way of taking over all system network traffic through a virtual network adapter, independent of whether an app respects the system proxy setting—it can cover command-line tools, games, and other traffic that would otherwise bypass the proxy. Enabling it requires admin permissions or system authorization. Use either TUN mode or the system proxy, not both—running them together offers no added benefit.
System Proxy Config & Rules
The OS-level HTTP/SOCKS proxy setting. Once the client turns this toggle on, apps that respect it (mainly browsers) hand their traffic off to Clash's local port. Some software ignores the system proxy setting entirely, in which case you'll need TUN mode instead, or set the proxy address and port directly inside that software.