Xray-core
Xray-core copied to clipboard
多出口IP的VPS,针对不同客户端的email或者id,使用不同的出口IP
假设VPS有3个公网IP 1.1.1.1 2.2.2.2 3.3.3.3,三个客户端email [email protected] [email protected] [email protected]
我使用以下配置,期望:当[email protected]连接时,出口ip应该为2.2.2.2
服务端config.json
{
"log": {
"loglevel": "debug",
"access": "/etc/xray/log/access.log",
"error": "/etc/xray/log/error.log"
},
"inbounds": [
{
"protocol": "vmess",
"port": 9000,
"settings": {
"clients": [
{
"id": "f8b8a3cb-0ca4-4b7d-b654-851bdef42101",
"email": "[email protected]"
},
{
"id": "f8b8a3cb-0ca4-4b7d-b654-851bdef42102",
"email": "[email protected]"
},
{
"id": "f8b8a3cb-0ca4-4b7d-b654-851bdef42103",
"email": "[email protected]"
}
]
}
}
],
"routing": {
"rules": [
{
"type": "field",
"user": [
"[email protected]"
],
"outboundTag": "ip1"
},
{
"type": "field",
"user": [
"[email protected]"
],
"outboundTag": "ip2"
},
{
"type": "field",
"user": [
"[email protected]"
],
"outboundTag": "ip3"
}
]
},
"outbounds": [
{
"sendThrough": "1.1.1.1",
"protocol": "freedom",
"tag": "ip1"
},
{
"sendThrough": "2.2.2.2",
"protocol": "freedom",
"tag": "ip2"
},
{
"sendThrough": "3.3.3.3",
"protocol": "freedom",
"tag": "ip3"
}
]
}
客户端config.json
{
"log": {
"access": "",
"error": "",
"loglevel": "warning"
},
"inbounds": [
{
"tag": "socks",
"port": 10808,
"listen": "0.0.0.0",
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
],
"routeOnly": false
},
"settings": {
"auth": "noauth",
"udp": true,
"allowTransparent": false
}
},
{
"tag": "http",
"port": 10809,
"listen": "0.0.0.0",
"protocol": "http",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
],
"routeOnly": false
},
"settings": {
"auth": "noauth",
"udp": true,
"allowTransparent": false
}
}
],
"outbounds": [
{
"tag": "proxy",
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "2.2.2.2",
"port": 9000,
"users": [
{
"id": "f8b8a3cb-0ca4-4b7d-b654-851bdef42102",
"alterId": 0,
"email": "[email protected]",
"security": "auto"
}
]
}
]
},
"streamSettings": {
"network": "tcp"
},
"mux": {
"enabled": false,
"concurrency": -1
}
},
{
"tag": "direct",
"protocol": "freedom",
"settings": {}
},
{
"tag": "block",
"protocol": "blackhole",
"settings": {
"response": {
"type": "http"
}
}
}
],
"dns": {
"servers": [
"1.1.1.1",
"8.8.8.8"
]
}
}
结果始终无法访问网页,服务端的路由正常路由到了[email protected]
error日志如下:
2024/01/20 16:55:17 [Info] [1583011746] app/proxyman/inbound: connection ends > proxy/vmess/inbound: connection ends > context canceled
2024/01/20 16:55:17 [Info] [1583011746] app/proxyman/outbound: failed to process outbound traffic > proxy/freedom: failed to open connection to tcp:149.154.167.91:443 > common/retry: [dial tcp 2.2.2.2:0->149.154.167.91:443: bind: cannot assign requested address] > common/retry: all retry attempts failed
2024/01/20 16:55:17 [Info] [211886297] app/proxyman/outbound: failed to process outbound traffic > proxy/freedom: failed to open connection to tcp:149.154.167.91:80 > common/retry: [dial tcp 2.2.2.2:0->149.154.167.91:80: bind: cannot assign requested address] > common/retry: all retry attempts failed
2024/01/20 16:55:17 [Info] [211886297] app/proxyman/inbound: connection ends > proxy/vmess/inbound: connection ends > io: read/write on closed pipe
2024/01/20 16:55:17 [Info] [4287156885] app/proxyman/outbound: failed to process outbound traffic > proxy/freedom: failed to open connection to tcp:149.154.167.91:443 > common/retry: [dial tcp 2.2.2.2:0->149.154.167.91:443: bind: cannot assign requested address] > common/retry: all retry attempts failed
2024/01/20 16:55:17 [Info] [4287156885] app/proxyman/inbound: connection ends > proxy/vmess/inbound: connection ends > io: read/write on closed pipe
2024/01/20 16:55:17 [Info] [2340480791] proxy/vmess/inbound: received request for tcp:self.events.data.microsoft.com:443
2024/01/20 16:55:17 [Info] [2340480791] app/dispatcher: taking detour [ip2] for [tcp:self.events.data.microsoft.com:443]
2024/01/20 16:55:17 [Info] [2340480791] transport/internet/tcp: dialing TCP to tcp:self.events.data.microsoft.com:443
2024/01/20 16:55:17 [Debug] transport/internet: dialing to tcp:self.events.data.microsoft.com:443
2024/01/20 16:55:17 [Info] [2340480791] transport/internet/tcp: dialing TCP to tcp:self.events.data.microsoft.com:443
2024/01/20 16:55:17 [Debug] transport/internet: dialing to tcp:self.events.data.microsoft.com:443
2024/01/20 16:55:17 [Info] [1576098248] transport/internet/tcp: dialing TCP to tcp:149.154.167.41:443
求教大佬帮助!谢谢!
{
"sendThrough": "2.2.2.2",
"protocol": "freedom",
"settings": {
"domainStrategy": "ForceIPv4",
},
"tag": "ip2"
},
{
"sendThrough": "2.2.2.2",
"protocol": "freedom",
"streamSettings": {
"sockopt": {
"domainStrategy": "ForceIPv4"
}
},
"tag": "ip2"
},
我没测试过,你试试这2种有效果不。
Answered