Tutorials

Clash Official Usage Tutorials

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.

~ 30 Mins Beginner to Intermediate 4 Tutorials
Quick Start TUN Proxy Custom Rules Subscriptions
1

Clash Quick Start Tutorial

Estimated time: 5 Mins · For all users

After completing this tutorial, you will be able to:
  • Install the Clash graphical client on your device
  • Import subscription links and load node lists
  • Select appropriate nodes and proxy modes
  • Verify that the proxy is working correctly
1
Choose and Download the Right Client for Your Platform

Go to the Download Center and choose the recommended client for your OS:

  • Windows / macOS / Linux: Recommended Clash Verge Rev for its user-friendly UI, comprehensive features, and active updates.
  • Android: Recommended ClashMeta for Android. Enable "Install from unknown sources" after downloading the APK.
  • iOS: Recommended Stash or Shadowrocket, available on the App Store.
Windows macOS Linux Android
Please ensure you download from this site or official GitHub Releases to avoid installers from unknown sources.
2
Install the Client
  • Windows: Run the .exe installer and follow the prompts to complete installation.
  • macOS: Open the .dmg file and drag the app to the "Applications" folder.
  • Linux: Use .AppImage (run directly) or .deb/.rpm packages depending on your distribution.
  • Android: Temporarily allow "Install unknown apps" in system settings, then tap the APK to install.

On first launch, the client will guide you through basic settings like theme and language selection.

3
Get and Import Subscription Link

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:

  • Click the "Profiles" menu on the left.
  • Click the "+" icon in the top right → Select "Remote"
  • Paste the subscription URL, enter a name, and click "Download."
  • Once downloaded, click the "" icon on the profile to set it as current.
It is recommended to enable auto-update (e.g., every 24 hours) to keep the node list up to date.
4
Select Node and Proxy Mode

In the "Proxies" page of the client:

  • Click "Test Latency" (lightning icon) and choose a node with low latency.
  • Select "Rule" mode – the most recommended daily mode where domestic traffic connects directly and international traffic uses the proxy.
Avoid using "Global" mode long-term, as it routes all traffic (including domestic) through the proxy, which will be slower.
5
Verify that the proxy is working correctly

Ensure "System Proxy" is enabled, then:

  • Visit google.com; if it opens, the proxy is working.
  • Visit amazon.com; if it opens, domestic direct connection is also fine.
  • In the "Connections" page, you can see if each connection is using the proxy or direct connection.
Congratulations! You have completed the basic setup and can now use Clash. If you encounter issues, please refer to the FAQ page.

2

Clash TUN Mode Transparent Proxy Configuration

Estimated time: 10 Mins · Requires Administrator privileges

After completing this tutorial, you will be able to:
  • Understand the difference between TUN mode and system proxy
  • Enable TUN correctly on Windows / macOS / Linux
  • Let games, command-line tools, etc., use the proxy
  • Troubleshoot common TUN mode issues
1
How TUN Mode Works

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 requires Administrator (root) privileges and may conflict with other VPN software. Disable WireGuard, OpenVPN, etc., before use.
2
Windows: Install Service Mode Driver

TUN mode on Windows requires a dedicated driver (Service Mode):

  • Open Clash Verge Rev and go to "Settings."
  • Find "Service Mode" and click "Install."
  • Click "Yes" when the UAC prompt appears to allow admin privileges.
  • Once installed, the service mode status will show as "Installed" (green).
Service mode only needs to be installed once. If installation fails, try right-clicking the client and choosing "Run as administrator."
3
Enable TUN in Configuration

Add the following TUN configuration block to your config.yaml:

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.

4
Enable and Verify TUN Mode

After toggling "TUN Mode" in the client:

  • A new virtual network interface named Meta or Clash will appear in system network settings.
  • Open a terminal and run curl https://www.google.com -I; if it returns HTTP 200, TUN is working correctly.
  • Games and other non-proxy-aware apps should now be able to access the internet via proxy nodes.
