1. 准备工作

1.1 选择目标域名

Reality 需要一个目标域名作为伪装。理想的选择是:国外知名、支持 TLSv1.3、且在国内访问延迟较低的网站

  • 辅助工具DNSlytics (用于查询同 IP 下的优质域名)

1.2 系统网络优化

在部署前,建议开启 BBRv3 或进行 TCP 优化以提升吞吐量

安装 BBRv3:

1
bash <(curl -l -s [https://raw.githubusercontent.com/byJoey/Actions-bbr-v3/refs/heads/main/install.sh](https://raw.githubusercontent.com/byJoey/Actions-bbr-v3/refs/heads/main/install.sh))

综合 TCP 优化脚本:

1
wget -O tcpx.sh "[https://github.com/ylx2016/Linux-NetSpeed/raw/master/tcpx.sh](https://github.com/ylx2016/Linux-NetSpeed/raw/master/tcpx.sh)" && chmod +x tcpx.sh && ./tcpx.sh

2. 安装与环境配置

2.1 安装 Xray 核心

使用官方脚本一键安装:

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

2.2 生成必要参数

在配置前,需要生成 UUID 以及 Reality 专用的密钥对

  • 生成 UUID
1
2
xray uuid
# 输出示例:2233ebed-68b0-4606-a241-1be5f8ad4668
  • 生成 x25519 密钥对
1
2
3
xray x25519
# PrivateKey: aIRW_Eh8-n8JEmkHFRxQeHnBipHrxt6OrIbAeUVr12s
# PublicKey:  YLr6CDT0jCxaxZaDypHnOZzB4D83MWLwR06nSWykzBI

3. 服务端配置

编辑配置文件:/usr/local/etc/xray/config.json

注意:Reality 必须监听 443 端口以实现完美伪装。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{
  "log": {
    "loglevel": "error"
  },
  "api": {
    "tag": "api",
    "services": ["HandlerService", "LoggerService", "StatsService", "RoutingService"]
  },
  "inbounds": [
    {
      "listen": "0.0.0.0",
      "port": 10086,
      "protocol": "dokodemo-door",
      "settings": { "address": "127.0.0.1" },
      "tag": "api"
    },
    {
      "port": 443,
      "tag": "vless-reality",
      "protocol": "vless",
      "settings": {
        "clients": [],
        "decryption": "none"
      },
      "streamSettings": {
        "network": "tcp",
        "security": "reality",
        "realitySettings": {
          "show": false,
          "dest": "www.lovelive-anime.jp:443", // 目标域名及端口
          "xver": 0,
          "serverNames": ["www.lovelive-anime.jp"], // 客户端连接时使用的域名
          "privateKey": "aIRW_Eh8-n8JEmkHFRxQeHnBipHrxt6OrIbAeUVr12s", // 填入生成的 PrivateKey
          "shortIds": ["1d582b6c"] // 随机 1-8 位十六进制字符
        }
      }
    }
  ],
  "outbounds": [
    { "protocol": "freedom", "tag": "direct" },
    { "protocol": "blackhole", "tag": "block" }
  ],
  "routing": {
    "domainStrategy": "IPIfNonMatch",
    "rules": [
      { "inboundTag": ["api"], "sourceIP": ["0.0.0.0/0"], "outboundTag": "api", "type": "field" },
      { "type": "field", "ip": ["geoip:private"], "outboundTag": "block" },
      { "type": "field", "protocol": ["bittorrent"], "outboundTag": "block" }
    ]
  }
}

配置完成后,重启 Xray:

1
2
systemctl restart xray
systemctl status xray

4. 客户端配置 (Clash/Mihomo)

以 Clash Meta (Mihomo) 核心为例,在 proxies 章节添加以下配置:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
proxies:
  - name: "Reality-Vision-Node"
    type: vless
    server: 142.171.47.230      # 你的 VPS IP
    port: 443
    uuid: 2233ebed-68b0-4606-a241-1be5f8ad4668
    tls: true
    udp: true
    flow: xtls-rprx-vision
    servername: www.lovelive-anime.jp # 须与服务端 serverNames 一致
    reality-opts:
      public-key: YLr6CDT0jCxaxZaDypHnOZzB4D83MWLwR06nSWykzBI # 填入生成的 PublicKey
      short-id: 1d582b6c # 须与服务端 shortIds 一致
    client-fingerprint: chrome # 模拟浏览器指纹

5. 参考资源