Clash Tutorials

From installation to mastery, this complete guide will take you from zero to proficient with Clash. Covers platform installation, subscription import, rule configuration, TUN mode, DNS anti-pollution, and more.

Tutorial Outline

01 Quick Start

Get Up and Running in 4 Steps

If this is your first time using Clash, you only need four steps to complete the basic setup. We use Clash Verge Rev as the example client throughout this guide, as it is the most recommended desktop client with a clean interface and straightforward configuration.

  1. Download and install the client
    Head to our download page and grab the Clash Verge Rev installer for your operating system. Windows users should download the .exe installer, macOS users the .dmg image, and Linux users the .deb or AppImage package. For a detailed walkthrough with screenshots, see our complete Windows installation guide.
  2. Import your subscription link
    Open Clash Verge Rev and click the Profiles tab in the left sidebar. Paste your subscription URL (provided by your proxy service) into the input field at the top, then click Import. Once the profile card appears, click it to activate it (the card border will turn blue).
  3. Select a proxy node
    Click the Proxies tab in the sidebar. You will see proxy groups defined by your subscription. Pick a group such as "Proxy" or "Node Select" and choose a node with low latency. You can also switch between Rule mode and Global mode depending on your needs.
  4. Enable system proxy
    Return to the main dashboard and toggle System Proxy to ON. Your browser traffic will now be routed through Clash. Open a browser and visit Google to confirm the proxy is working.
Tip

Once you complete these four steps, you are ready to use Clash. The remaining chapters cover advanced configuration for a better experience. Make sure the basics work before moving on.

02 Platform Installation Guides

Windows Installation (Clash Verge Rev)

Windows is the most popular platform for Clash users. Clash Verge Rev delivers a polished Windows experience and supports Windows 10 and above (Windows 11 recommended).

Step 1: Download the installer

Go to the Clash Verge Rev GitHub Releases page. In the latest release Assets, find the file named Clash.Verge_x.x.x_x64-setup.exe and download it.

Step 2: Run the installer

Double-click the downloaded .exe file. If Windows SmartScreen shows a security prompt, click "More info" then "Run anyway". Follow the setup wizard, keep the default installation path, and click Install.

Step 3: First launch configuration

Launch Clash Verge Rev. The application will automatically set up its service mode. You may be asked to grant administrator permissions on first launch. After the interface loads, follow the Quick Start steps above to import your subscription and enable the system proxy.

Step 4 (Optional): Enable auto-start

Click the settings icon in the top-right corner. Under General Settings, enable "Launch at login" so Clash starts automatically with your system. It is also recommended to enable "Minimize to tray on startup" to keep things tidy.

Service Mode vs. Manual Mode

Clash Verge Rev installs a service mode by default, which allows features like TUN mode to work without running the app as administrator. If service mode installation fails, the interface will show a prompt. Click the "Install Service" button to fix it.

macOS Installation

macOS users need to select the correct version based on their chip type. Apple Silicon (M1/M2/M3/M4) users should choose the ARM64 version; Intel Mac users should choose x64.

Check your Mac chip type

Click the Apple menu in the top-left corner, then "About This Mac". If it shows "Chip: Apple M1/M2/M3/M4", you have Apple Silicon. If it shows "Processor: Intel", you have an Intel Mac.

Download and install

Go to the GitHub Releases page and download the version matching your chip:
Apple Silicon: filename contains aarch64.dmg or arm64.dmg
Intel: filename contains x64.dmg
After downloading, double-click the .dmg file and drag Clash Verge Rev into the Applications folder.

Handling the "Cannot verify developer" prompt

On first launch, macOS may block the app with a "Cannot be opened because the developer cannot be verified" message. To resolve this:
1. Open System Settings, then Privacy & Security
2. Scroll down to find the Clash Verge Rev block notice
3. Click "Open Anyway"
Alternatively, use the terminal to remove the quarantine attribute:

# Run in Terminal (replace with actual app name)
xattr -d com.apple.quarantine /Applications/Clash\ Verge.app

Android Installation

Android users are recommended to use FlClash or Clash Meta for Android. Both are built on the Mihomo core and offer full-featured mobile experiences.

