Skip to content

Routing setup step by step

Time: ~5 minutes

Below is a step-by-step guide with screenshots. Follow in order.


Step 1. Open routing settings

  1. Open v2rayN
  2. In the top menu click Settings
  3. Select Routing Setting
Opening routing settings in v2rayN
Settings → Routing Setting

Step 2. Click «+ Add»

The Routing Setting window opens with a list of existing rule sets.

  1. Click the + Add button in the top left corner
Routing Setting window with Add button
Click «+ Add» to create a new rule set

Step 3. Copy rules and import from clipboard

The Rule Settings window opens. The fastest way is importing from clipboard.

  1. Copy the JSON rules below (click the icon in the top right of the code block)
  2. In Rule Settings click the Import Rules From Clipboard tab
  3. Click it
Import Rules From Clipboard tab
Click «Import Rules From Clipboard» — rules will be pasted from clipboard
Routing rules JSON — click to expand and copy
routing-rules.json
[
  {
    "port": "443",
    "network": "udp",
    "outboundTag": "block",
    "enabled": true,
    "remarks": "Блокировка QUIC (UDP:443)"
  },
  {
    "port": "",
    "outboundTag": "direct",
    "ip": [
      "geoip:private"
    ],
    "enabled": true,
    "remarks": "Частные IP напрямую"
  },
  {
    "port": "",
    "outboundTag": "direct",
    "domain": [
      "geosite:private"
    ],
    "enabled": true,
    "remarks": "Частные сайты напрямую"
  },
  {
    "port": "",
    "outboundTag": "direct",
    "protocol": [
      "bittorrent"
    ],
    "enabled": true,
    "remarks": "Торрент напрямую"
  },
  {
    "port": "",
    "outboundTag": "proxy",
    "domain": [
      "dns.quad9.net",
      "doh.mullvad.net"
    ],
    "enabled": true,
    "remarks": "DOH через прокси"
  },
  {
    "port": "",
    "outboundTag": "block",
    "domain": [
      "geosite:category-ads-all"
    ],
    "enabled": true,
    "remarks": "Блокировать рекламу"
  },
  {
    "port": "",
    "outboundTag": "block",
    "domain": [
      "geosite:win-spy"
    ],
    "enabled": true,
    "remarks": "Блокировка телеметрии Windows"
  },
  {
    "port": "",
    "outboundTag": "proxy",
    "ip": [
      "geoip:telegram"
    ],
    "enabled": true,
    "remarks": "Обходить блокировку Telegram IP"
  },
  {
    "port": "",
    "outboundTag": "proxy",
    "domain": [
      "geosite:telegram"
    ],
    "enabled": true,
    "remarks": "Обходить блокировку Telegram сайт"
  },
  {
    "port": "",
    "outboundTag": "proxy",
    "ip": [
      "geoip:ru-blocked",
      "geoip:ru-blocked-community",
      "geoip:re-filter"
    ],
    "enabled": true,
    "remarks": "Обходить заблокированные в РФ IP"
  },
  {
    "port": "",
    "outboundTag": "proxy",
    "domain": [
      "geosite:ru-blocked-all"
    ],
    "enabled": true,
    "remarks": "Обходить заблокированные в РФ сайты"
  },
  {
    "port": "",
    "outboundTag": "proxy",
    "domain": [
      "geosite:google"
    ],
    "enabled": true,
    "remarks": "Google через прокси"
  },
  {
    "port": "",
    "outboundTag": "direct",
    "domain": [
      "geosite:category-ru"
    ],
    "enabled": true,
    "remarks": "Актуально при CDN за пределами РФ"
  },
  {
    "port": "",
    "outboundTag": "direct",
    "ip": [
      "geoip:ru"
    ],
    "enabled": true,
    "remarks": "Напрямую IP РФ"
  },
  {
    "port": "0-65535",
    "outboundTag": "proxy",
    "enabled": true,
    "remarks": "Остальное в прокси"
  }
]

Online: copy the JSON above by clicking

Locally: the file is at configs/v2rayn/xray/routing-rules.json


Step 4. Confirm import

A dialog appears: «Do you want to append rules?»

  1. Creating a new rule set — click Нет / No (replace)
  2. Want to add to existing rules — click Да / Yes (append)
Append or replace rules dialog
«Да/Yes» = append to existing, «Нет/No» = replace all rules

Recommendation

If setting up from scratch — click Нет/No (replace) for a clean rule set.


Step 5. Verify rules, fill in name and strategies

After import you'll see all rules in the Rule List.

  1. Verify rules are displayed (15 rules)
  2. In the Remarks field enter a name, e.g.: Rules
  3. Set Domain strategy: IPOnDemand
  4. Set sing-box domain strategy: ipv4_only
  5. Click Confirm at the bottom right
Imported rules with filled fields
Fill in Remarks, select strategies, click Confirm

Domain strategy: IPOnDemand — Xray resolves domain to IP only when needed for IP rules. Saves DNS queries. Optimal balance of accuracy and speed.

sing-box domain strategy: ipv4_only — when in TUN mode (sing-box core), request only IPv4 addresses. IPv6 disabled — fewer leaks, fewer surprises.


Step 6. Confirm in Routing Setting window

You'll return to the main Routing Setting window.

  1. Verify your rule set (Rules) is in the list
  2. Click Confirm at the bottom right
Routing Setting with new rule set
«Rules» appears in the list → click Confirm

Done!

Routing is configured. Don't forget to select this rule set in the main v2rayN window: bottom panel → Routing dropdown → select your Rules set.


Step 7. Activate the rule set

In the main v2rayN window, in the bottom status bar:

  1. Find the Routing dropdown (bottom right)
  2. Select your rule set Rules
  3. Restart connection: Reload button in the menu

What's next

Routing is done! Now let's configure secure DNS:

DNS Setup →