前言
这断断续续的一年来,一直在尝试家里服务器VPN的搭建,从L2TP这种到了现在使用的3x-ui,都试过了,不是这个连不上,就是那个有问题,今天终于弄好了,从分析端口到内网IP段的适配,终于是完成了,下面是代码。
版本
v2rayN: v7.13.2
地址: https://github.com/2dust/v2rayN/releases/tag/7.13.2
docker-compose
version: '3.8'
services:
x3ui:
image: ghcr.io/mhsanaei/3x-ui:latest
container_name: x3ui-1753756755
restart: unless-stopped
environment:
- XRAY_VMESS_AEAD_FORCED=false
- XUI_LOG_LEVEL=info
- XUI_DEBUG=false
volumes:
- ./db:/etc/x-ui
- ./cert:/root/cert
- ./logs:/var/log
ports:
- "2053:2053"
- "40020-40030:40020-40030"
- "40031-40040:40031-40040"
- "40041-40050:40041-40050"
- "40100-40110:40100-40110"
- "40111-40120:40111-40120"
- "40121-40130:40121-40130"
- "40131-40140:40131-40140"
- "40141-40150:40141-40150"
- "40200-40210:40200-40210"
- "40211-40220:40211-40220"
- "40300-40310:40300-40310"
- "40400-40410:40400-40410"
- "40500-40510:40500-40510"
- "40600-40610:40600-40610"
- "40700-40710:40700-40710"
- "40800-40810:40800-40810"
- "40900-40910:40900-40910"
- "40950-40960:40950-40960"
- "40970-40980:40970-40980"
- "40990-41000:40990-41000"
networks:
- x3ui-net-1753756755
networks:
x3ui-net-1753756755:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.30.0.0/16更新V2ray参数
设置-参数设置-系统代理设置
localhost,127.0.0.0/8,::1更新3x-ui的路由规则
Xray设置 -> 高级配置-> 高级 Xray 配置模板
添加至rules下即可
{
"type": "field",
"ip": [
"192.168.0.0/16",
"10.0.0.0/8",
"172.16.0.0/12"
],
"outboundTag": "direct"
},完整配置如下
{
"log": {
"access": "none",
"dnsLog": false,
"error": "",
"loglevel": "warning",
"maskAddress": ""
},
"api": {
"tag": "api",
"services": [
"HandlerService",
"LoggerService",
"StatsService"
]
},
"inbounds": [
{
"tag": "api",
"listen": "127.0.0.1",
"port": 62789,
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1"
}
}
],
"outbounds": [
{
"tag": "direct",
"protocol": "freedom",
"settings": {
"domainStrategy": "AsIs",
"redirect": "",
"noises": []
}
},
{
"tag": "blocked",
"protocol": "blackhole",
"settings": {}
}
],
"policy": {
"levels": {
"0": {
"statsUserDownlink": true,
"statsUserUplink": true
}
},
"system": {
"statsInboundDownlink": true,
"statsInboundUplink": true,
"statsOutboundDownlink": false,
"statsOutboundUplink": false
}
},
"routing": {
"domainStrategy": "AsIs",
"rules": [
{
"type": "field",
"ip": [
"192.168.0.0/16",
"10.0.0.0/8",
"172.16.0.0/12"
],
"outboundTag": "direct"
},
{
"type": "field",
"outboundTag": "api",
"inboundTag": [
"api"
]
},
{
"type": "field",
"outboundTag": "blocked",
"protocol": [
"bittorrent"
]
},
{
"type": "field",
"outboundTag": "blocked",
"domain": [
"geosite:category-ads-all"
]
}
]
},
"stats": {},
"metrics": {
"tag": "metrics_out",
"listen": "127.0.0.1:11111"
}
}
评论区