How to Update geoip.dat and geosite.dat: Routing Database Setup in V2Ray Clients

Learn what GeoIP and GeoSite databases match, how to update them in V2Ray clients, and how to use common routing rules such as geosite:cn and geoip:private.

At a Glance

For readers who have imported a server and are ready to configure direct and proxy routing. Update the data files through the client, then confirm that your active routing rules reference the relevant groups. Test a domain, a private IP, and a request that matches no rule to determine whether a file failed to load, a rule failed to match, or traffic never reached the core.

What GeoIP and GeoSite Match

geoip.dat contains IP ranges organized by tags, while geosite.dat contains domain match entries organized by tags. These files provide rule data; they do not decide which outbound route traffic uses. Entries in the databases affect routing only when an active rule references the corresponding tag and specifies an outbound.

Common groups, what they match, and when to use them
Rule valueWhat it matchesCommon misconception
geosite:cnDomain entries included in the cn group in the domain databaseThis does not include every domain ending in .cn; it may also include domains with other suffixes.
geoip:cnIP ranges classified under the cn group in the IP databaseThis matches IP addresses, not domain ownership. Whether a domain request is evaluated against IP rules also depends on the address the core receives and the DNS strategy in use.
geoip:privateIP ranges classified under the private group in the IP databaseOften used to send destinations such as local network devices directly, but it will not match based only on a device's local network hostname.

Do not confuse subscription updates with routing database updates. A subscription update refreshes the server list; a Geo file update refreshes match data; changing outbounds or rule order modifies routing configuration. For example, after updating the database, the same geosite:cn rule may match more domains, but it still uses the outbound originally assigned to it.

Update Geo Data in v2rayN and v2rayNG

When the client provides a built-in update option, use it first. Menu names can vary slightly by version or interface language. The desktop steps below use the v2rayN 7 series main window; on Android, start from the v2rayNG sidebar.

  1. Note Your Routing Setup

    In v2rayN, open “Settings” → “Routing Settings” and note which profile is active. Check whether the rule list uses geosite: or geoip:. If you plan to edit rules as well, back up the current configuration first so you can roll back database updates and rule changes separately.

  2. Update the Desktop Data

    In the v2rayN main window, open “Check for Updates” and select the Geo file update option. Wait for the result and confirm that both resources updated successfully; the progress window closing is not enough. If the list shows only application or core updates, do not mistake those for database updates.

  3. Update the Android Data

    In v2rayNG, open the top-left menu → “Geo Files” and use the update option on that page. Update both resources using the available method and check the result for each. A successful desktop update does not sync to your phone; seeing the same rule tags on both devices does not mean their database contents match.

  4. Reload and Check

    If the connection is still active after updating, disconnect and reconnect. On desktop, you can also close and reopen the client, then re-enable the same profile. Check the startup logs: a missing file and a missing tag are different problems. For a missing file, check its location and read permissions; for a missing tag, check whether the active database contains that group.

Built-In Client Updates

Recommended

Uses the data source and file locations configured by the client. Retest with the existing routing profile after updating to keep the number of changed variables to a minimum.

Best for: routine maintenance and standard rule groups

Import or Replace Files Manually

Use this only when you need a specific group or built-in updates keep failing. On Android, use the import option provided by the app whenever possible. On desktop, first confirm where the running core reads its resources from. Stop the core, back up the original files, and replace them using the original filenames. Do not rename a different data file and assume it is a compatible version.

Best for: offline maintenance and custom groups as needed

Check the First Error Before Replacing the Database

If the log says a group does not exist, first check that the tag in the error matches the rule exactly. If the tag is correct, restore an older file that includes the group or edit the rule. Repeatedly updating the same data source will not add groups it never contained.

Route Private IPs and Domains Directly, with a Proxy Fallback

The following is a snippet of Xray's routing field, not a complete, standalone configuration. It assumes your existing outbound tags are direct and proxy; use the tags from your own configuration. If you use the client's graphical interface, add the matching conditions and outbounds one rule at a time in the routing editor. Do not paste this JSON into the subscription URL field.

{
  "routing": {
    "domainStrategy": "AsIs",
    "rules": [
      {
        "type": "field",
        "ip": ["geoip:private"],
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "domain": ["geosite:cn"],
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "network": "tcp,udp",
        "outboundTag": "proxy"
      }
    ]
  }
}

Verify Routing with Three Requests

The IP ranges and sample ports below are common examples for testing, not measurements of database coverage or speed. Before testing a webpage, confirm that the app making the request actually sends traffic through the client. In particular, system proxy bypass lists may let local network addresses through directly. A page loading when the core received no connection does not prove that geoip:private matched.

10.0.0.0/8
Common Private IPv4 Ranges
192.168.0.0/16
Ranges commonly used on home networks
10808
Example local proxy ports; check your current settings
  1. Test a private IP: Choose a local network device you are authorized to access and send a request to its actual IP address. If your test tool supports manual proxy settings, set the proxy type and port to v2rayN's current local inbound, and disable local network bypass for that test. The expected outbound is direct.
  2. Test a domain group: Choose a domain known to be in the cn group in your current data source, then make a new request using the domain name rather than entering its IP address. The expected outbound is direct. If the logs show only an IP, check whether the app resolved the name locally and whether the active inbound passes the domain name to the core.
  3. Test the fallback: Make a new connection to a test destination that is clearly outside the groups above. The expected outbound is proxy. Test one destination per run. If the logs show outbound tags, match them by request time; do not mistake other domains loaded in the background for your test destination.

Troubleshooting Geo Updates and Routing

The update is stuck. Can I keep using the old rules?

First, check whether the error is a connection timeout or a write failure. For timeouts, check whether your current network can reach the resource source configured in the client. For write failures, check available storage and permissions on the resource directory. Keep any working old files. If only one file was replaced, restore both from your backup, reload, and retest the original routing setup.

I added geosite:cn. Why is a site still going through the proxy?

Check the active routing profile, rule order, and the exact domain used for the request. A site's main page, login endpoint, and static assets may use different domains. If only one specific domain needs a direct route, add an exact match for it before the fallback and test again; there is no need to replace the entire database.

My computer updated the files. Can I copy its configuration straight to Android?

You can carry over the intent of the rules, but do not use the entire configuration generated on desktop as an Android configuration. First update the Geo files on the device in v2rayNG, then check the tags in use, rule order, and which app traffic is covered. If per-app proxy selection is enabled, make sure the app you are testing is included.

Private IPs connect directly, but why can't I reach the device by name?

Test the IP address and device name in the same app. If only the name fails, check whether it resolves on your current network. If it resolves but uses the wrong outbound, add a separate direct routing rule for that name. Changing the outbound will not make a name that fails to resolve work.

Download V2Ray Clients