Installation steps

  1. Download the APK from the FlClash or Clash Meta for Android GitHub Releases page.
  2. Allow installation from unknown sources in your device settings when prompted.
  3. Install the APK by opening the downloaded file and following the prompts.
  4. Grant VPN permission when the app requests it on first launch. This is required for Clash to function.
  5. Import your subscription from the Profiles or Config page, paste the URL, import it, and tap the connect button.
Battery Optimization Tip

To prevent the system from killing Clash in the background, set the app to "Not optimized" in Battery Optimization settings, and lock it in the recent apps tray. Steps vary by Android manufacturer.

iOS Installation

iOS offers several Clash-compatible clients. Due to Apple's App Store restrictions, all clients are distributed through the store.

Available clients

  • Clash Plus (free) -- A free and feature-complete Clash client, ideal for beginners.
  • Stash (paid) -- Beautiful interface with multi-core support and advanced rule configuration for power users.
  • Shadowrocket (paid) -- A multi-protocol veteran client that also supports importing Clash configurations.

Installation

Search for and download the client from a non-China-region App Store. After installation, open the app, find the Import or Config section, paste your subscription URL, activate the profile, and tap Connect.

Note

iOS client availability may change at any time. Some clients may require a non-Chinese Apple ID. Follow our blog for the latest updates on iOS clients.

Linux Installation

Linux desktop users can choose Clash Verge Rev or FlClash. Server users typically run the Mihomo core directly.

Ubuntu / Debian

Download and install the .deb package:

# Download the deb package (replace with latest version)
wget https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v2.x.x/clash-verge_2.x.x_amd64.deb

# Install
sudo dpkg -i clash-verge_2.x.x_amd64.deb

# Fix dependency issues if any
sudo apt-get install -f

Fedora / RHEL

Install the .rpm package:

sudo rpm -i clash-verge_2.x.x.x86_64.rpm

AppImage (Universal)

For distribution-agnostic installation:

# Download AppImage
wget https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v2.x.x/Clash-Verge_2.x.x_x86_64.AppImage

# Make executable
chmod +x Clash-Verge_2.x.x_x86_64.AppImage

# Run
./Clash-Verge_2.x.x_x86_64.AppImage

03 Subscription Management

What Is a Subscription Link

A subscription URL is a special link provided by your proxy service that contains the configuration for all available nodes. It is essentially a Base64-encoded configuration file holding server addresses, ports, encryption methods, passwords, and all connection parameters.

Key characteristics of subscription links:

  • Each user has a unique subscription link tied to their account
  • The link often encodes traffic quota and expiration date
  • When the provider updates nodes, the subscription content updates automatically
  • Your subscription link is equivalent to your access key -- never share it with others

A typical subscription URL looks like this (redacted):

https://api.provider.com/sub/xxxxxx?token=yyyyyyyy
Security Warning

Your subscription link contains your account credentials and authentication token. If leaked, anyone can use your traffic quota. Never share your subscription URL in public channels, screenshots, group chats, or forums.

How to Import a Subscription

Clash Verge Rev

  1. Open the Profiles page -- Click the Profiles icon in the left sidebar.
  2. Paste the subscription URL -- Enter the full link in the input field at the top.
  3. Click Import -- Press the Import button or hit Enter. Wait for the download to complete. A profile card will appear in the list.
  4. Activate the profile -- Click the newly imported card to select it (the border turns blue).

Local file import

If you have a local YAML configuration file (for example, one you wrote yourself), you can import it directly:

  • Clash Verge Rev: In the Profiles page, click "New", select "Local", and choose your YAML file.
  • Command line: Copy the YAML file to the client's config directory, typically ~/.config/clash/.

If the import fails, refer to our detailed subscription import troubleshooting guide for solutions.

Updating and Refreshing Subscriptions

Subscriptions do not auto-update by default. You need to trigger updates manually or set an update interval.

Manual update

Right-click the profile card and select "Update", or click the refresh icon on the card. The client will re-download the subscription content to get the latest node list.

Auto-update

