GeoIP and GeoSite Database Update Guide: Check These Two Files When Routing Rules Fail

Outdated geoip.dat and geosite.dat files can misclassify domains and IPs, causing routing rules to fail. Learn what each file does, how to update them in your client, and how to verify the result.

A node can connect normally while a site that should go direct suddenly uses the proxy, or a domain fails to match the expected rule. The cause may not be the subscription, VMess, VLESS, or the node itself. Whenever routing rules reference geoip: or geosite:, the actual match depends on the data files loaded locally.

Quick overview

This guide is for users running v2rayN, v2rayNG, or v2flyNG with domain- and IP-based routing enabled. It focuses on separating the roles of the two databases, updating or replacing them in the client, and confirming through logs, rule order, and test domains that the current core has loaded the new data.

First, identify what geoip.dat and geosite.dat match

geosite.dat stores domain-category collections. Entries such as geosite:cn and geosite:category-ads-all do not query a live online service; they instruct the core to read category entries from the local file. If a domain is added, moved, or repurposed while local data remains outdated, it may still be assigned to an old category.

geoip.dat stores IP address-range categories. A rule such as geoip:cn compares the destination IP with address ranges in the database. If a site changes its resolved address, a cloud provider reallocates ranges, or new ranges are missing from the old database, IP rules may fail to match.

Application sends a request Read destination details Match domain rules Match IP rules Select outbound

GeoSite domain categories

File
geosite.dat
Match target
Full domains and domain sets
Common syntax
geosite:cn
Typical use
Direct domain access and category blocking

When the domain is available, GeoSite rules usually take part in the decision first.

GeoIP address categories

File
geoip.dat
Match target
IPv4 and IPv6 address ranges
Common syntax
geoip:cn
Typical use
Direct or proxied destination

Whether an IP rule is triggered also depends on the domainStrategy setting.

Determine whether outdated databases are causing routing anomalies

Do not replace the files after seeing a single incorrect route. First confirm that the core is running normally, then rule out incorrect rule order, DNS results, and outbound tags. Routing systems generally evaluate rules in order; a broad rule near the top may capture the traffic before geosite:cn or geoip:cn ever gets a chance to run.

2
Core data files
10808
Common SOCKS listening port
10809
Common HTTP listening port
3 rounds
Verification runs before and after the update

10808 and 10809 are common v2rayN defaults, not fixed values for every installation. Confirm the actual ports under Settings → Parameters; when testing a browser proxy, the port must match the current local inbound. A wrong port causes complete connection failure, not a Geo data misclassification.

  1. Check the nodes: Test two working nodes one at a time. If every node connects but the same group of domains consistently uses the wrong outbound, the routing data or rule configuration is more likely to be at fault.
  2. Check rule order: Review exact-domain, GeoSite, GeoIP, and final fallback rules from top to bottom. The final fallback must come after the category rules.
  3. Check the logs: Open the runtime log in v2rayN and revisit a test domain to see which outboundTag was selected. If the log level is too low, temporarily raise it under Settings → Parameters, then restart the core.
  4. Check file dates: Locate the resource directory actually used by the current core and inspect the modification times of geoip.dat and geosite.dat. Do not check only copies in the download directory.
  5. Create a baseline: Before updating, record at least three test targets: one domain that should clearly go direct, one expected to use the proxy, and one request made directly to an IP address.

Conclusion: Prove that the rule runs before judging the database outdated

If the logs show that traffic matched a broader rule before reaching the Geo rule, updating the files will not change the result. Updating the database is useful only when rule order is correct and the target is still uncategorized.

Update GeoIP and GeoSite in v2rayN

Recent v2rayN versions usually provide a Geo file update entry in the top menu. First connect through a node that can reliably reach the update source, then open Check for Updates → Geo files. Some versions label it GeoIP/GeoSite update; the wording may differ, but the operation still updates the two data files in the current core directory.

Do not exit the client or manually overwrite files with the same names during the update. After the menu reports completion, use Restart Service or quit and relaunch v2rayN so the Xray or V2Ray core releases the old files and loads the new ones. Closing only the main window while leaving the client running in the background may not trigger a full reload.

Update in the client

Prerequisites
At least one working node
Menu path
Check for Updates → Geo files
Updated files
geoip.dat、geosite.dat
After completion
Restart the current core

Using the client’s built-in entry first reduces the chance of replacing files in the wrong directory.

Manual replacement

Step 1
Exit the client completely
Step 2
Back up both existing files
Step 3
Replace the files in the core resource directory
Step 4
Launch the client and inspect the logs

Keep the filenames unchanged, and make sure both files come from the same data release.

If the in-client update fails, you can replace the files manually. The important part is not putting them in the v2rayN root directory, but locating the resource directory used by the selected core. Directory layouts vary between v2rayN versions, desktop editions, and WPF editions; common installations contain bin subdirectories organized by core. The safest approach is to confirm the core executable path in the runtime log, then look for the two existing files with the same names in a nearby resource directory.

