2026-08-06 · Routing · About 10 min read

How to Update geoip.dat and geosite.dat: A v2rayN Routing Rules Guide

Learn what geoip.dat and geosite.dat contain, how to update them in v2rayN, and how to use and order common routing rules such as geosite:cn and geoip:private.

At a glance

For v2rayN users who have imported a subscription but aren't getting the expected split between direct and proxied traffic. First, understand the difference between domain and IP databases. Then update the Geo files in the client, check where the active core reads them from, and verify rule order and logs. Updating the databases does not update your subscription or reorder routing rules. The JSON examples show routing concepts for Xray and V2Fly; they are not complete client configurations you can import as-is.

Two .dat files: one matches domains, the other IP addresses

geosite.dat contains domain lists organized by region, purpose, or service. geoip.dat contains IP address ranges grouped by labels such as region. In routing rules, geosite:cn looks up a domain list, while geoip:cn looks up an IP list; they are not interchangeable. The databases define what each list contains, while routing rules decide which outbound connection handles a match.

FileRouting field and exampleRequirements
geosite.datdomain: ["geosite:cn"]The domain must be available during routing, and the database must include a cn category.
geoip.datip: ["geoip:cn"]The destination must be an IP address, or the core must resolve the domain according to its domain strategy before matching against IP rules.
geoip.datip: ["geoip:private"]The database must provide a private category for private and other special-purpose address ranges. Check the data source for its exact coverage.

For example, when a browser passes a domain to the local proxy, a domain rule can match it directly. If an app passes only a destination IP to the proxy, the domain database may never come into play. Sniffing can provide domain information for supported traffic, but it cannot recover the original domain for every connection. Updating geosite alone won't help if an app never provides a domain.

Update in v2rayN: back up first, then check the update log

Use the Geo update option built into the client whenever possible. In many desktop versions, the path is “Check for Updates” → “Update Geo Files”; some interfaces shorten this to “Geo Files.” Menu locations and labels can vary by version and interface, so look for a Geo option in the update menu—not “Update Subscription” or an app update option.

  1. Keep your current configuration

    Note the active core, routing preset, and Geo data source first. If you need a local copy of the configuration, close the client before copying its actual configuration directory. Don't treat files that are still being written as a reliable backup.

  2. Update the databases

    Choose “Check for Updates” → “Update Geo Files” and wait for the task to finish. Check the output for updates to both geoip.dat and geosite.dat; don't close the window just because the download progress has stopped.

  3. Verify the update

    Check the log for success or failure, then check the modification time and size of the files in the actual data directory. A file's presence doesn't mean its contents are usable, and a changed timestamp doesn't mean the core has reloaded it.

  4. Reload the core

    Restart the active core through the client, or fully quit and reopen the client. Then check the startup log for file read errors, missing categories, or routing configuration errors.

  5. Test routing

    Test one site that should connect directly, one that should use the proxy, and a LAN service you actually use. Keep the same node, routing preset, and proxy mode so you don't change multiple variables at once.

If the update times out, first confirm that your current network can reach the data source configured in the client. If the interface offers a download-through-proxy option, select a node you've verified works and try again. If there is no such option, don't assume that enabling the system proxy will fix it; whether update requests use the system proxy depends on the client. Check whether the error is a connection timeout, a permissions issue, or a data loading failure before deciding what to try next.

Choosing an update method: use the built-in updater first; replace files manually for troubleshooting

Built-in client updater

Recommended

v2rayN downloads and saves the files using its current settings, reducing the risk of using the wrong directory or filename. You still need to restart the core and confirm that the active rules reference these categories.

Best for: routine maintenance when the configured data source is reachable.

Replace files manually

Use only data files from a known source that match the active core's format. Stop the core first, keep a copy of the original files, and replace the files with the same names in the directory the core actually reads. Restore the originals if loading fails.

Best for: troubleshooting a failed built-in download, locating the data directory, or checking data compatibility.

Don't guess the file location based on a fixed directory in a tutorial. The installation method, operating system, and client version can all affect where resources are stored. Confirm the path the core reads by checking the client settings, startup logs, and actual file locations. Finding a .dat file next to the main program doesn't mean the running core is using it.

