If all traffic goes through proxies, domestic websites (Taobao, Bilibili, online banking) will slow down or even fail to open, consuming traffic in vain. The correct approach is to "divide": direct domestic connections and agents abroad. v2rayN has built-in ready-made rules that can be configured in just a few clicks.

1What's going on with diversion?

Routing is to divide traffic into lanes: v2rayN determines whether this traffic is directly connected (direct), proxy (proxy) or directly blocked (commonly used for advertising) based on the domain name or IP visited. After configuration, access to Baidu will automatically connect directly, access to the external network will automatically go through the proxy, and there is no need to manually switch during the whole process.

v2rayN — routing settings (predefined rules)
server Subscribe Parameter settings routing Check for updates help rules Match object outbound action Status Domestic domain name/IP direct connection geosite:cn, geoip:cn Direct connection direct enable Advertising domain blocking geosite:category-ads-all intercept block enable LAN address direct connection geoip:private Direct connection direct enable All other traffic (Secret rules) proxy proxy enable System Agent: Automatic Configuration Route: around the mainland Tun: off
A typical set of traffic diversion rules: domestic direct connection, ad blocking, and remaining through proxies, matching in order from top to bottom.
Sponsored Looking for a stable node service for v2rayN? Selected high-speed lines · Multiple regions available · Support subscription import View Recommended Nodes

2Use the bottom bar to switch routing modes with one click

The simplest way: main interface bottom status bar In the "Routing" drop-down box, directly select the default mode without writing your own rules:

  • Bypassing the mainland (recommended): Domestic websites and IPs are directly connected, and the rest are through proxies. This is the most worry-free for daily use.
  • Global: All traffic goes through the proxy. It is suitable for troubleshooting problems or accessing region-sensitive services, but domestic sites will be slower.
  • Bypass Mainland China + Ad Blocking: In addition to bypassing mainland China, additional advertising domain names are blocked.

Most people choose "bypassing the mainland" as enough. Only when there are special needs such as "a domestic website also wants to use a proxy" or "an external network wants to be directly connected", you need to enter the routing settings and add custom rules.

3Add a custom rule

Menu "Routing" → "Routing Settings" to add new rules. There are two common ways of writing:

  • To force a website to use a proxy: Add a new rule and fill in the "domain name" example.com, select "proxy" for outbound, and put it in the "direct connection" rule above(The rules match from top to bottom, whoever is in front listens to whoever is in front).
  • To force a website to connect directly: In the same way, fill in the domain name and select "direct" for outbound. For example, some domestic CDNs or company intranets.

Domain name matching supports several prefixes: domain: Match domain names and subdomain names, full: exact match, keyword: Keyword contains. IP segment is used geoip:cn This kind of preset database does not need to be listed one by one.

The order of the rules is important: v2rayN matches items one by one from top to bottom and stops when the first item is hit. If your custom rule doesn't take effect, it's probably blocked by the broader rule above - move it up.

4Troubleshooting rules that do not take effect

  • Remember after changing the rules Restart service(There is "Restart Service" in the menu) or reset the system agent to allow the new configuration to be loaded.
  • The browser has a cache, so use an incognito window or force refresh when testing.
  • Make sure that "Routing" in the bottom column selects the set of rules you changed, and that "Global" does not cover up your rules.
Download v2rayN (Windows version)v7.22.6 · Support x64 / ARM64 · Open source and free

If you want to further control the traffic direction of a single software, you can see Set up separate agents for other software; If you want all traffic (including programs that do not recognize the proxy) to go through the proxy, you need to Tun mode.