On Android, v2rayNG uses the Xray core, while v2flyNG uses the v2fly core. If the current version offers an Update Geo Files entry, run it when the network is available and restart the core. If no such entry exists, update the bundled resources with the client. For routing tests, open Settings → Routing Settings to confirm the active rule set; do not rely only on whether the subscription refreshed.

Check the routing syntax and domainStrategy

If updating the databases changes nothing, check whether the configuration references them correctly. GeoSite entries belong in the rule’s domain array, while GeoIP entries belong in ip; they are not interchangeable. Each rule must also point to an existing outboundTag, otherwise the core may report an error or fail to select the expected outbound.

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

The order above checks domains first, then IPs, and finally sends all remaining TCP and UDP traffic to proxy. The direct and proxy values must exactly match the tags in outbounds, including capitalization. If the configuration actually uses direct-out, the routing rule must use that same name.

  • AsIs: Prefer matching the original domain in the request and do not resolve it proactively for IP rules. When the destination is supplied as a domain, later GeoIP rules may not participate.
  • IPIfNonMatch: Resolve the destination address when no domain rule matches, then try the IP rules. This suits common routing setups that use both GeoSite and GeoIP.
  • IPOnDemand: Resolution may be triggered earlier when a rule needs an IP address. This changes when DNS queries occur, so verify that the DNS configuration matches your expectations before enabling it.

If a program connects directly to an IP address, GeoSite cannot infer the original domain from that address, so the decision mainly depends on GeoIP. Conversely, remote DNS, built-in DNS, or special forwarding can change what the core sees. Therefore, different routing results for the same site in a browser and a command-line tool do not necessarily indicate a damaged database.

Read routing Check rule order Confirm strategy value Match the outbound tag Restart the core

Verify the update with logs and comparison requests

Do not verify only by checking whether a webpage opens, because both direct and proxied connections can succeed. Confirm that the updated target matches the expected rule, selects the expected outbound, and produces the same result after a restart. Before each test, clear browser connections or wait for existing connections to close so connection reuse does not skew the result.

  1. Record the current state: Note the modification times of both data files, the current core type, and the name of the active routing configuration.
  2. Restart the core: In v2rayN, use Restart Service; on Android, stop the current connection and start it again.
  3. Send requests one at a time: Test a domain that should clearly match GeoSite, then an IP address you can enter directly, and finally a target that should use the fallback proxy.
  4. Read the logs: Check the destination address, matched rule, and final outbound tag—not just whether the connection was established.
  5. Repeat for three rounds: Reconnect at intervals to confirm the result is not an accidental effect of DNS caching or a persistent connection.

The Geo files were updated, so why did routing not change?

Fully restart the core first, then check the outboundTag in the logs. If the request matched a broad domain, IP, or network rule earlier in the list, change the rule order instead of repeatedly downloading the files.

The subscription was just updated. Do I still need to update GeoIP separately?

Treat them as separate updates. A subscription usually provides node and group information, while Geo data is a core routing resource. Open Check for Updates → Geo files to update it separately, then restart the service.

What should I do if manual replacement says a geosite category cannot be found?

Confirm that the filename is still geosite.dat and that you replaced the file in the directory actually read by the current core. Then check whether the category name in the rule exists. Restoring the backup can quickly show whether the problem is the file or the rule name.

Domain rules match, but GeoIP rules never do. Why?

Check routing.domainStrategy. With AsIs, a domain destination is not automatically resolved for a later IP rule. Depending on your configuration goals, consider switching to IPIfNonMatch and review the DNS settings as well.

What should I do when an update times out?

First confirm that the current node works, then retry the client’s update entry. If it still fails, keep the original files and try again later; do not delete data files that the core is using before starting it.

Conclusion: A changed match result confirms the update

A newer file timestamp is only the first check. The update is confirmed only when the core has reloaded, the logs show the target matching the expected Geo rule, and the same correct outbound is selected for three consecutive rounds.

Build a rollback-ready update routine

GeoIP and GeoSite do not need to be updated at every startup, but leaving them unchanged for too long can gradually increase classification errors. Check them when a repeatable set of routing mistakes appears, after updating the client core, or when making major changes to a routing rule set—not immediately after every network fluctuation.

  • Keep the previous geoip.dat and geosite.dat versions in a separate directory that the core does not scan automatically.
  • Treat both files as one release, and record the replacement date and current core type.
  • Keep three fixed test targets covering direct domain access, direct IP access, and the proxy fallback.
  • Make rule changes and data updates separately so you can tell which step changed the result.
  • If an update fails, restore the complete backup before investigating network or directory-permission issues.

When a domain needs an immediate correction but the database does not cover it yet, add an exact-domain rule before the GeoSite rule. Use full:example.com to match one complete domain, or domain:example.com to match that domain and its subdomains. Keep exact rules manageable and review them after the database adds coverage so temporary rules do not accumulate permanently.

A complete troubleshooting sequence can be standardized as follows: confirm the node and local ports, review rule order, check Geo file dates, run the update, restart the core, read the logs, and repeat comparison requests. This sequence applies to both Xray and v2fly cores; only the resource directory and client menu location differ, not the basic matching roles of GeoIP and GeoSite.

Download clientv2rayN / v2rayNG