Configuration · Approx. 10 min read

Advanced Clash Traffic Routing Guide

Smart routing is what sets Clash apart from traditional VPNs. It makes decisions based on domain, IP, and location to balance direct and proxied connections seamlessly.

1. Split Routing vs. Global Proxy

Global Proxy

  • • All traffic goes through the proxy node
  • • Local websites slow down (routing through overseas servers)
  • • High data consumption and potentially higher costs
  • • May trigger security flags on local platforms

Split Routing

  • • Local sites connect directly at full speed
  • • International services routed through proxy
  • • Saves bandwidth and reduces latency
  • • Supports granular routing for AI, streaming, and more

2. Rule Types Explained

DOMAIN-SUFFIX Domain Suffix Match

Matches a domain and all its subdomains. The most common rule type.

# Route all Google services via PROXY
- DOMAIN-SUFFIX,google.com,PROXY
# YouTube 及子域名走 PROXY
- DOMAIN-SUFFIX,youtube.com,PROXY

DOMAIN-KEYWORD Domain Keyword Match

Any request with a domain containing this keyword will be matched. Great for batch-handling similar services.

# Any request with 'openai' in the domain goes to AI Traffic
- DOMAIN-KEYWORD,openai,AI-Proxy

GEOIP Geographical IP Match

Routes based on server IP location. CN indicates Mainland Chinese IPs (usually set to DIRECT).

# Direct connection for Mainland China IPs
- GEOIP,CN,DIRECT
# 私有局域网 IP 直连
- GEOIP,PRIVATE,DIRECT

RULE-SET Rule Sets (Recommended)

Links to large external rule files maintained by the community. One line can replace thousands of rules; the industry standard for modern Clash setups.

# Link to Loyalsoldier's Rule Set from GitHub
- RULE-SET,gfw,PROXY
- RULE-SET,china,DIRECT

3. Proxy Group Configuration

Proxy groups determine which node(s) a matched request should use. Common types include:

select Manual Select

You manually choose nodes in the Proxies panel. Best for main navigation groups.

url-test Auto-Speed-Test

Automatically selects the lowest-latency node. Best for general international browsing.

fallback Fault Tolerance

Switches to a backup node only if the primary fails. Essential for maintaining stable IPs for AI tools.

proxy-groups:
  # 主策略组:手动选择
  - name: 🔰 选择节点
    type: select
    proxies: [🚀 自动选速, 香港节点, 日本节点]

  # 自动测速组
  - name: 🚀 自动选速
    type: url-test
    url: https://www.gstatic.com/generate_204
    interval: 300
    proxies: [香港节点, 日本节点, 美国节点]

  # AI 专线:故障转移,IP 固定不漂移
  - name: 🤖 AI 专线
    type: fallback
    url: https://www.gstatic.com/generate_204
    interval: 60
    proxies: [美国节点1, 美国节点2]

4. Popular Rule Set Recommendations

Rule Set Usage Strategy
gfw GFW Domain Blacklist PROXY
china Local Chinese Domains DIRECT
openai OpenAI / ChatGPT Domains AI Traffic
netflix Netflix Domains Streaming Group
telegramcidr Telegram IP Ranges PROXY

5. Full Routing Rule Snippet Example

rules:
  # ── AI 服务专线 ──────────────────────────────────
  - DOMAIN-SUFFIX,openai.com,🤖 AI 专线
  - DOMAIN-SUFFIX,claude.ai,🤖 AI 专线
  - DOMAIN-KEYWORD,openai,🤖 AI 专线

  # ── 流媒体 ───────────────────────────────────────
  - DOMAIN-SUFFIX,netflix.com,🎬 流媒体
  - DOMAIN-SUFFIX,nflxvideo.net,🎬 流媒体
  - DOMAIN-SUFFIX,disneyplus.com,🎬 流媒体

  # ── 中国直连 ─────────────────────────────────────
  - GEOIP,PRIVATE,DIRECT
  - GEOIP,CN,DIRECT

  # ── 兜底规则(其余全部走主策略)────────────────────
  - MATCH,🔰 选择节点

6. Advanced Pro-Tips

Rule Order Matters

Clash matches rules from top to bottom. The first match wins. Always place more specific rules higher up, with the MATCH (catch-all) rule at the very bottom.

Using Overrides in Clash Verge Rev

Use the "Override / Merge" feature to append custom rules without modifying your subscription file. This ensures your settings persist after updates.

Subscribing to Loyalsoldier's Rule Set

Loyalsoldier/clash-rules is the gold standard for daily-updated rule sets, covering blocked sites, local domains, streaming, and ad-blocking.

Related Reading