· Getting Started · 6 min read

Clash Rule, Global, and Direct Modes Explained: Which Should You Use?

Learn how Clash routes traffic in rule, global, and direct mode. See when to switch, how common mainland China and international access scenarios differ, and what can go wrong.

mode: Use rule mode day to day; switch modes when troubleshooting

mode is a top-level configuration field. If it is not set, mihomo defaults to rule. At runtime, a client may restore your previous selection or apply an override when loading a subscription. When troubleshooting, check the mode currently shown in the client, then verify the configuration in use—not just the YAML file on disk.

ModeHow connections received by the core are routedBest for
Rule ruleChecks rules from top to bottom and routes traffic according to the first matchEveryday traffic routing, with local services kept direct
Global globalSkips regular routing rules and uses the current GLOBAL selectionPin traffic to one route to check whether rules are sending it the wrong way
Direct directSkips regular routing rules and connects directly to the destinationCheck whether a destination is reachable on your current network

These modes only determine how the core routes a connection it has received. Whether an app sends its traffic to the core is a separate question. Global mode is not another name for TUN, and direct mode does not mean the client is closed.

Rule mode: Check the match, then the policy group

The rules list is checked in order, and the first match determines what happens next. The action can be DIRECT, REJECT, or a policy group. If a manual selection group matches, check whether it is currently set to a proxy node or direct. The same rule can match every time without always using the same route.

mode: rule
rules:
  - DOMAIN,login.example.com,DIRECT
  - DOMAIN-SUFFIX,example.com,Work Egress
  - MATCH,DIRECT

This YAML snippet uses example domains to show how rule order works. Work Egress must match the name of an existing policy group in your configuration; this snippet is not a complete configuration. Requests to login.example.com match the first rule and go direct. Requests to docs.example.com match the second rule, with the policy group deciding the route. Other unmatched connections fall through to the final MATCH. Move the domain-suffix rule to the top, and the login domain will also use the policy group.

Don't route sites based only on the language of their pages

A single webpage can request resources from the main site, a login API, and a static asset host. If the page loads but login keeps spinning, find the failed request's domain in the connection log instead of adding a rule for only the address-bar domain. Keep local network admin pages, corporate intranet sites, and services that require a local route on direct, as needed. Send only domains that need a specific route to the relevant policy group.

Also check the subscription's final MATCH rule. Some configurations send unmatched traffic to a proxy group; others send it direct. Rule mode is not a fixed geographic routing scheme. If behavior changes after a subscription update, check the matched rule and fallback first, then confirm that any client overrides are still active.

Global mode: useful for comparison, but it doesn't capture every app's traffic

After switching to global, check the current GLOBAL selection in the client's proxy or policy view. If it is set to DIRECT, traffic still goes out directly. If it is set to a proxy node, new connections received by the core use that route—including requests that went direct in rule mode. This is one common reason local network devices become unreachable or services trigger region or login checks after switching to global mode.

  1. Reproduce the issue in rule mode first. Note the destination domain, matched rule, and actual route for a failed connection. A node's latency value does not tell you whether the destination site is reachable.
  2. Leave the system proxy or TUN setting unchanged, then switch to global mode and select a known-working node in GLOBAL. Close the test page and start a new connection. If the browser reuses an existing connection, quit and relaunch it.
  3. If global mode works but rule mode doesn't, switch back to rule mode and temporarily set the matched policy group to the same node. If the rule matches DIRECT or REJECT directly, first check whether that rule matches your intended routing policy; there's no need to switch the entire configuration to global mode.

Direct mode: how it differs from disabling the system proxy or closing the client

direct makes connections already received by the core go direct. If an app still points to the local proxy, it must connect to the client first. If TUN is still on, traffic matching its routes may also continue to enter the core. DNS settings in the configuration may still apply too. So direct mode tests direct access through the client's current entry point; it is not the same as testing your network with the client closed.

For example, if the active configuration has mixed-port: 7890 and the core listens on the loopback address, a browser can send requests through the local HTTP proxy at 127.0.0.1:7890. Switching to direct mode does not change that entry point. If you then close the client while the browser still points to that port, the request may fail when connecting to the local port—before DNS resolution or a remote connection is attempted. 7890 is only an example; use the port in the client's active configuration.

How to test your network without Clash

Turn off TUN, then disable the system proxy configured by the client. Check whether the test app has its own proxy settings. If system DNS was manually pointed at a DNS listener provided by the client, restore the previous setting as well. Reopen the test app and request the same address on the same network. Disabling the system proxy does not override an app's own proxy settings, and simply closing the client does not guarantee that all manually changed settings are restored.

Mode changes have no effect? Check the entry point, rules, and route

  • Entry point: Start a new request and check whether the destination connection appears in a client with connection logging enabled. If the browser appears in the log but another app doesn't, first check whether that app uses the system proxy. System proxy settings depend on app support; TUN receives traffic through a virtual network interface and routes, but is still subject to route scope and exclusions.
  • Rules: If a connection appears in the log but its domain doesn't match the expected rule, check whether the core sees a domain or only an IP address. Don't assume a domain rule can match when only the destination IP is available. Then check whether an earlier rule catches the request and where the fallback rule sends it.
  • Route: If the right policy group matches but the site still fails, check which node is actually selected in that group. A reachable health-check address for an automatic selection group does not mean the site itself is reachable. Check whether the request fails during DNS resolution, connection, or the app's response.

For everyday use, switch back to rule and test one site that should go direct and one that should use a specific policy group. Check the logs for two new connections to confirm both the matched rules and actual routes are as expected. If a site only works in global mode, find the failed routing path instead of leaving global mode on.

Download Clash