Routing Rules: Decide Where Each Connection Goes
Rule mode checks domains, IPs, processes, or rule sets in the order defined by the configuration. Once a rule matches, the connection is handed to the specified proxy group. This determines how different traffic is handled, rather than sending every connection through the same exit. A common approach is to define the most specific domain rules first, handle IP geolocation rules next, and use MATCH for anything left unmatched. Compared with global mode, rule mode offers finer control and is better suited to long-term use.
- DOMAIN-SUFFIXexample.comProxy
- GEOIPCNDIRECT
- MATCHremaining trafficProxy
Proxy Groups: Organize Choices Among Multiple Candidates
Proxy groups sit between rules and individual proxies. Rules only need to point to a stable group name; users can select a member manually, or the group can choose automatically based on health checks. url-test generally selects the candidate with the best test result; fallback uses the first available candidate in order; load-balance distributes different connections across multiple candidates. These are not simply rankings by speed: they handle automatic selection, ordered failover, and connection distribution respectively. Choose the group type after deciding whether stability, failover order, or distribution is the primary goal.
proxy-groups:
- name: Auto
type: url-test
proxies: [Node-A, Node-B]
- name: Backup
type: fallback
proxies: [Node-A, Node-B]
TUN & System Proxy: Two Ways to Capture Traffic
System proxy mode sends requests from applications that follow the operating system's proxy settings to Clash. It is straightforward and works well for browsers and most desktop software. TUN mode uses a virtual network interface to capture a wider range of connections, including traffic from applications that ignore system proxy settings, some command-line tools, and scenarios requiring UDP. These modes determine how traffic enters the core; they do not change the rules themselves. For a first setup, verify that system proxy mode works before enabling TUN as needed, and pay attention to administrator permissions, routing, and firewall settings.
System Proxy
TUN Mode
Allow LAN Connections
DNS & Fake-IP: Preserve Domain-Based Matching
For domain rules to work reliably, the core must preserve domain information that can be used during connection handling. Fake-IP mode returns mapped addresses for DNS queries, then uses its internal mapping to recover the original domain for subsequent connections, improving the consistency of domain-rule matching. It is not the same thing as the real destination address. Check the listen address, upstream resolvers, enhanced mode, and filter lists together. If LAN devices, specific applications, or local domains have resolution issues, add the relevant domains to the filter range instead of disabling DNS entirely.
dns:
enable: true
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16
respect-rules: true