Rule-based routing: every connection takes its own path
Rule-based routing is Clash's core capability: every connection is matched top-down against a rule list, and the first match decides whether it goes direct, through a node, or gets blocked. Sites in mainland China go direct with no detour, services outside China are routed to a node, and ad or tracking domains are rejected outright — the three never interfere with each other. Rules support domain suffixes, IP ranges, GeoSite, and more; just order them by priority, no need to configure each site individually. The difference from "global proxy" tools is that rule-based routing only touches the traffic that needs it, keeping speed loss minimal and never changing the apparent region for mainland services.
rules:
- DOMAIN-SUFFIX,example.com,PROXY
- GEOSITE,cn,DIRECT
- GEOIP,CN,DIRECT
- MATCH,PROXY
Subscription management: nodes and rules stay in sync automatically
A subscription is a config link — the client periodically pulls the latest nodes and rules from it, saving you the trouble of manual upkeep. After importing, it's best to keep the auto-update interval (commonly 24 hours); expired nodes and entry changes sync locally with each update. Multiple subscriptions can coexist, referenced by separate policy groups by purpose without conflicting. If a subscription update fails, check the HTTP status code in the log first, then verify the system time is accurate and whether your ISP is blocking the link — the tutorial guide has the full troubleshooting order, and working through it usually pinpoints the issue.
proxy-providers:
my-sub:
type: http
url: "https://example.com/sub?token=xxxx"
interval: 86400
path: ./providers/my-sub.yaml
System proxy vs. TUN: two ways to take over traffic
System proxy hands browser and system-setting-aware app traffic to the client, covering most everyday cases; TUN mode creates a virtual network adapter that takes over every TCP/UDP connection on the machine, so even apps that ignore the system proxy (games, CLI tools) get routed too. Enable only one at a time: system proxy for everyday browsing, TUN when you need full takeover. TUN requires admin privileges to install its service — the authorization steps for Windows and macOS are covered platform-by-platform in the installation guide, and Linux users should also watch firewall and routing table order.
mixed-port: 7890
tun:
enable: true
stack: mixed
auto-route: true
Proxy modes: Rule, Global, Direct
Rule mode matches connections against the rule table entry by entry and is the everyday recommendation; Global mode sends every connection through the same node, useful for quick tests or troubleshooting; Direct mode bypasses the proxy entirely, effectively pausing it. All three modes switch with one click in the client's main interface, corresponding to the mode field in config. Beginners should start with Rule mode; if "the proxy is on but nothing happens," switch to Global as a comparison — if Global works but Rule doesn't, the rules aren't matching; if neither works, the issue is likely the node or the system proxy toggle.
mode: rule # rule / global / direct
log-level: info
allow-lan: false
Log troubleshooting: read the log before touching config
The log is the first scene of any troubleshooting: the matched rule, selected node, latency, and failure reason for every connection are recorded line by line. Look for the word "timeout" for connection timeouts, check the provider fetch line for subscription failures, and a bind error at startup means the port is already taken. Temporarily set log-level to debug to see finer-grained rule matching, then switch back to info once you've found the issue to avoid log spam. This site's blog translates common errors into plain language, with a troubleshooting order for each — just compare against your own log.
log-level: info # switch to debug temporarily
external-controller: 127.0.0.1:9090