

OpenWrt 中配置 V2ray负载均衡
source link: https://uzbox.com/tech/v2ray-fuzaijunheng.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2Ray负载均衡
有些小伙伴对 V2ray 的负载均衡有点错误的理解,V2ray负载均衡并不是哪条线路速度快就选择哪条线路,V2Ray 的负载均衡而是以轮询的方式进行均衡负载的,也就是说当有流量需要通过代理时,首先走第一个 vnext 配置的服务器,然后有第二个连接就走第二个服务器,接着第三个,第四个以此类推,轮询完一遍后又头开始轮询。
需要注意的是,在配置V2ray负载均衡时,端口、ID 这些在 vnext 数组内的配置项可以各不相同,但是它们的传输层配置(streamSettings)必须一致,也就是说,要使用同一种传输协议。
"inbound": {
...
},
"outbound": {
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "AAA",
"port": 3721,
"users": [
{
"id": "d5d013f9-7ee2-4298-93bf-ad3fe7088296",
"alterId": 64
}
]
},
{
"address": "BBB",
"port": 4399,
"users": [
{
"id": "68f0d692-b1cf-439d-9979-eecccef741e9",
"alterId": 64
}
]
}
// 如果还有更多节点可以继续添加!
]
},
"streamSettings": {
...
}
},
...
}
以上是V2ray负载均衡的示例代码。
OpenWrt 中配置 V2ray 负载均衡
在OpenWrt中,V2ray服务中配置负载均衡,如果你有多个v2ray服务节点,可以在OpenWrt上使用负载均衡。
首先为每个出站连接设置标识TAG

例如,当前有三个出站连接,标识tag分别设置成A/B/C。
然后进入路由设置页面,将Balancers勾选balancers。

勾选好Balancers之后,在路由规则里面添加一条规则“proxy”

填写负载均衡的标识名称,填写完毕后,保存并应用。在路由规则选项中,将刚才新添加的“proxy”勾选添加进去,然后保存应用。

最下面的标识填写balancer,注意大小写。填写完毕后点击保存。

最后返回到全局设置中,将出站服务器全部勾选上就可以了。

Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK