geoip.dat and geosite.dat: What They Do, How to Update Them, and How to Use Them

Learn where geoip.dat and geosite.dat come from, how to update them in v2rayN and v2rayNG, how to reference geosite categories and geoip country codes, and how to verify routing after an update.

At a glance

This guide is for users who have imported nodes and want to check their routing rules. First, understand the difference between domain categories and IP databases. Then update the data files used by your client and verify the results with a minimal routing example and logs. Check file downloads, category loading, and traffic routing separately to avoid repeated updates that do not fix misrouted traffic.

What Each Database Matches

geosite.dat stores domain entries organized by labels; geoip.dat stores IP address ranges organized by labels. These are binary data files read by the core—not JSON to paste into a routing editor, and they do not contain subscription links, node passwords, or transport settings.

2 files
DAT resources covered here
2 match types
Domain categories and IP address ranges
3 outbounds
Examples use direct, proxy, and block

For example, geosite:cn looks up the cn category in the domain database, while geoip:cn looks up the cn ranges in the IP database. These are separate lists: a domain's category does not mean every address it resolves to is in the same region. This distinction is especially common with sites using overseas CDNs.

ResourceMatchesTypical referenceLimitations
geosite.datThe domain in the request or identified by the coregeosite:cnDepends on category coverage; it is not a live DNS lookup
geoip.datDestination IP addressgeoip:cnClassifies IP address ranges; it does not identify the service operator
geoip.datPrivate or reserved address ranges defined by the data sourcegeoip:privateThe exact ranges depend on the labels in the data source

Requests made directly to an IP address cannot match a domain category. Whether a domain request can also be matched against an IP range depends on the routing domain strategy and DNS resolution. So updating geosite does not mean every app will route by domain; check what destination information the client actually receives.

Choosing a Data Source and Update Method

Common data sources include community-maintained domain lists and IP range projects, compiled into DAT files by a build process. Domain entries can use different forms, including full domains, suffix matches, keywords, and regular expressions; IP databases group CIDR ranges by label. Xray and V2Ray ecosystem files follow specific format conventions, but files with the same name from different sources do not necessarily contain the same labels.

The client app, core, rule data, and routing rules are four separate layers. Updating v2rayN does not necessarily update the Geo files currently in use, and updating Geo files does not reorder custom rules. Before switching data sources, note the labels your rules reference, such as cn, private, and service categories, and confirm the new source includes them.

Update Through the Client

Recommended

The client downloads files from its configured resource URLs and saves them to a location it manages. This helps avoid placing new files in an outdated directory, and the update log makes it easier to identify failures.

Best for: routine maintenance, keeping the default data source, and initial troubleshooting.

Import or Replace Files Manually

First confirm where the active core reads its resources, then use files from a trusted source. On Android, use the import feature provided by the client rather than guessing the app's private directory.

Best for: offline updates, unreachable built-in downloads, or pinning a specific data version.

Switch to a Custom Source

Check the download URL, file format, and category list together. Do not replace a file just because it is larger: extra categories may not help, while missing a referenced category may prevent the core from starting.

Best for: users who depend on a specific service category and can maintain their rule references.

Bottom line: Keep the source consistent, then update the data

Back up your current resources and routing configuration. Update and verify the data from the same source first. Switch sources only if a required label is missing; do not change the source, DNS, and rule order all at once while troubleshooting.

Update and Reload Geo Data in v2rayN

