
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 品牌風格