Technical note
V2Ray端口复用
官网及下载
跳板机
- 使用10.80.8.237
- 复用Nginx的8080端口
- 方式为vmess-over-websocket
V2ray服务器搭建
- v2ray安装路径为
/opt/v2ray - nginx配置文件路径为
/dubhe/nginx/conf
配置服务端config.json,vi config.json:
{
"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:
./v2ray --config config.json
配置Nginx的default.conf:
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:
docker restart nginx
本机DockerEasyConnect启动
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
{
"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"
}
}
]
}
本机客户端启动:
./v2ray --config weifang.json
占用端口7012