Rule-Based Routing
Rule-based routing is what sets Clash apart from traditional proxy tools: the core matches every connection against the rules list from top to bottom, and once a connection hits a DOMAIN-SUFFIX, GEOIP, IP-CIDR, or similar condition, it's handed off to the specified proxy group; anything that doesn't match falls through to the MATCH catch-all rule. Paired with proxy-groups, you can send mainland China sites direct, route overseas sites through the proxy, and reject ad domains outright — all without manual switching. Rule sets support remote subscriptions and local overrides, so a configuration written once keeps working long-term.
rules:
- DOMAIN-SUFFIX,github.com,PROXY
- GEOIP,CN,DIRECT
- MATCH,PROXY
Mixed Port & LAN Sharing
mixed-port accepts both HTTP and SOCKS5 proxy traffic on the same port, so system proxy settings, browser extensions, and command-line tools only need to remember one port number. Turning on allow-lan makes the core listen on the LAN address as well — phones, tablets, and TVs on the same Wi-Fi can share the same exit by pointing their proxy server at this computer's local IP, without installing a client on every device. Before enabling it, allow inbound connections to that port in your system firewall, or other devices will time out trying to connect.
mixed-port: 7890
allow-lan: true
bind-address: "*"
Multi-Protocol Core
Most mainstream clients now bundle the mihomo core (the continuation of Clash.Meta), which stays compatible with the original Clash configuration syntax while adding broader protocol support: Shadowsocks, VMess, VLESS, Trojan, Hysteria2, TUIC, and more can all be mixed into a single configuration, so subscriptions don't need to be split by protocol. The core ships as a single binary, and desktop, mobile, and router deployments all share the same rule syntax — switching devices doesn't mean relearning configuration, and old configs can usually be migrated as-is.
proxies:
- name: "HK-01"
type: vless
server: example.com
port: 443
Subscription & Config Management
A subscription packages the node list your provider issues into a single URL, and the client fetches it on a schedule to keep the node list current. Clients like Clash Verge Rev offer three related switches — update interval, auto-update on launch, and update through proxy — and if a fetch temporarily fails, the last working configuration is kept so your current connection isn't affected. Advanced users can merge several subscriptions into one configuration with proxy-providers, then inject their own routing rules uniformly through override files or global extension scripts.
proxy-providers:
main:
type: http
url: "https://example.com/sub"
interval: 86400
TUN Mode
System proxy settings only affect applications that respect them — command-line tools, game clients, and some desktop software bypass them entirely. TUN mode creates a virtual network adapter on the system, taking over all outbound traffic at the network layer and handing it to the core for rule-based processing, so even programs that ignore proxy settings get routed correctly. Enabling it requires granting the client administrator privileges or a system extension permission, and it's best to leave the DNS-hijacking-related settings at their defaults to avoid domain resolution issues.
tun:
enable: true
stack: system
auto-route: true