Clash Verge Rev supports setting an auto-update interval. Go to Settings then Update Interval and set a reasonable frequency (e.g., 1440 minutes for once every 24 hours). The client will then pull the latest subscription in the background automatically.

Subscription conversion

Some providers distribute subscriptions in formats incompatible with Clash (raw Shadowsocks, Surge, etc.). In these cases, use a subscription conversion tool to transform the link into Clash-compatible format. Common tools include sub-web (open-source frontend) and self-hosted subconverter backends.

04 Rule Configuration

Understanding Rules

Clash's rule-based traffic routing is its core strength. Rules determine which traffic goes through a proxy, which goes direct, and which is blocked. Mastering the rule system is essential for advanced Clash usage.

Clash processes rules sequentially:

  1. When a network request reaches Clash, it starts matching from the first rule in the list.
  2. Once a match is found, the request is handled according to that rule's policy (proxy, direct, or reject).
  3. If no rules match, the MATCH (fallback) rule is applied.

Common rule types

  • DOMAIN -- Exact domain match (e.g., DOMAIN,google.com,Proxy)
  • DOMAIN-SUFFIX -- Domain suffix match (e.g., DOMAIN-SUFFIX,google.com,Proxy matches google.com, www.google.com, maps.google.com, etc.)
  • DOMAIN-KEYWORD -- Domain keyword match (e.g., DOMAIN-KEYWORD,google,Proxy)
  • IP-CIDR -- IP range match (e.g., IP-CIDR,192.168.0.0/16,DIRECT)
  • GEOIP -- Country-based IP match (e.g., GEOIP,CN,DIRECT)
  • MATCH -- Fallback rule that catches everything not matched above

Example: Basic Rule Configuration

Below is a practical rule set suitable for daily use. It blocks ads, routes domestic sites directly, proxies foreign sites, and sends everything else through the proxy.

rules:
  # ===== Ad blocking =====
  - DOMAIN-KEYWORD,admarvel,REJECT
  - DOMAIN-KEYWORD,admaster,REJECT
  - DOMAIN-KEYWORD,adsage,REJECT
  - DOMAIN-SUFFIX,adservice.com,REJECT

  # ===== Proxy sites =====
  - DOMAIN-SUFFIX,google.com,Proxy
  - DOMAIN-SUFFIX,youtube.com,Proxy
  - DOMAIN-SUFFIX,twitter.com,Proxy
  - DOMAIN-SUFFIX,github.com,Proxy
  - DOMAIN-SUFFIX,telegram.org,Proxy

  # ===== Domestic direct =====
  - DOMAIN-SUFFIX,baidu.com,DIRECT
  - DOMAIN-SUFFIX,taobao.com,DIRECT
  - DOMAIN-SUFFIX,qq.com,DIRECT
  - DOMAIN-SUFFIX,bilibili.com,DIRECT

  # ===== LAN direct =====
  - IP-CIDR,127.0.0.0/8,DIRECT
  - IP-CIDR,172.16.0.0/12,DIRECT
  - IP-CIDR,192.168.0.0/16,DIRECT
  - IP-CIDR,10.0.0.0/8,DIRECT

  # ===== China IP direct =====
  - GEOIP,CN,DIRECT,no-resolve

  # ===== Fallback: everything else via proxy =====
  - MATCH,Proxy
Rule order matters

Rules are matched from top to bottom. Once a match is found, processing stops. Place ad-blocking rules first (highest priority), then specific proxy/direct rules, then LAN and GeoIP rules, and finally the MATCH fallback at the end.

For a deeper dive, read our beginner's guide to Clash rule configuration.

Community Rule Sets

Maintaining a large rule set manually is tedious. We recommend using community-maintained rule sets:

  • Loyalsoldier/clash-rules -- One of the most popular Clash rule sets. Covers ad blocking, domestic direct, proxy domains, and more. Updated daily. Supports Rule Provider for online loading.
  • blackmatrix7/ios_rule_script -- A comprehensive rule set project covering Clash, Surge, Quantumult X, and more. Finely categorized and actively maintained.
  • ACL4SSR -- Rules curated for SSR/Clash users with multiple presets (minimal, full, ad-free). Suitable for different needs.

