How to Update GeoIP and GeoSite Databases: Sources, File Locations, and Routing Rules

Learn what geoip.dat and geosite.dat do, where to update or replace them in v2rayN and v2rayNG, how to write geosite and geoip prefix rules, and how to troubleshoot routing.

At a Glance

For routine maintenance, use the Geo update option built into your client. Before replacing files manually, confirm which files the active core reads and which tags your current routing rules reference. After the update, restart the connection, check the startup logs, then test rule matching with a domain and an IP address.

What GeoIP and GeoSite Match

geoip.dat contains IP range groups used by geoip: rules, while geosite.dat contains domain groups used by geosite: rules. These databases provide matching criteria; they don't determine where traffic goes. The outbound specified by the matching routing rule decides whether traffic is sent direct or through a proxy.

2
data files: an IP database and a domain database
3
sample rules below: domain, IP, and fallback
443
HTTPS default destination port, not a routing condition

Test with Both Types of Requests

For verification, visit a domain known to belong to the target group and send a request to an IP known to be in the target range. Testing only one URL in a browser can't tell you whether GeoSite matched first or the resolved IP matched GeoIP.

Where to Get Dat Files: Built-In Updates or Manual Replacement

A rule database must meet two requirements: the active core must be able to read the file, and the file must contain the groups referenced by your current rules. Identical filenames don't guarantee identical tag lists. For example, a replacement database may include cn but omit an extended category your rules use.

Update from the Client

Recommended

The client downloads the files using its current settings and writes them to the Geo assets directory, so you don't have to locate the target folder yourself. If you changed the update URL, first confirm that the configured source is still the one you intend to use.

Best for: updating everyday routing data without custom categories

Get Dat Files from the Maintainer

For the IP database, see V2Fly's geoip project. For the domain database, see V2Fly's domain-list-community project, whose build output is commonly named dlc.dat. If you have a compatible domain database, rename it to geosite.dat for the client's default loading behavior. Release notes can help you confirm group names, but a source archive or plain-text list won't become a dat file just by changing its extension.

Best for: using a fixed rule source, replacing files offline, or restoring a previous database

When switching maintainers, note the geosite: and geoip: entries currently in use. Check each one against the groups documented by the new source. Don't verify only the common cn group; also check the extended tags used by your custom routing templates.

Update Options and File Locations in v2rayN and v2rayNG

  1. Check the Active Routing Rules

    First, note the active routing profile and the Geo tags it references. Updating Geo assets and updating a subscription are separate tasks: a successful subscription update confirms only that the server list was refreshed, not that the rule database was replaced.

  2. Update from the Desktop Client

    In the v2rayN main window, open “Check for updates” and select the update option for “Geo files.” In the English interface, look for Geo files. Wait for the update to finish and check the main window log. If it reports a download timeout or write failure, address that first, then verify that the files were updated.

  3. Update from the Android Client

    Open the top-left menu in v2rayNG and select “Geo assets.” Use the download or update option on that page to refresh the files. Disconnect first, then return to the main screen and reconnect after the update. Depending on the interface language or version, the action may appear as a toolbar icon.

  4. Replace Files Manually on Desktop

    Exit v2rayN first. In common 7.x desktop layouts, these files are under bin/ in the program directory or the active data directory. Locate the current instance's bin/geoip.dat and bin/geosite.dat, copy them to a backup folder, then put the new files in their place using the same filenames. If an upgrade left multiple program directories behind, don't overwrite files in an old instance.

  5. Import Files Manually on Android

    Save the dat file somewhere accessible through the system file picker, such as Downloads, then use the local import option on v2rayNG's “Geo assets” page. A common external assets directory is Android/data/com.v2ray.ang/files/assets/; it's not the public Downloads folder and may be restricted by the system. If the app offers an import option, use it instead of writing directly to the app directory.

  6. Restart the Connection and Verify

    Restart the desktop client or reconnect on Android. Check that the core starts successfully, then repeat the same domain and IP tests. If a manual update causes a loading error, restore the backup first, then check the file format, location, and tags.

Writing Routing Rules: Domains, IPs, and the Final Fallback

When editing the active routing profile under “Settings” → “Routing settings” in v2rayN, use geosite:cn for the domain condition and geoip:private for the IP condition. If each is a separate condition for direct connections, put them in separate rules. Don't combine them just to save a line: in Xray field-based rules, different match fields must all match; they aren't alternatives.

This is an example of the routing object in an Xray configuration, not a complete configuration. direct and proxy must match the actual tags of existing outbounds. If you're editing a client form, fill in the corresponding fields instead of pasting the whole JSON into the domain field.

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

Common Errors and Routing Issues After an Update

Core Says a Dat File Is Missing After Replacement?

Check the startup log to see whether geoip.dat or geosite.dat is missing. Make sure you replaced the file in the active instance, check for an extra nested folder from extracting an archive, and confirm the full filename doesn't end with an extra .txt or .dat. After correcting it, restart the client; don't just check whether a file exists in Downloads.

The File Is There, So Why Is a Group Missing?

Find the exact tag name in the log and check whether it belongs to the domain or IP database. Restore the original database or remove the invalid reference first so the core can start again. Then check whether the new source has an equivalent group. If you're unsure what a group means, express the rule using a specific domain or IP range instead.

The Update Succeeded, So Why Is This Site Still Using the Same Outbound?

First, check which routing profile the current connection uses, then look for an earlier rule that may already match. Close the existing test connection and try again; it may still be using the outbound selected when it was established. If access logs are available, compare the request's destination domain or IP with the outbound tag. Don't judge routing only by whether the page loads.

Why Do the Same Rules Behave Differently on Desktop and Mobile?

Compare the dat sources and active routing profiles on both devices first; comparing subscription URLs alone isn't enough. Then confirm that test traffic actually passes through each client: on desktop, check whether the app uses the system proxy or is captured by TUN; on Android, check whether the app is included in VPN routing. Finally, compare the destination addresses in the logs; DNS may return different results on each device.

v2rayN ClientFind download options for your platform