From below of long thin blue cables connected to row of smal

Xray 的 VLESS+XTLS-Reality 是目前公认抗封锁能力最强的协议组合。它的核心原理是流量伪装成正常的 TLS 握手,让 GFW 难以通过特征识别判断是代理流量。

这篇文章从零开始,完整部署一套可用的配置。

前置准备

  • 一台海外 VPS(推荐 DMIT 香港或美国节点,线路质量好)
  • VPS 系统:Ubuntu 22.04+
  • 本地客户端:mihomo(原 Clash Meta)

服务端部署

安装 Xray

bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install

生成 XTLS-Reality 所需密钥

xray x25519

输出类似:

Private key: 你的私钥(保存好)
Public key:  你的公钥(填入客户端配置)

再生成 UUID:

xray uuid

服务端配置文件

/usr/local/etc/xray/config.json:

{
  "inbounds": [
    {
      "port": 443,
      "protocol": "vless",
      "settings": {
        "clients": [
          {
            "id": "你的UUID",
            "flow": "xtls-rprx-vision"
          }
        ],
        "decryption": "none"
      },
      "streamSettings": {
        "network": "tcp",
        "security": "reality",
        "realitySettings": {
          "show": false,
          "dest": "www.apple.com:443",
          "xver": 0,
          "serverNames": ["www.apple.com"],
          "privateKey": "你的私钥",
          "shortIds": [""]
        }
      },
      "sniffing": {
        "enabled": true,
        "destOverride": ["http", "tls", "quic"]
      }
    }
  ],
  "outbounds": [
    {"protocol": "freedom", "tag": "direct"},
    {"protocol": "blackhole", "tag": "block"}
  ]
}

关键参数说明:

  • dest:伪装目标,选一个支持 TLS 1.3 的知名网站(apple.com、microsoft.com 都行)
  • serverNames:必须和 dest 一致
  • flow: xtls-rprx-vision:开启 XTLS Vision 模式,抗封锁效果最好

启动并设置开机自启:

systemctl enable xray --now
systemctl status xray

防火墙开放 443

ufw allow 443/tcp
ufw allow 443/udp

客户端配置(mihomo)

在 mihomo 的 proxy 配置里添加:

proxies:
  - name: "DMIT-HK-Reality"
    type: vless
    server: 你的VPS_IP
    port: 443
    uuid: 你的UUID
    network: tcp
    tls: true
    udp: true
    flow: xtls-rprx-vision
    reality-opts:
      public-key: 你的公钥
      short-id: ""
    servername: www.apple.com
    client-fingerprint: chrome

client-fingerprint 模拟浏览器 TLS 指纹,建议用 chrome。

加上 Hysteria2 双协议备份

单协议是单点故障。我同时部署 Hysteria2 作为备用:

# 安装 Hysteria2
bash <(curl -fsSL https://get.hy2.sh/)

Hysteria2 基于 QUIC(UDP),在 TCP 受限场景下效果好;VLESS+Reality 在 UDP 受限时更稳。两个协议互补。

具体配置可以看我的多网关架构文章。

验证效果

服务端配置好后,用客户端连接,检查:

# 检查出口 IP
curl https://api.ipify.org

# 检查流量是否走了代理
curl --proxy socks5://127.0.0.1:7890 https://api.ipify.org

两个 IP 不同说明代理生效。

为什么选 DMIT

部署 Xray 需要一台高质量的 VPS,IP 质量直接决定使用体验。

我用 DMIT 的原因:

  • 香港节点延迟低(20-40ms),日常用不出延迟感
  • 原生 IP,流媒体解锁能力强
  • 线路稳定,IP 被封概率低于其他家

VPS 选购的完整对比可以看这篇:VPS 选购指南


配置过程遇到问题,欢迎来 Telegram 找我。


📷 封面图 · Flux Schnell AI 生成 · panshi.io 品牌风格