For readers who have already imported nodes and are maintaining split-tunneling rules in v2rayN. First check which rule files the active core loads, then update or replace them. Finally, test outbound routing separately with a domain and a LAN IP to distinguish an unloaded file from an unmatched category or a rule intercepted earlier in the list.
GeoIP matches IP addresses; GeoSite matches domains
geoip.dat stores IP ranges by category, while geosite.dat stores domain matches by category. The value after the colon in a rule is a category name in the data set, not a file name. geosite:cn does not match every domain ending in .cn, nor does it guarantee that matched domains resolve to IP addresses in China. geoip:private checks ranges in the data set in use; it does not identify LAN devices by their web page names.
Test the IP rule with a known address first
On a trusted LAN, choose a device you know is reachable and test its actual IP address, then test GeoSite separately with a domain. Using a hostname for both tests makes it impossible to tell whether the domain rule failed to match or the IP rule never received an address to compare.
Update and Replace Rule Files in v2rayN
First, check which core the current node uses in the main window, then note the active profile under Settings → Routing settings. The DAT examples below apply to Xray or V2Ray configurations that use this type of data file. If the active core uses its own rule-set format, replacing a DAT file with the same name will not update those rules. Menu names and resource directories may also vary between versions.
- Back up the current files. Confirm the resource directory used by the active core, then copy
geoip.datandgeosite.datto a separate backup directory. Portable and installed versions may use different locations; if the launch environment specifies a resource directory, use that one. If you find multiple copies, don’t overwrite a file just because it was modified most recently. - Use the built-in updater first. Open Check for updates in the main window and look for Geo file updates. Depending on the version, the option may be called Update Geo files or list GeoIP and GeoSite separately. Check the update status and confirm that both required files were updated. If only one updated, troubleshoot the failed item first; don’t treat a success message for the other file as confirmation that both are up to date.
- Exit before replacing files manually. Select Exit from the system tray and confirm that the active core has stopped. Copy both files from a trusted source that is compatible with your core and profile into the active resource directory, keeping the names
geoip.datandgeosite.dat. Check the file extensions: don’t mistake an archive or an error page for a DAT file, and avoid accidentally adding a second extension. - Restart and check the logs. Start v2rayN, re-enable the original routing profile, and check the core startup result in the main window log. If a file can’t be found, check the resource directory. If a category is missing, confirm that the new data set includes the category referenced by the profile. If startup fails, exit, restore the complete backup, and troubleshoot one item at a time.
Routing rules for geosite:cn and geoip:private
Edit the active profile under Settings → Routing settings. Use domain for domain conditions and ip for address conditions. Put rules that should take precedence before broader rules. The core checks rules from top to bottom and selects the outbound specified by the first matching rule.
Route LAN addresses directly
typefieldipgeoip:privateoutboundTagdirect
First test with a known device’s numeric IP address. Make sure the example outbound tag exists in your actual configuration.
Route a domain category directly
typefielddomaingeosite:cnoutboundTagdirect
This rule matches a domain category. If the input is only a numeric IP address, it won’t look up a domain and match against it.
The example below is a complete routing object with three sample rules, not a complete client configuration. Both direct and proxy must match a tag in the actual outbounds. Edit and save profiles maintained in the client through its routing editor; avoid manually changing a configuration file that will be regenerated the next time the client starts.
{
"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"}
]
}
}
The domain and IP conditions are separate because putting both domain and ip in one rule does not mean “either one.” The last rule is a catch-all example for TCP and UDP. When adding these rules to an existing profile, preserve existing exceptions and check their order. Rules of the same type placed after the catch-all usually won’t be reached.
Use logs to tell whether rules failed to load, match, or connect
AsIs does not resolve domains specifically for routing. If an app passes an internal hostname to the core, geoip:private may not route that request directly. You can add an exact rule for a known internal hostname, such as full:nas.home.arpa in domain. If you need to route by the resolved address, see the routing configuration fields and review how IPOnDemand handles DNS resolution. The example already has a TCP and UDP catch-all; don’t assume switching to IPIfNonMatch will necessarily trigger a lookup.
- Make sure the request reaches the core. Test with an app explicitly configured to use the local proxy. System proxy exclusions or the app’s own proxy bypass rules may send LAN requests directly, bypassing v2rayN. A page loading successfully does not prove that
geoip:privatematched. - Test one input type at a time. First visit the actual address of a device you’re authorized to test, such as
http://192.168.1.20:8080/, provided a service is listening at that address and port. Then test the domain rule with a domain known to be included in the current data set. Start a new connection each time and note the target and outbound. Reusing an existing connection may not show the result of a new routing decision. - Check the outbound before the connection result. Enable access logging if available, then compare the target and outbound tag for the same request. If it used
directbut failed, check the target port and local network reachability first. If the request reached the core but usedproxy, check whether the core received a domain or an IP address, along with the rule order and category membership.
Common questions about updating rule files
After an update, the cn category can’t be found. What should I check?
Check whether the error refers to domain or ip, then inspect the corresponding GeoSite or GeoIP file. Also check the active resource directory and the category documentation for the data source. Files with the same name may use different category sets. If your profile still depends on the original categories, restore a compatible backup first.
Why do I get different results for the same site using its domain and IP address?
A domain input can match geosite:cn, while a numeric address depends on the ip condition. Check the target type shown in the logs and review the corresponding rule. To add a specific exception, use an exact domain or IP range and place it before the catch-all; there’s no need to change the entire category.
Does refreshing a subscription also update these two files?
Refreshing a subscription mainly updates the node list. Check rule resources and the active routing profile separately. If you switch to a node that uses a different core, check the rule format again. A successful subscription refresh alone doesn’t mean the new core loaded the DAT categories used by the previous profile.