Xray或V2Ray 实现VPS出站流量分流
![]() | ![]() | ![]() | ![]() |
| 【性价之王】 | 【线路之王】 | 【价格之王】 | 【配置之王】 |
| 【免费之王】 | 【香港首推】 | 【梯子之王】 | 【独服之王】 |

Xray或V2Ray 的配置类似, 本文按域名分流/按IP分流的方案, 使用Xray举例 智能分流方案.
安装 Xray
如果已经安装了Xray或V2Ray, 可跳过这部.
可使用 VPS ToolBox 安装 Xray (同时安装 增强版的geosite/geoip规则).
修改配置文件
根据域名或者IP转发出站流量
编辑 /usr/local/etc/xray/config.json, 内容类似下面
这里举例, 入站/出站都是 ss (Xray或V2Ray支持ss/Socks5/Trojan/VLESS/VMess).
{ "inbounds": [ // 入站规则 { "port": 50000, // 当前VPS开放的端口 "protocol": "shadowsocks", "settings": { "clients": [ { "password": "your-password", "method": "aes-256-gcm" } ], "network": "tcp,udp" } } ], "outbounds": [ // 出站规则 { "tag": "direct", "protocol": "freedom", "settings": {} }, { "tag": "VPS1", // Proxy 名称 "protocol": "shadowsocks", "settings": { "servers": [{ "address": "server-your-vps1", "port": 12345, "password": "your-vps1-password", "method": "aes-256-gcm" }] } }, { "tag": "VPS2", // Proxy 名称 "protocol": "shadowsocks", "settings": { "servers": [{ "address": "server-your-vps2", "port": 12345, "password": "your-vps2-password", "method": "aes-256-gcm" }] } } ], "routing": { // 路由, 分流规则 // "domainStrategy": "AsIs", "rules": [ { "type": "field", "outboundTag": "VPS1", // 使用VPS1 "domain": [ // 基于域名分流 // "geosite:netflix", "geosite:youtube", "geosite:telegram", "domain:ip.sb" ] }, { "type": "field", "outboundTag": "VPS2", // 使用VPS2 "ip": [ // 基于IP分流 "8.8.8.8/32", "geoip:telegram" ] } ] }}检查 xray 状态
systemctl status xray
如果启动失败, 可以尝试 直接运行 xray run -config /usr/local/etc/xray/config.json 看报错信息
重启 xray 服务
修改配置后, 重启服务: systemctl restart xray
分流的意义
有时不想用客户端的分流, 希望统一走一个VPS, 这个VPS再根据规则, 把部分流量转发到其他的VPS.有些商家劫持了路由, 屏蔽了某些站点, 可以把这些分流到其他VPS.有些VPS不解锁某个流媒体, 可以分流走不同的proxy.[VPS]历史优惠活动内容
猜你可能想看的VPS
- 疯狂猜成语 图猜成语一个壁虎尾巴断了是什么成语?全球[VPS测评]
- VPS 上安装 Speedtest HTML5 服务来测带 报错” Pa全球[VPS测评]
- 腾讯云星星海 SA2 云服务器→2C4G6M 三年 1735 元全球[VPS测评]
- NameCheap - 域名转入优惠 .com $4.88 年 .net全球[VPS测评]
- 景文互联→VPS 全场 7 折 年付内存翻倍 充值 1000 元送 30全球[VPS测评]
- Hostsailor→$28.8 月-E3 1231v3 8GB 1TB全球[VPS测评]
- AlphaVPS→保加利亚 VPS 独立服务器 大硬盘 KVM 年付 1独立服务器[U]
- friendhosting→新增中文界面 美国等 8 机房-不限流量 V美国VPS[主机]
- bootstrapTable 设置行样式(背景颜色)全球[VPS测评]
- 六六云AS9929线路 VPS 测评,三网回程走AS9929线路,线路质全球[VPS测评]
- Modern Solutions → 5$ 月 1C1G25G 不限流量美国VPS[主机]
- Virmach 黑五及超级星期一活动全球[VPS测评]
- 2020: OLVPS 512 内存 30G SSD 1T流量 俄罗斯伯全球[VPS测评]
- HKServerSolution → 4G内存 20G SSD 3T流量全球[VPS测评]
- Fatal error: Allowed memory size of 全球[VPS测评]
- 拼多多入局跨境电商平台,首站美国;奈雪的茶在上海建第二总部;pidan“美国VPS[主机]
- 持续高温!长沙所有初中新生停止军训!全球[VPS测评]
- 企鹅小屋:深港IPLC节点,0.25元/G流量,不用不花钱全球[VPS测评]
- 快速云:怎么连接vps?VPS的用途有哪些?全球[VPS测评]
- 适合美容院的正能量抖音文案,唯美阳光,正能量满满全球[VPS测评]
- 华为云香港企业级云服务器优惠:4核8G5M香港云服务器低至4764元/年香港VPS[主机]
- 景林网络:香港CN2vps,1核1G3M月付35元;美国高防vps,48美国VPS[主机]
- edgenat,低价年付促销活动,香港vps 4核8G仅300元/年,美美国VPS[主机]
- 腾讯云香港/韩国/日本免备案服务器优惠促销活动日本VPS[主机]
- 华为云香港企业级云服务器优惠:4核8G5M香港云服务器低至4764元/年香港VPS[主机]
- 冀青云怎么样?香港CN2-GIA vps月28元/香港NTT 月9元香港VPS[主机]
- 亿速云香港服务器助力企业出海 有哪些具体的特点和优势?香港VPS[主机]
- 樊云:香港CN2节点vps,最低月付22.5起,带宽5Mbps起步香港VPS[主机]
- 什么是IconFont ?iconfont 的使用和解析全球[VPS测评]
- 云计算竞争日趋白热化云计算行业市场前景分析全球[VPS测评]
转载请注明原文地址:http://140.238.13.167:12355/read-15116.html