On desktop, first confirm that the active connection uses Xray or V2Ray DAT routing rules. The examples here do not apply to other rule-set formats. Menus vary between v2rayN versions; the update option is commonly under “Check for updates,” listed as “Geo files” or “Update Geo files.” If your version puts it on a resource management page, follow the current menu labels and logs. “Update subscriptions” does not update rule data.

  1. Record Current Settings

    Open “Settings” → “Routing settings” and note the active routing profile, rule order, and categories in use. Back up any custom configuration separately. In some versions, saving a profile is not enough—you must also select it in the main window to activate it.

  2. Update Rule Data

    In the main window, open “Check for updates” → “Geo files” and run the update. Check the results for both geoip.dat and geosite.dat; do not close the log just because the first item succeeded.

  3. Check the Download Results

    If the connection fails, first check the resource URL and whether the update needs to go through your current proxy. If the response cannot be parsed, make sure you entered a direct file URL rather than a web page URL; a filename alone does not mean the response contains DAT data.

  4. Restart the Active Service

    After writing the data files, restart the active connection so the core reloads them. Switching tabs in the main window does not reload resources, and existing long-lived connections do not show how new rules will behave.

  5. Check the Startup Log

    Make sure there are no errors opening resources, missing categories, or building routes. Then send a new test request. If the client automatically restores an older configuration, confirm that the profile actually running is the one you just saved.

Where to Update Geo Resources in v2rayNG

On Android, v2rayNG uses the Xray core and usually manages Geo data within the app. Versions with a dedicated resource manager let you open “Geo resource files” from the side menu to update or import files. Older versions may have “Update Geo files” in the top-right menu on the main screen. If the menus differ, look for Geo resource options rather than checking subscription groups.

If updates must go through a proxy, make sure an existing connection can reach the resource server. If the proxy cannot start because resources failed to load, use a download source accessible on your current network or import files offline. Do not confuse a download path that depends on the proxy with routing rules that depend on the data, and retry both blindly.

How to Reference geosite and geoip

In Xray routing JSON, put geosite: references in the domain array and geoip: references in the ip array. Category names are not arbitrary descriptions; they must exist in the current data file. In geoip:cn, cn is a commonly used country-code label. private is a special label defined by the dataset, not a country code.

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

This is a routing-rule example, not a complete configuration that can run on its own. It assumes the full configuration already defines direct and proxy outbounds. To block traffic, define and reference block separately. These labels are just names and must match actual entries in outbounds; copying them will not create outbounds automatically. In a graphical rule editor, enter only the relevant match fields rather than pasting the entire JSON.

To specify a different file, Xray supports external resource references such as ext:custom-site.dat:cn. The file must be in a location the core can access and must contain the requested category. For typical use, stick with the default filenames; external file references are not needed just to update the data.

Verify Updates and Troubleshoot Problems

Verify in this order: resources loaded → rules matched → traffic reached the expected outbound. Checking whether a website opens is not enough: both proxy and direct connections may work, and cached pages can hide routing changes. Record results before and after the update, keeping the node, DNS, and test destinations unchanged.

SymptomCheck firstWhat to do
Core fails to startResource path, file contents, category namesCheck filenames and labels in the startup log; restore the previous resources and fix items one at a time
Update succeeds, but behavior is unchangedActive configuration, service restart, existing long-lived connectionsRestart the connection service and use a new request to check the actual outbound
Domain rule does not matchWhether the destination domain is visible, category coverage, earlier rulesTemporarily add an exact-domain rule to distinguish missing data from missing request details
IP rule does not matchActual destination IP, domain strategy, DNS resultCheck the destination IP in the logs and whether the domain needs to be resolved before matching
A local network service is proxiedPrivate IP rules, rule order, local domain namesCheck the specific destination first, then add an explicit direct rule

In a test environment you control, request the service at 192.168.1.10:8080 to check direct access to a local network address. This address and port are examples only; replace them with a real service on your network. Then choose one site that is definitely included in a category in the current domain database and another that should use the proxy. Check the destination and outbound labels in the access logs for each. If access logging is disabled, temporarily enable an appropriate log level, then turn it off after testing to avoid keeping unnecessary access records.

Bottom line: Isolate the problem with one rule

Temporarily add a top-priority exact-domain rule for a misrouted domain. If the outbound changes, investigate category coverage and rule priority. If it does not, first confirm that traffic is reaching this client, the correct configuration is running, and the core has access to the domain name.

Once routing is stable, remove the temporary test rule and record the data source, update date, and available categories. Geo data benefits from periodic maintenance, but it does not need updating every time a connection fails. Authentication errors, unreachable servers, and mismatched transport settings usually call for checking the node or protocol settings, not changing geographic categories.

Download v2rayN / v2rayNG