Loading community rule sets via Rule Provider is covered in Chapter 5.

05 Advanced Configuration

TUN Mode (Full Transparent Proxy)

TUN mode is one of Clash's most powerful features. It creates a virtual network interface to capture all system traffic (not just HTTP/SOCKS proxy traffic), achieving true "full transparent proxying." With TUN mode enabled, all applications — including games, command-line tools, and apps that don't support proxy settings — have their traffic routed through Clash.

TUN Mode vs. System Proxy

Normal "System Proxy" mode only proxies applications that respect HTTP/SOCKS proxy settings (mainly browsers). TUN mode captures all traffic, including:

  • Applications that don't support proxy settings
  • Command-line tools (curl, git, ssh, etc.)
  • Game clients
  • Electron apps (some bypass system proxy)
  • Docker container traffic (requires additional config)

Enabling TUN Mode

Enabling TUN mode in Clash Verge Rev is straightforward:

  1. Ensure Service Mode is installed — TUN mode requires creating a virtual network interface, which typically needs admin/root privileges. Clash Verge Rev handles this through its service mode. Check the main interface for "Service Mode: Running."
  2. Enable TUN mode — Click "Settings" on the left → find "TUN Mode" → toggle it on. If service mode is properly installed, TUN activates immediately.
  3. Disable System Proxy — After enabling TUN, turn off "System Proxy" to avoid a double-proxy loop.
  4. Verify TUN mode — Open a browser and visit ip.sb or whoer.net to check if your IP shows as the proxy IP. Then try pinging a domain to confirm DNS is also resolved through Clash.

TUN Mode Configuration Example

In your Clash config file, TUN mode settings look like this:

tun:
  enable: true
  stack: system          # Options: system / gvisor / mixed
  dns-hijack:
    - any:53               # Hijack all DNS queries
  auto-route: true        # Auto-configure routing table
  auto-detect-interface: true  # Auto-detect outbound interface
💡 TUN Stack Mode Selection

system: Best performance, best compatibility — recommended first choice.
gvisor: Google's user-space network stack — better isolation but slightly lower performance.
mixed: Hybrid mode — uses system stack for TCP, gvisor for UDP, balancing performance and compatibility.

For a complete walkthrough of TUN mode setup including stack selection and DNS hijacking configuration, read our TUN mode global proxy guide.

DNS Configuration & Anti-Pollution

DNS pollution is one of the primary censorship techniques. Attackers return false IP addresses during DNS resolution, preventing you from accessing target websites or redirecting you to wrong servers. Clash's DNS module effectively prevents DNS pollution, ensuring accurate domain resolution.

How DNS Pollution Works

When you query a blocked domain using standard DNS (UDP port 53), the censorship system responds with a fake IP address faster than the legitimate DNS server. Your device receives this fake IP and tries to connect to the wrong server, naturally failing to reach the target. This is DNS pollution.

Clash's DNS Anti-Pollution Approach

Clash prevents DNS pollution through these mechanisms:

  • DNS-over-HTTPS (DoH) — Encrypts DNS queries via HTTPS, preventing man-in-the-middle tampering
  • DNS-over-TLS (DoT) — Encrypts DNS queries via TLS
  • Nameserver & Fallback Separation — Uses domestic DNS for domestic domains (fast) and encrypted DNS for foreign domains (pollution-proof)
  • Fallback Filtering — If domestic and overseas DNS return different results, prioritize the overseas DNS result (pollution-proof)

DNS Configuration Example

dns:
  enable: true
  listen: 0.0.0.0:1053
  ipv6: false
  enhanced-mode: fake-ip        # Fake-IP mode (recommended)
  fake-ip-range: 198.18.0.1/16  # Fake-IP address pool
  fake-ip-filter:               # Domains that skip fake-IP
    - '*.lan'
    - '*.local'
    - 'localhost.ptqy.gitv.tv'
  default-nameserver:            # DNS for resolving DoH domains themselves
    - 223.5.5.5
    - 119.29.29.29
  nameserver:                    # Domestic DNS
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
  fallback:                      # Overseas DNS (anti-pollution)
    - https://dns.cloudflare.com/dns-query
    - https://dns.google/dns-query
    - tls://8.8.4.4:853
  fallback-filter:               # Conditions for using fallback
    geoip: true
    geoip-code: CN
    ipcidr:
      - 240.0.0.0/4

