Skip to main content
EN

Home / Blog / Rules & Routing

Clash rule type reference — DOMAIN, IP-CIDR, GEOIP, PROCESS-NAME and the rest

Rules & Routing2026-07-251288 words3 min read
Clash rule type reference — DOMAIN, IP-CIDR, GEOIP, PROCESS-NAME and the rest

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,🐟 Fallthrough

Matched top to bottom; the first hit wins and nothing below is checked. That single fact underpins every rule behaviour.

The complete type table

TypeWhat it matchesExampleNotes
DOMAINAn exact domainDOMAIN,www.google.com,PROXYExact match, fastest
DOMAIN-SUFFIXA domain suffixDOMAIN-SUFFIX,google.com,PROXYIncludes all subdomains, most used
DOMAIN-KEYWORDDomain contains a keywordDOMAIN-KEYWORD,google,PROXYWide reach, use with care
DOMAIN-REGEXRegex against the domainDOMAIN-REGEX,^api\\..*\\.com$,PROXYMihomo only
GEOSITEA geographic domain setGEOSITE,youtube,PROXYNeeds the geosite database
IP-CIDRIPv4 rangeIP-CIDR,10.0.0.0/8,DIRECT,no-resolveMind no-resolve
IP-CIDR6IPv6 rangeIP-CIDR6,::1/128,DIRECT,no-resolveSame
IP-SUFFIXIP suffixIP-SUFFIX,8.8.8.8/24,PROXYMihomo only
IP-ASNAutonomous system numberIP-ASN,13335,PROXYRoute by carrier or cloud provider
GEOIPCountry the IP belongs toGEOIP,CN,DIRECTNeeds the geoip database
SRC-IP-CIDRSource IPSRC-IP-CIDR,192.168.1.100/32,DIRECTRoute by LAN device
SRC-PORTSource portSRC-PORT,8080,DIRECTRarely used
DST-PORTDestination portDST-PORT,22,DIRECTRoute by service type
PROCESS-NAMEProcess namePROCESS-NAME,Telegram.exe,PROXYRoute by program
PROCESS-PATHFull process pathPROCESS-PATH,/usr/bin/curl,PROXYMore precise
RULE-SETReference a rule setRULE-SET,cn-domain,DIRECTPairs with rule-providers
AND / OR / NOTLogical combinationSee belowMihomo only
MATCHCatch-allMATCH,PROXYMust be the last line

Choosing between the three domain rules

The DOMAIN familyDOMAINmatchewww.google.com matchesgoogle.com does notmost precise and fastestDOMAIN-SUFFIXmatchegoogle.com matcheswww.google.com matchesthe everyday choiceDOMAIN-KEYWORDmatchegoogleapis.com matchesnotgoogle.cn matches tooeasy to overreach
Nine times out of ten DOMAIN-SUFFIX is the right answer

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.

With and without no-resolveConnection arrivesdestination is a domainReaches an IP-CIDR ruleneeds an IP to compareWithout no-resolvetriggers a DNS lookup, then comparesWith no-resolveskips the rule outright
Adding no-resolve to the leading private-range rules avoids an extra DNS lookup on every connection

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-resolve

When 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

The correct top-to-bottom arrangement11. Private and loopback rangeswith no-resolve, highest priority22. Ad blocking REJECT rules33. Specific domain rulesDOMAIN, DOMAIN-SUFFIX44. Rule sets via RULE-SETbulk domains55. Geographic catch-allGEOIP,CN,DIRECT66. MATCH as the final catch-allmust be the last line
Putting GEOIP above your specific domain rules is the single most common configuration error

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 services

Mind 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

Relative cost of rule matchingDOMAIN exact matchessentially freeDOMAIN-SUFFIXsuffix tree lookupRULE-SET domainan in-memory setGEOIPneeds an IP, may trigger DNSIP-CIDR without no-resolvemay trigger a DNS lookupPROCESS-NAMEhas to query the system process tableDOMAIN-REGEXruns the regex one by oneRelative orders of magnitude; real cost depends on total rule count and where the match lands

Practical advice:

  • Put frequently hit rules earlier, to reduce the average number of comparisons
  • Use RULE-SET instead of hundreds of hand-written domain rules
  • Use PROCESS-NAME only where genuinely needed, and place it late
  • Avoid large numbers of DOMAIN-REGEX entries

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:

Investigating a bad routeOpen the Connections pagelet it refresh liveVisit the problem sitecreates a new connectionRead the Rule columnnow you know which rule matchedInsert a more specific rule above itvia prepend-rules
No guessing needed — the core tells you exactly how it decided

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,🚀 Select

prepend-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,DIRECT

Avoiding QUIC problems (UDP 443 behaves badly on some networks)

- AND,((NETWORK,UDP),(DST-PORT,443)),REJECT

Force one LAN device to go direct

- SRC-IP-CIDR,192.168.1.50/32,DIRECT

Keep 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,DIRECT

In 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

Routing individual programs with PROCESS-NAME rules
Rules & Routing Routing individual programs with PROCESS-NAME rules

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.

2026-06-221224 words3 min read