TUN mode enabled successfully! All system traffic is now managed by Clash.
5
Common Troubleshooting
  • Disconnected after enabling: Check for conflicts with other VPN software; try reinstalling the Service Mode driver.
  • UDP not working: Change stack to mixed or gvisor.
  • macOS permission prompt: Allow Clash's network extension in System Preferences → Privacy & Security.
  • Linux no effect: Confirm kernel version ≥ 5.2 and that the tun kernel module is loaded.

3

Writing Custom Clash Routing Rules

Estimated time: 15 Mins · Basic concepts required

After completing this tutorial, you will be able to:
  • Understand Clash rule syntax and matching logic
  • Add custom rules by domain, IP range, and process name
  • Reference community rule sets for quick ad-blocking
  • Debug rules and locate routing issues
1
Understand Basic Rule Syntax

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.

yaml
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).

2
Find and Edit Configuration File

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.

YAML requires strict indentation: use 2 spaces per level. Do not use Tab, or the configuration file will fail to parse.
3
Add Custom Rules

Insert your custom rules at the very top of the rules: list (highest priority):

yaml
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

  # ── 下面是原有规则,不要删除 ──
  ...
4
Reference Community Rule Sets (Rule Providers)

For complex scenarios like ad-blocking or streaming unblocking, it is recommended to directly reference community-maintained rule sets to avoid manual maintenance:

yaml
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  # 广告拦截
  ...
Clash will automatically download and update rule sets based on the interval (in seconds) you set.
5
Save and Reload Configuration to Debug Rules

After saving the config file, click "Reload Configuration" in the client (or restart it) for changes to take effect.

Debugging Tips:

  • The "Connections" page in the client shows which rule each connection matched.
  • Set the log level to debug to see the step-by-step rule-matching process for each request.
  • If a site is not routed as expected, ensure the rule is in the correct position (before the MATCH rule).

4

Clash Subscription Management and Auto-updates

Estimated time: 10 Mins · Essential for daily maintenance

After completing this tutorial, you will be able to:
  • Manage and switch between multiple subscription sources
  • Configure auto-updates to keep nodes up to date
  • Handle subscription failures and node timeouts
  • Use Proxy Provider for dynamic node loading
1
Add and Manage Multiple Subscriptions

Clash clients support multiple subscription profiles, allowing you to switch between providers quickly. In the "Profiles" page:

  • Click "+" to add multiple remote configurations.
  • Click the "" icon on any profile to switch to it immediately.
  • Right-click a profile to rename, delete, or update it manually.
It's a good idea to give each profile a descriptive name like "Provider A-HK" or "Provider B-US" for quick identification.
2
Configure Auto-updates

Providers update nodes periodically; auto-updates ensure you always have the latest list:

  • Find the "Auto Update" or "Update Interval" option in the profile settings.
  • Recommended interval: 24 hours (1440 mins). Updates happen silently in the background.
  • Some clients support "Update on Startup" to pull the latest config every time the software opens.

You can also add an update interval (in seconds) at the top of config.yaml:

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 分钟健康检查
3
Handling Subscription Failures and Node Timeouts

If a subscription fails to update or all nodes timeout, follow these steps:

  • Check subscription URL: Try opening the URL directly in a browser; if it returns content, the link is valid.
  • Check data usage: Log in to your provider's dashboard to confirm remaining data and plan status.
  • Check expiration: Ensure your plan hasn't expired and renew if necessary.
  • Update link: Some providers periodically change subscription addresses; get the latest link.
If nodes have latency but are very slow, it's usually a bandwidth issue with the provider. Try non-peak hours (avoid peak hours in your region).
4
Filter Nodes for Better Management

Subscriptions often contain dozens or hundreds of nodes. Use Proxy Provider filtering to load only the ones you need:

yaml
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.

5
Back Up Important Configurations

Subscription links and custom rules are your core settings. Regular backups are highly recommended:

  • Save your config.yaml (or custom rule files) to cloud storage like iCloud, OneDrive, or a private GitHub repo.
  • Keep subscription URLs in a password manager or note app.
  • If you use multiple devices, host your config file at a private URL so all devices can subscribe to the same setup.
You have now mastered Clash subscription management. Combined with the previous tutorials, you can handle almost any usage scenario.

More Clash Help & Support

If this tutorial didn't cover your question, check the Clash FAQ or download a client to start experiencing it yourself.

FAQ Download Client