Routing rules and order: specific matches first, catch-all last

Common field-based routing rules in Xray and V2Fly are evaluated in order; the first match determines the outbound connection. Put a rule covering all TCP and UDP traffic at the top, and later rules for direct connections to destinations in mainland China may never take effect. The five-rule example below prioritizes private addresses, sends domains in mainland China direct, then does the same for IPs in mainland China, with proxy as the final fallback.

2 files
The .dat database files covered here
5 rules
Sequential rules in the example below
2 protocols
Fallback covers TCP and UDP
{
  "routing": {
    "domainStrategy": "IPIfNonMatch",
    "rules": [
      {
        "type": "field",
        "ip": ["geoip:private"],
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "domain": ["domain:localhost"],
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "domain": ["geosite:cn"],
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "ip": ["geoip:cn"],
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "network": "tcp,udp",
        "outboundTag": "proxy"
      }
    ]
  }
}

Here, direct and proxy are example outbound tags, not keywords automatically created by the core. A complete configuration must define outbounds with those exact names. Client-generated tags may differ, so use the ones in your active configuration. Don't paste the entire JSON into a field that accepts only a single rule, or overwrite v2rayN's generated runtime configuration; it may be regenerated the next time the client starts.

DNS and rule databases: updated files don't always change the result

domainStrategy determines how domains are handled during routing; it is not a complete DNS configuration. AsIs does not actively resolve domains for IP-based routing matches. IPIfNonMatch attempts resolution when no domain rule matches, then continues evaluating rules. IPOnDemand resolves a domain when an IP is needed during matching. The latter two involve trade-offs around resolvers, network access, and privacy, so don't choose based only on whether sites in mainland China connect directly.

When deciding whether a site should connect directly, don't use the IP's region as the sole indicator of where the site belongs. Content delivery networks can resolve the same domain to different addresses on different networks, and databases have their own update cycles. For sites with specific requirements, a more precise domain rule is usually easier to maintain than repeatedly adjusting regional rules.

  1. First, check whether the connection enters the core as a domain or an IP address, and confirm that the app is actually using the proxy.
  2. Next, check the destination and outbound tag in the routing logs. Temporarily increase the log detail if needed, then restore the original level when you're done.
  3. Finally, check DNS resolution and database categories. Don't rely only on the browser's displayed exit IP to judge every resource request.

Still not working after an update? Troubleshoot by error type

The update succeeded. Why are sites in mainland China still using the proxy?

First check which routing preset is active, then look for a broad “proxy everything” rule placed ahead of the direct rules. Confirm that the current mode allows split routing, check whether the destination domain reaches the core, and inspect the outbound tag in the logs. Updating the databases does not switch your routing preset.

The log says a geosite category doesn't exist. Should I switch nodes?

Don't switch nodes yet. Note the category named in the error, then check whether the active data source provides it and whether the core is reading the newly updated file. Restore the old file or remove references to unsupported categories, reload the configuration, and test the connection again.

Added geoip:private, but LAN devices are still unreachable?

First make sure the rule appears before the proxy fallback, then confirm that the client is handling the connection. If you're accessing your router's admin page, test its actual IP address to distinguish a DNS failure from an IP connection failure. Then check TUN routing, LAN access permissions, and the device firewall.

The core won't start after an update. Can I roll back just the databases?

Stop the core, restore the two files that worked before, and restart it. If the error persists, check whether you also changed routing or the core type recently. Roll back the database, routing, and core separately to identify which change caused the problem.

Update as needed; there's no need to do it before every connection. Refresh the data when changing sources, finding a missing category, or troubleshooting unexpected routing. Subscription updates manage node details, Geo updates manage rule lists, and routing edits control where traffic goes. Keeping these separate makes troubleshooting more useful. To check routing fields, see the routing configuration reference. If the connection itself fails, start with connection troubleshooting to verify the basic connection.

Choose a client and platform

Choose the v2rayN installer for your operating system, then import a subscription and verify the basic connection. Confirm that the connection works before changing routing or databases; this also makes problems easier to roll back.

Download v2rayN