Check which data your rules use

In mihomo, GEOSITE matches connections by domain, while GEOIP matches them by destination IP address. They answer different questions: which list a domain belongs to, and which IP range its current DNS lookup returns. These don't always align—especially for sites behind a CDN.

mihomo Geolocation Rules and Data Files
RuleCommon filesHow to check
GEOSITE,cn,DIRECTGeoSite.datConfirm that the data source includes the cn category.
GEOIP,CN,DIRECTGeoIP.datThe active configuration uses geodata-mode: true.
GEOIP,CN,DIRECTCountry.mmdbThe active configuration uses geodata-mode: false.

The configuration keys in this table are for mihomo and may not apply to every client called Clash or to older cores. First check which core the client is actually running, then inspect the active configuration. If your rules use RULE-SET, check the corresponding entry under rule-providers for its URL, update interval, and behavior. Updating geolocation databases won't refresh rule sets, even if their names contain geoip or geosite.

Automatic updates: Make sure the settings reach the core

Look in your desktop client's settings for “Geodata,” “GeoData,” or a similar option. Some clients offer an update-now button; others only let you override configuration values. Menus vary by client and release, so instead of relying on a particular menu path, check the core name, active configuration, and update logs. Refreshing a subscription and refreshing geodata are separate actions: the former fetches the configuration again; the latter updates the data used by rules.

If your version of mihomo supports these fields, add the following two options at the top level of the active configuration. They belong alongside rules, not inside the rules list:

geo-auto-update: true
geo-update-interval: 24

24 is measured in hours. This setting controls the core's update schedule; it doesn't mean downloads will continue on a timer after the desktop app fully exits, nor does it guarantee an immediate download after applying the configuration. If the client has an update-now option, use it first, then check the logs to see whether the download failed, the file couldn't be read, or it loaded successfully. For clients that generate configuration automatically, use their supported override feature. Direct edits to a cached remote subscription may be overwritten the next time it refreshes.

Custom download URLs: Match the file format and categories

mihomo uses the top-level geox-url map to specify geodata URLs. The geoip subkey is for IP data in DAT format, mmdb is for IP data in MMDB format, and geosite is for domain categories. Add a URL only for the items you want to change, and use a direct HTTPS link to a file published by its maintainer. Don't use a repository homepage, release notes page, or download page that requires sign-in.

  • Format: If you're using MMDB, changing the geoip URL won't update the MMDB used by your current rules. Changing a DAT file's extension doesn't convert it to MMDB.
  • Categories: Files from different maintainers can share a name but contain different categories. Before switching sources, compare the categories referenced in your active configuration one by one—especially GeoSite entries that combine regions or serve a custom purpose.
  • Reachability: A successful browser download only shows that the browser's connection path works. The core may use a different path when it updates in the background. If the logs show a timeout or DNS resolution error, first check the process's connection to the download host; then consider changing sources.

Manual replacement: Use the running core's data directory

A desktop client's installation folder, subscription storage folder, and core data directory may all be different. Don't overwrite files using someone else's user path. Use the client's “Open data directory” option if available, or check the core's startup arguments to find its working directory. If you launch it from the command line, also check whether -d was specified explicitly. If two clients are installed on the same computer, only change the data used by the one that's actually running.

  1. Note the data mode, original download source, and filename to replace from the active configuration. Get a file in the right format from a trusted maintainer. If the release is an archive, extract it and confirm that the contents include the data file.
  2. Stop the core. Closing the settings window doesn't necessarily exit the app; some clients keep running in the system tray, and service mode may continue to manage the core. Once the process has stopped, back up the old file in a separate directory.
  3. Put the new file in the actual data directory, keeping the filename and letter case expected by the core. Replace only the file that's causing the problem; don't change subscriptions, rule order, or the core at the same time.
  4. Restart and check the logs for read errors, parsing errors, or missing categories, then start a new connection. If the core can't load the configuration, stop it and restore the old file. Also check whether automatic updates still point to a URL that serves an incompatible file.

Still misrouted after an update? Check the rule that actually matched

A changed file timestamp only shows that the file was written; it doesn't prove the running core loaded it. To verify, switch to rule mode and note the active configuration and test time. Close the old connection, then use the same app to visit the same domain and check the connection page for the destination domain or IP, matched rule, and final outbound. Existing connections may retain their previous routing, so they aren't suitable for comparing results before and after an update.

Check earlier rules before checking categories

Rules are generally evaluated from top to bottom. If an earlier domain rule, rule set, or fallback rule matches, a later geolocation rule won't determine the outbound. If the connection page confirms that the intended geolocation rule matched but traffic still takes an unexpected route, check which policy group the rule points to and which option is currently selected in that group. A wrong policy choice and outdated category data are separate issues.

Distinguish a missing domain from a changed IP

If a connection record shows only an IP, first check whether the core obtained a domain that it can use for matching. Updating GeoSite alone won't add a domain to every IP connection. When checking GeoIP, note the address used by that request, including whether it was IPv4 or IPv6. An IP rule with no-resolve won't proactively resolve a domain that hasn't been resolved for that match, so check whether a destination IP is available instead of only checking whether the database contains a particular region.

If the same domain resolves to different addresses across requests, compare the old and new data using the same actual destination address first. Attribute a category change to the data update only if the rule order, policy group, and matching input are all the same. If the issue affects just one fixed domain, add a more specific domain rule ahead of broad category rules, then verify the match with a new connection.