Fake-IP Mode Explained

Fake-IP is Clash's recommended DNS mode. When an app requests DNS resolution, Clash immediately returns a fake IP (from the fake-ip-range) without performing a real DNS query, while recording the domain-to-fake-IP mapping. When the app actually initiates a connection, Clash intercepts it, matches rules based on the domain, then resolves the real IP using the correct DNS. Benefits include:

  • Eliminates DNS resolution delay (instant fake IP return)
  • Prevents DNS pollution (real resolution happens at the proxy layer)
  • Reduces DNS queries (only resolves when actually connecting)

For an in-depth explanation of DNS anti-pollution mechanisms and a complete configuration guide, read our DNS anti-pollution configuration guide.

Proxy Group Policies Explained

Proxy Groups are a core concept in Clash configuration. They define the egress strategy for traffic. With properly configured proxy groups, you can achieve flexible traffic scheduling and node switching.

Common Proxy Group Types

select (Manual Selection) — The most common type. Users can manually choose a node from the group. Ideal for a "Node Select" group.

proxy-groups:
  - name: "Proxy"
    type: select
    proxies:
      - "Hong Kong"
      - "Japan"
      - "United States"
      - DIRECT

url-test (Auto Select) — Automatically tests latency for all nodes in the group and selects the one with the lowest latency. Perfect for automatic optimal node selection.

  - name: "Auto Select"
    type: url-test
    proxies:
      - "Hong Kong"
      - "Japan"
      - "United States"
    url: 'http://www.gstatic.com/generate_204'
    interval: 300           # Test every 300 seconds
    tolerance: 50            # Only switch if latency differs by 50ms+

fallback (Failover) — Tests nodes in order and selects the first available one. If the primary node goes down, it automatically switches to the next.

  - name: "Failover"
    type: fallback
    proxies:
      - "Hong Kong"
      - "Japan"
      - "United States"
    url: 'http://www.gstatic.com/generate_204'
    interval: 300

load-balance (Load Balancing) — Distributes traffic across multiple nodes to increase total bandwidth. Supports per-connection or per-session distribution.

Rule Provider — Online Rule Sets

Rule Providers allow you to load rule sets from remote URLs instead of writing all rules in your local config file. This keeps your rules up-to-date without bloating your local configuration.

Configuration Example

rule-providers:
  reject:                    # Ad blocking rules
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt"
    path: ./ruleset/reject.yaml
    interval: 86400

  proxy:                     # Proxy domain rules
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt"
    path: ./ruleset/proxy.yaml
    interval: 86400

  direct:                    # Direct connection rules
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt"
    path: ./ruleset/direct.yaml
    interval: 86400

  cncidr:                    # China IP ranges
    type: http
    behavior: ipcidr
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt"
    path: ./ruleset/cncidr.yaml
    interval: 86400

rules:
  - RULE-SET,reject,REJECT
  - RULE-SET,proxy,Proxy
  - RULE-SET,direct,DIRECT
  - RULE-SET,cncidr,DIRECT
  - GEOIP,CN,DIRECT,no-resolve
  - MATCH,Proxy
💡 Benefits of Rule Providers

The biggest advantage of Rule Providers: rules are maintained by the community and auto-update. Set it up once, and your rules stay current. The interval parameter controls update frequency (in seconds) — 86400 = once per day.

External Controller & Web Dashboard

Clash provides a RESTful API (external controller) that lets you remotely manage and monitor Clash through a web dashboard. The most popular web dashboards are Yacd and MetaCubeXD.

Configuring the External Controller

external-controller: 127.0.0.1:9090
secret: "your-secret-here"      # Optional: set an access password

Using the Web Dashboard

After configuration, access the web dashboard:

  • Yacd: Visit http://yacd.haishan.me, enter API address http://127.0.0.1:9090
  • MetaCubeXD: Visit http://d.haishan.me, enter the same API address

