Rules decide where every connection goes. This is a reference table with the practical use of each type.
The basic shape of a rule
rules:
- TYPE,what to match,policy[,extra parameter]For example:
- DOMAIN-SUFFIX,google.com,🚀 Select
- IP-CIDR,192.168.0.0/16,DIRECT,no-resolve
- MATCH,🐟 FallthroughMatched top to bottom; the first hit wins and nothing below is checked. That single fact underpins every rule behaviour.
The complete type table
| Type | What it matches | Example | Notes |
|---|---|---|---|
DOMAIN | An exact domain | DOMAIN,www.google.com,PROXY | Exact match, fastest |
DOMAIN-SUFFIX | A domain suffix | DOMAIN-SUFFIX,google.com,PROXY | Includes all subdomains, most used |
DOMAIN-KEYWORD | Domain contains a keyword | DOMAIN-KEYWORD,google,PROXY | Wide reach, use with care |
DOMAIN-REGEX | Regex against the domain | DOMAIN-REGEX,^api\\..*\\.com$,PROXY | Mihomo only |
GEOSITE | A geographic domain set | GEOSITE,youtube,PROXY | Needs the geosite database |
IP-CIDR | IPv4 range | IP-CIDR,10.0.0.0/8,DIRECT,no-resolve | Mind no-resolve |
IP-CIDR6 | IPv6 range | IP-CIDR6,::1/128,DIRECT,no-resolve | Same |
IP-SUFFIX | IP suffix | IP-SUFFIX,8.8.8.8/24,PROXY | Mihomo only |
IP-ASN | Autonomous system number | IP-ASN,13335,PROXY | Route by carrier or cloud provider |
GEOIP | Country the IP belongs to | GEOIP,CN,DIRECT | Needs the geoip database |
SRC-IP-CIDR | Source IP | SRC-IP-CIDR,192.168.1.100/32,DIRECT | Route by LAN device |
SRC-PORT | Source port | SRC-PORT,8080,DIRECT | Rarely used |
DST-PORT | Destination port | DST-PORT,22,DIRECT | Route by service type |
PROCESS-NAME | Process name | PROCESS-NAME,Telegram.exe,PROXY | Route by program |
PROCESS-PATH | Full process path | PROCESS-PATH,/usr/bin/curl,PROXY | More precise |
RULE-SET | Reference a rule set | RULE-SET,cn-domain,DIRECT | Pairs with rule-providers |
AND / OR / NOT | Logical combination | See below | Mihomo only |
MATCH | Catch-all | MATCH,PROXY | Must be the last line |
Choosing between the three domain rules
What no-resolve really means
This is the parameter people get wrong most often on IP rules.
When a connection arrives with a domain as its destination, the core has to resolve that domain to an IP before it can compare it against an IP-CIDR rule. Adding no-resolve says: if the destination is still a domain (not yet resolved), skip this rule rather than performing a DNS lookup just for it.
When to add it: to every private-range IP rule at the top of your rule list, without exception.
- IP-CIDR,127.0.0.0/8,DIRECT,no-resolve
- IP-CIDR,192.168.0.0/16,DIRECT,no-resolve
- IP-CIDR,10.0.0.0/8,DIRECT,no-resolve
- IP-CIDR,172.16.0.0/12,DIRECT,no-resolve
- IP-CIDR6,fc00::/7,DIRECT,no-resolveWhen not to: do not add no-resolve to a trailing catch-all such as GEOIP,CN,DIRECT, or domain traffic will never reach it at all.
Three iron laws of rule order
Law one: MATCH must be last. It matches everything, so anything below it is dead.
Law two: GEOIP,CN goes after specific domain rules. Plenty of overseas services have in-region CDN nodes that resolve to local addresses. GEOIP placed too early sends all of them direct.
Law three: more specific rules go earlier. DOMAIN first, then DOMAIN-SUFFIX, then DOMAIN-KEYWORD.
Logical combinations (Mihomo)
When you need several conditions at once:
# only proxy this IP range when the Telegram process is the one asking
- AND,((PROCESS-NAME,Telegram.exe),(IP-CIDR,91.108.4.0/22)),PROXY
# destination port 22, and not in-region
- AND,((DST-PORT,22),(NOT,((GEOIP,CN)))),PROXY
# either one is enough
- OR,((DOMAIN-SUFFIX,openai.com),(DOMAIN-SUFFIX,anthropic.com)),🤖 AI servicesMind the bracket nesting — it is easy to leave one out. If a simple rule expresses the same thing, use that instead: it reads better and runs faster.
Performance: which rules are expensive
Practical advice:
- Put frequently hit rules earlier, to reduce the average number of comparisons
- Use
RULE-SETinstead of hundreds of hand-written domain rules - Use
PROCESS-NAMEonly where genuinely needed, and place it late - Avoid large numbers of
DOMAIN-REGEXentries
Finding out which rule a connection matched
Open the Connections page in Clash Verge; the "Rule" column names the rule that matched.
This is the fastest way to diagnose a routing problem:
A correction example — a domain got sent direct by GEOIP,CN and you want it proxied:
# in the global extended config
prepend-rules:
- DOMAIN-SUFFIX,example.com,🚀 Selectprepend-rules inserts at the very top of the rule list, taking priority over everything, and survives subscription updates.
Useful rule snippets
Private ranges direct (essential)
- IP-CIDR,127.0.0.0/8,DIRECT,no-resolve
- IP-CIDR,192.168.0.0/16,DIRECT,no-resolve
- IP-CIDR,10.0.0.0/8,DIRECT,no-resolve
- IP-CIDR,172.16.0.0/12,DIRECT,no-resolve
- IP-CIDR,100.64.0.0/10,DIRECT,no-resolve
- IP-CIDR6,::1/128,DIRECT,no-resolve
- IP-CIDR6,fc00::/7,DIRECT,no-resolve
- DOMAIN-SUFFIX,local,DIRECT
- DOMAIN-SUFFIX,lan,DIRECTAvoiding QUIC problems (UDP 443 behaves badly on some networks)
- AND,((NETWORK,UDP),(DST-PORT,443)),REJECTForce one LAN device to go direct
- SRC-IP-CIDR,192.168.1.50/32,DIRECTKeep BitTorrent traffic off the proxy (many providers forbid it in their terms)
- DST-PORT,6881-6889,DIRECT
- PROCESS-NAME,qbittorrent.exe,DIRECT
- PROCESS-NAME,transmission-daemon,DIRECTIn short
- DOMAIN-SUFFIX carries the load; use KEYWORD sparingly
- Always add no-resolve to leading IP rules, and under fake-ip it is mandatory
- Order: private → blocking → domains → rule sets → GEOIP → MATCH
- Diagnose with the Rule column on the connections page, correct with
prepend-rules
Next, how to host rules externally: remote rule sets with rule-providers.
Related docs
Replacing hundreds of hand-written rules with external lists. The difference between the domain, ipcidr and classical behaviors, text versus yaml, how to set the update interval, and what to check when a rule set does nothing.
A complete configuration that serves a corporate VPN intranet, direct local access and proxied overseas services at the same time, covering domains and IP ranges, DNS routing, and the conflicts that come up.
The complete picture for per-process routing: enabling find-process-mode, finding the process name, PROCESS-NAME versus PROCESS-PATH, the performance cost, and why a rule you wrote does nothing.