|
|
想要实现:PC 电脑上网流量 → Windows Server(正向代理)→ 互联网
需要在 Windows Server 上搭建正向代理服务,提供 HTTP/SOCKS5 代理端口,之后 PC 进行配置。
PC(v2rayN 客户端) → Windows Server 2025(Xray 服务端【正向代理网关】) → 互联网
第一部分:Windows Server 2025 部署 Xray 服务端(局域网正向代理)
1. 下载 Xray Windows 核心
项目地址:https://github.com/XTLS/Xray-core/releases
下载 ,解压到 C:\Xray
2. 生成 UUID(认证密钥,管理员 CMD 进入 C:\Xray 执行)
复制输出一串 UUID,保存好,客户端必须完全一致
示例输出:5386c345-xxxx-xxxx-xxxx-xxxxxxxxxxxx
3. 创建服务端配置 C:\Xray\config.json(VLESS-TCP 最简局域网方案)
- {
- "log": {
- "loglevel": "warning"
- },
- "inbounds": [
- {
- "listen": "0.0.0.0",
- "port": 12345,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": "【这里粘贴你生成的UUID】",
- "flow": ""
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "tcp"
- },
- "sniffing": {
- "enabled": true,
- "destOverride": ["http", "tls"]
- }
- }
- ],
- "outbounds": [
- {
- "protocol": "freedom",
- "settings": {}
- }
- ]
- }
复制代码 参数说明:
- listen:"0.0.0.0":允许局域网所有 IP 接入
- port:12345:监听端口,可自行修改
- outbound freedom:代表服务端直接访问互联网(正向代理)
4. cmd校验配置 + 临时启动测试
- cd C:\Xray
- xray.exe run -c config.json
复制代码 无报错 = 配置正确;关闭窗口就停止运行,下面注册成系统服务实现开机自启。
5. 将 Xray 注册为 Windows 系统服务(推荐)
- 下载 WinSW:https://github.com/winsw/winsw/releases
- 将 WinSW-x64.exe 放入C:\Xray,重命名为 xray-service.exe
- 在同目录新建 xray-service.xml
- <service>
- <id>Xray</id>
- <name>Xray Service</name>
- <executable>%BASE%\xray.exe</executable>
- <arguments>run -c %BASE%\config.json</arguments>
- <logmode>rotate</logmode>
- </service>
复制代码 管理员 CMD 执行安装服务- xray-service.exe install
- net start Xray
复制代码 6. Windows 防火墙放行端口
管理员 PowerShell 执行(端口和配置内保持一致 12345)
- New-NetFirewallRule -Name Xray-Inbound-TCP-12345 -DisplayName "Xray正向代理12345" -Direction Inbound -LocalPort 12345 -Protocol TCP -Action Allow
复制代码 7. 连通性测试(PC 端执行)
- Test-NetConnection 【Windows Server内网IP】 -Port 12345
复制代码 TcpTestSucceeded: True → 网络通畅
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
|