In the web dashboard you can: view real-time connections and traffic, switch proxy nodes, view logs, manage rules, and inspect DNS query history. Clash Verge Rev has a built-in Dashboard, so you usually don't need to open a separate web dashboard.

06 Troubleshooting

Can't Access the Internet After Installation

This is the most common issue for new users. Possible causes and solutions:

Checklist

  1. Verify System Proxy is enabled — Check "System Proxy" on the Clash dashboard. If using TUN mode, you don't need System Proxy enabled.
  2. Verify subscription is imported and active — In the Profiles page, check that a config file is selected (highlighted). Without an active config, Clash can't proxy any traffic.
  3. Verify the node works — In the Proxies page, select a node and test latency. If all nodes time out, your subscription may have expired or the provider's servers may be down.
  4. Check proxy mode — Ensure you're using "Rule" mode or "Global" mode. "Direct" mode bypasses all proxies.
  5. Close other proxy software — Running multiple proxy tools simultaneously (VPNs, other Clash instances) can cause conflicts. Close other proxy software.
  6. Check system proxy settings — Windows: Settings → Network & Internet → Proxy. Confirm system proxy is correctly set to 127.0.0.1:7890 (Clash's default port). If settings are abnormal, clear them manually and re-enable Clash system proxy.

Subscription Import Fails

If nothing happens or you get an error when clicking import, try these steps:

  1. Check the URL is complete — Ensure you copied the full subscription URL without missing characters. Pay special attention to special characters like = and &.
  2. Check network connectivity — If the subscription server is blocked, you may need to enable proxy first before importing. Temporarily use "Global" mode or manually configure a node first.
  3. Try subscription conversion — Some providers' formats aren't Clash-compatible. Use a subscription conversion tool to convert before importing. See Chapter 3's conversion section.
  4. Import via local file — If online import always fails, open the subscription URL directly in your browser (which may be able to access it), save the content as a .yaml file, then import the local file in Clash.

TUN Mode Not Working

If traffic isn't going through the proxy after enabling TUN mode, possible causes include:

  • Service mode not properly installed — Check if the main interface shows "Service Mode: Running." If not, click to install or repair service mode.
  • Conflict with system proxy — Having both TUN mode and system proxy enabled can cause double-proxying. Enable only TUN mode and disable system proxy.
  • Firewall/security software blocking — Some security software blocks virtual network interface creation. Try temporarily disabling security software and re-enabling TUN.
  • DNS not properly captured — Check that dns-hijack includes any:53 to ensure all DNS queries are captured by Clash.
  • Stack mode incompatibility — Try switching TUN's stack mode (system → gvisor → mixed). Different systems have varying compatibility with specific stacks.

DNS Leak Detection

A DNS leak means your real DNS queries bypass Clash, exposing the domains you're actually visiting. How to check:

  1. Visit a DNS leak test site — Open browserleaks.com/dns or dnsleaktest.com and run a full test. If the DNS server IPs shown are your proxy server's IPs, you have no leak.
  2. Confirm Fake-IP mode — Fake-IP mode inherently prevents DNS leaks since the application layer never makes real DNS queries. Check that enhanced-mode is set to fake-ip in your config.
  3. Check for IPv6 leaks — If you haven't configured IPv6 proxying, disable IPv6 DNS resolution entirely. Set ipv6: false in your config.

Node Connection Failures

If a selected node won't connect (latency test times out or shows errors), troubleshoot these:

  • Node is offline — Contact your provider to confirm node status. Try switching to a different node.
  • Protocol incompatibility — Ensure your client uses the Mihomo (Clash Meta) core. Original Clash doesn't support newer protocols like Vless and Reality.
  • Port blocked — In some network environments, specific ports may be blocked. Try a node using port 443.
  • Local firewall — Check if your local firewall is allowing the Clash process and port.
  • Incorrect system time — TLS handshakes depend on accurate system time. If your clock is significantly off, connections may fail. Sync your system time.
💡 Need More Help?

If none of the above solves your issue, visit the GitHub Issues page for your specific client to search or ask questions. For eight detailed causes and step-by-step fixes, see our node connection troubleshooting guide. You can also follow our blog for the latest troubleshooting guides.