BlueXIII's Blog

热爱技术,持续学习

0%

V2Ray端口复用

官网及下载

跳板机

  • 使用10.80.8.237
  • 复用Nginx的8080端口
  • 方式为vmess-over-websocket

V2ray服务器搭建

  • v2ray安装路径为/opt/v2ray
  • nginx配置文件路径为/dubhe/nginx/conf

配置服务端config.json,vi config.json:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{
"log": {
"access": "/opt/v2ray/access.log",
"error": "/opt/v2ray/error.log",
"loglevel": "debug"
},
"inbounds": [{
"port": 31313,
"listen": "172.17.0.1",
"protocol": "vmess",
"settings": {
"clients": [{
"id": "7255a312-be4b-9315-65c9-123412341234",
"alterId": 64
}]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/ray/"
}
}
}],
"outbounds": [{
"protocol": "freedom",
"settings": {}
}]
}

启动v2ray:

1
./v2ray --config config.json

配置Nginx的default.conf:

1
2
3
4
5
6
7
8
9
10
location /ray {
proxy_redirect off;
proxy_pass http://172.17.0.1:31313;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

重启Nginx:

1
docker restart nginx

本机DockerEasyConnect启动

1
docker run --name ecweifang --device /dev/net/tun --cap-add NET_ADMIN -itd -p 127.0.0.1:7011:1080 -e EC_VER=7.6.3 -e CLI_OPTS="-d https://xx.xx.xx.xx -u username -p password" hagb/docker-easyconnect:cli

占用端口7011

本机Proxifier配置

  • v2ray进程 + 10.80.8.237网段 –> 127.0.0.1:7011
  • 任意进程 + 10.80.8.*网段 –> 127.0.0.1:7011

V2ray客户端配置

vi weifang.json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{
"inbounds" : [
{
"listen" : "127.0.0.1",
"port" : 7012,
"protocol" : "socks",
"tag" : "socksinbound",
"settings" : {
"auth" : "noauth",
"udp" : false,
"ip" : "127.0.0.1"
}
}
],
"outbounds" : [
{
"protocol" : "vmess",
"settings" : {
"vnext" : [
{
"address" : "10.80.8.237",
"users" : [
{
"id" : "7255a312-be4b-9315-65c9-123412341234",
"alterId" : 64,
"security" : "auto",
"level" : 0
}
],
"port" : 8080
}
]
},
"streamSettings" : {
"wsSettings" : {
"path" : "\/ray\/",
"headers" : {

}
},
"tlsSettings" : {
"allowInsecure" : false,
"alpn" : [
"http\/1.1"
],
"serverName" : "",
"allowInsecureCiphers" : false
},
"security" : "none",
"network" : "ws"
}
}
]
}

本机客户端启动:

1
./v2ray --config weifang.json

占用端口7012