Four advanced tutorials produced by the official Clash team, covering installation, TUN transparent proxy, custom routing rules, and subscription management. Each includes complete steps and recommended configurations.
Estimated time: 5 Mins · For all users
Go to the Download Center and choose the recommended client for your OS:
.exe installer and follow the prompts to complete installation..dmg file and drag the app to the "Applications" folder..AppImage (run directly) or .deb/.rpm packages depending on your distribution.On first launch, the client will guide you through basic settings like theme and language selection.
Obtain a Clash-format subscription link from your provider, usually found in the "Tutorials" or "Subscription" page of the provider's user center.
Importing a subscription in Clash Verge Rev:
In the "Proxies" page of the client:
Ensure "System Proxy" is enabled, then:
Estimated time: 10 Mins · Requires Administrator privileges
System Proxy only works for apps that support HTTP/SOCKS5 protocols. Many programs (games, CLI tools like curl/git/npm, certain apps) bypass system proxy settings and connect directly.
TUN Mode creates a virtual network interface (TUN device) at the OS level, routing all outbound traffic through it for Clash to handle. This is completely transparent to apps and requires no individual configuration.
TUN mode on Windows requires a dedicated driver (Service Mode):
Add the following TUN configuration block to your config.yaml:
tun: enable: true stack: mixed # 推荐:mixed 同时支持 TCP/UDP dns-hijack: - any:53 # 劫持所有 DNS 请求 auto-route: true # 自动配置路由表 auto-detect-interface: true
Most graphical clients also provide a toggle in "Settings → TUN Mode," allowing you to enable it without manually editing the config file.
After toggling "TUN Mode" in the client:
Meta or Clash will appear in system network settings.curl https://www.google.com -I; if it returns HTTP 200, TUN is working correctly.stack to mixed or gvisor.tun kernel module is loaded.Estimated time: 15 Mins · Basic concepts required
The Clash rule format is: Type, Value, Policy. Rules are matched from top to bottom; once a match is found, the corresponding policy is executed immediately and further matching stops.
rules: # 按完整域名匹配 - DOMAIN,www.google.com,Proxy # 按域名后缀匹配(含所有子域名) - DOMAIN-SUFFIX,github.com,Proxy # 按域名关键词匹配 - DOMAIN-KEYWORD,youtube,Proxy # 按 IP 段匹配 - IP-CIDR,192.168.0.0/16,DIRECT # US IPs connect directly - GEOIP,CN,DIRECT # 按进程名匹配 - PROCESS-NAME,steam.exe,DIRECT # 兜底规则:未命中的全部走代理 - MATCH,,Proxy
Available policies: DIRECT, REJECT, or any policy group name (e.g., Proxy, HK).
In the client, find your active configuration file, right-click, and select "Edit in Editor" or "Show in Folder."
VS Code with the YAML extension is recommended for real-time syntax error detection. The rules: section is typically at the end of the file.
Insert your custom rules at the very top of the rules: list (highest priority):
rules: # ── 自定义规则放这里(最高优先级)── # 让微信走直连 - PROCESS-NAME,Discord.exe,DIRECT - DOMAIN-SUFFIX,discord.com,DIRECT # 屏蔽广告域名 - DOMAIN-SUFFIX,ads.example.com,REJECT # 让 npm 走代理加速 - DOMAIN-SUFFIX,npmjs.com,Proxy - DOMAIN-SUFFIX,registry.npmjs.org,Proxy # ── 下面是原有规则,不要删除 ── ...
For complex scenarios like ad-blocking or streaming unblocking, it is recommended to directly reference community-maintained rule sets to avoid manual maintenance:
rule-providers: reject: type: http behavior: domain url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt" path: ./ruleset/reject.yaml interval: 86400 rules: - RULE-SET,reject,REJECT # 广告拦截 ...
interval (in seconds) you set.After saving the config file, click "Reload Configuration" in the client (or restart it) for changes to take effect.
Debugging Tips:
debug to see the step-by-step rule-matching process for each request.Estimated time: 10 Mins · Essential for daily maintenance
Clash clients support multiple subscription profiles, allowing you to switch between providers quickly. In the "Profiles" page:
Providers update nodes periodically; auto-updates ensure you always have the latest list:
You can also add an update interval (in seconds) at the top of config.yaml:
# Proxy Provider 自动更新示例 proxy-providers: my-airport: type: http url: "https://your-airport.com/clash/proxies" interval: 86400 # 每 24 小时自动更新 path: ./providers/my-provider.yaml health-check: enable: true url: https://www.gstatic.com/generate_204 interval: 300 # 每 5 分钟健康检查
If a subscription fails to update or all nodes timeout, follow these steps:
Subscriptions often contain dozens or hundreds of nodes. Use Proxy Provider filtering to load only the ones you need:
proxy-providers: hk-nodes: type: http url: "https://your-airport.com/clash/proxies" interval: 86400 path: ./providers/hk.yaml filter: "香港|HK|Hong Kong" # 只保留香港节点 health-check: enable: true url: https://www.gstatic.com/generate_204 interval: 300
The filter field supports regular expressions, allowing you to filter nodes by region or type and reducing clutter.
Subscription links and custom rules are your core settings. Regular backups are highly recommended:
config.yaml (or custom rule files) to cloud storage like iCloud, OneDrive, or a private GitHub repo.If this tutorial didn't cover your question, check the Clash FAQ or download a client to start experiencing it yourself.