这篇写 VLESS+Reality 的配置。Reality 是 Xray 团队搞的方案,核心思路是”伪装成正常网站”——TLS 握手时给审查者看的是一个真实网站(比如微软、苹果)的证书,但实际通信走你自己的服务器。
不需要域名,不需要自己搞 TLS 证书,自动用目标网站的证书。这是它最大的优势。
装 Xray
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install装完配置文件在 /usr/local/etc/xray/config.json。
配置文件
直接贴一个能用的:
{
"log": { "level": "warning" },
"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.microsoft.com:443",
"serverNames": ["www.microsoft.com", "www.apple.com"],
"privateKey": "这里换成私钥",
"shortIds": ["", "0123456789abcdef"]
}
},
"sniffing": { "enabled": true, "destOverride": ["http", "tls"] }
}],
"outbounds": [{ "protocol": "freedom" }]
}UUID 生成:cat /proc/sys/kernel/random/uuid
私钥/公钥生成:xray x25519
生成后把 public key 记下来,客户端要用。
dest 和 serverNames 怎么选
dest 填真实网站的 IP:端口。serverNames 是这个网站支持的 SNI。
常用目标:
www.microsoft.com:443— 微软,比较稳www.apple.com:443— 苹果cloudflare.com:443— CF
不要选冷门网站,越常见越好。目标网站挂了你的节点也会跟着断。
客户端
导入配置时需要这几个值:
地址:服务器 IP
端口:443
UUID:你生成的
flow:xtls-rprx-vision
加密:none
传输:tcp
TLS:reality
SNI:www.microsoft.com
publicKey:xray x25519 生成的公钥
shortId:配置文件里的(空或 “0123456789abcdef”)
SpiderX:/(可选)
Windows 推荐 v2rayN,Android 推荐 v2rayNG,iOS 用 Shadowrocket。
晚高峰优化
晚高峰慢不一定是协议问题。排查:
服务器负载高:htop 看 CPU。
回程路由差:curl ip.sb 看 IP,去 tools.ipip.net/traceroute.php 查路由。如果绕美西,换其他运营商的 IP。
防火墙丢包:ping -c 100 服务器IP 看丢包率。
Reality 协议本身已经很硬了,不需要额外加混淆。如果被封,大概率不是协议的问题。