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¶
- Open v2rayN
- In the top menu click Settings
- Select Routing Setting
Step 2. Click «+ Add»¶
The Routing Setting window opens with a list of existing rule sets.
- Click the + Add button in the top left corner
Step 3. Copy rules and import from clipboard¶
The Rule Settings window opens. The fastest way is importing from clipboard.
- Copy the JSON rules below (click the icon in the top right of the code block)
- In Rule Settings click the Import Rules From Clipboard tab
- Click it
Routing rules JSON — click to expand and copy
[
{
"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?»
- Creating a new rule set — click Нет / No (replace)
- Want to add to existing rules — click Да / Yes (append)
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.
- Verify rules are displayed (15 rules)
- In the Remarks field enter a name, e.g.:
Rules - Set Domain strategy:
IPOnDemand - Set sing-box domain strategy:
ipv4_only - Click Confirm at the bottom right
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.
- Verify your rule set (
Rules) is in the list - Click Confirm at the bottom right
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:
- Find the Routing dropdown (bottom right)
- Select your rule set
Rules - Restart connection: Reload button in the menu
What's next¶
Routing is done! Now let's configure secure DNS: