Clash Config Examples

Readable YAML snippets for common situations. Understand the structure first, then adapt it to your client, core and provider.

Do not paste blindly

These examples show structure, not ready-made server credentials. Replace addresses, passwords, URLs and DNS choices with trusted values.

Minimal Profile

Keep only local ports, mode, one node, one group and basic rules to confirm YAML parsing.

mixed-port: 7890
allow-lan: false
mode: rule
log-level: info

proxies:
  - name: demo-ss
    type: ss
    server: 203.0.113.10
    port: 8388
    cipher: aes-128-gcm
    password: example-password

proxy-groups:
  - name: PROXY
    type: select
    proxies:
      - demo-ss
      - DIRECT

rules:
  - GEOIP,CN,DIRECT
  - MATCH,PROXY

DNS and Fake-IP

Shows where nameserver, fallback and fake-ip-filter live. Adjust resolvers for your region and provider.

dns:
  enable: true
  listen: 0.0.0.0:1053
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  nameserver:
    - https://dns.alidns.com/dns-query
    - https://doh.pub/dns-query
  fallback:
    - https://dns.google/dns-query
    - https://cloudflare-dns.com/dns-query
  fake-ip-filter:
    - '*.lan'
    - '*.local'
    - time.*.com

Proxy Provider and Rule Provider

Useful when remote proxy lists and rule sets update separately. Check URL, path and interval.

proxy-providers:
  provider-a:
    type: http
    url: https://example.com/clash.yaml
    path: ./providers/provider-a.yaml
    interval: 3600
    health-check:
      enable: true
      url: https://www.gstatic.com/generate_204
      interval: 600

rule-providers:
  reject-list:
    type: http
    behavior: domain
    url: https://example.com/reject.yaml
    path: ./rules/reject.yaml
    interval: 86400

proxy-groups:
  - name: PROXY
    type: select
    use:
      - provider-a

rules:
  - RULE-SET,reject-list,REJECT
  - MATCH,PROXY

Basic TUN Example

TUN captures more traffic and often requires admin permissions. Test normal system proxy first.

tun:
  enable: true
  stack: system
  dns-hijack:
    - any:53
  auto-route: true
  auto-detect-interface: true

dns:
  enable: true
  enhanced-mode: fake-ip
  listen: 0.0.0.0:1053

Linux systemd Service

For command-line core deployments. GUI clients usually do not require manual systemd units.

[Unit]
Description=Mihomo Proxy Core
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
ExecStart=/usr/local/bin/mihomo -d /etc/mihomo
Restart=on-failure
RestartSec=5s
LimitNOFILE=1048576

[Install]
WantedBy=multi-user.target

Next Checks

  • Use the glossary when a field name is unclear.
  • Use the core matrix when a node type does not appear after import.
  • Use the FAQ if the client connects but apps still do not work.