侧边栏壁纸
  • 累计撰写 12 篇文章
  • 累计创建 2 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

reality节点搭建

shan
2026-06-25 / 0 评论 / 0 点赞 / 2 阅读 / 0 字

Debian

1、开启bbr

sed -i '/net.ipv4.tcp_congestion_control/d' /etc/sysctl.conf
sed -i '/net.core.default_qdisc/d' /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control = bbr" >>/etc/sysctl.conf
echo "net.core.default_qdisc = fq" >>/etc/sysctl.conf
sysctl -p >/dev/null 2>&1

2、安装xray

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

3、生成x25519公钥和私钥

xray x25519

4、生成uuid

xray uuid

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

{ // VLESS + Reality
  "log": {
    "loglevel": "warning"
  },
  "inbounds": [
    {
      "listen": "0.0.0.0",
      "port": 443,    // 可更改
      "protocol": "vless",
      "settings": {
        "clients": [
          {
            "id": "你的UUID",    // ***改这里
            "flow": "xtls-rprx-vision"
          }
        ],
        "decryption": "none"
      },
      "streamSettings": {
        "network": "tcp",
        "security": "reality",
        "realitySettings": {
          "show": false,
          "dest": "你喜欢的网站:443",    // ***如 learn.microsoft.com:443
          "xver": 0,
          "serverNames": ["你喜欢的网站"],    //***如 learn.microsoft.com
          "privateKey": "你的**私钥**",    // ***改这里
          "shortIds": [""]    // 可以留空
        }
      },
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "tag": "direct"
    },
    {
      "protocol": "blackhole",
      "tag": "block"
    }
  ],
  "dns": {
    "servers": [
      "8.8.8.8",
      "1.1.1.1",
      "2001:4860:4860::8888",
      "2606:4700:4700::1111",
      "localhost"
    ]
  },
  "routing": {
    "domainStrategy": "IPIfNonMatch",
    "rules": [
      {
        "type": "field",
        "ip": ["geoip:private"],
        "outboundTag": "block"
      }
    ]
  }
}

6、重启xray

service xray restart

alpine

1、开启bbr

sed -i '/net.ipv4.tcp_congestion_control/d' /etc/sysctl.conf
sed -i '/net.core.default_qdisc/d' /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control = bbr" >>/etc/sysctl.conf
echo "net.core.default_qdisc = fq" >>/etc/sysctl.conf
sysctl -p >/dev/null 2>&1

2、安装依赖

apk update
apk add bash curl wget unzip ca-certificates tzdata

3、安装xray

# 创建目录
mkdir -p /usr/local/bin /usr/local/etc/xray

# 下载并解压最新版 Xray
wget https://github.com/XTLS/Xray-core/releases/latest/download/Xray-linux-64.zip
unzip Xray-linux-64.zip xray -d /usr/local/bin/

# 赋予执行权限并清理压缩包
chmod +x /usr/local/bin/xray
rm Xray-linux-64.zip

4、生成公私钥、uuid

xray x25519
xray uuid

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

{ // VLESS + Reality
  "log": {
    "loglevel": "warning"
  },
  "inbounds": [
    {
      "listen": "0.0.0.0",
      "port": 443,    // 可更改
      "protocol": "vless",
      "settings": {
        "clients": [
          {
            "id": "你的UUID",    // ***改这里
            "flow": "xtls-rprx-vision"
          }
        ],
        "decryption": "none"
      },
      "streamSettings": {
        "network": "tcp",
        "security": "reality",
        "realitySettings": {
          "show": false,
          "dest": "你喜欢的网站:443",    // ***如 learn.microsoft.com:443
          "xver": 0,
          "serverNames": ["你喜欢的网站"],    //***如 learn.microsoft.com
          "privateKey": "你的**私钥**",    // ***改这里
          "shortIds": [""]    // 可以留空
        }
      },
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "tag": "direct"
    },
    {
      "protocol": "blackhole",
      "tag": "block"
    }
  ],
  "dns": {
    "servers": [
      "8.8.8.8",
      "1.1.1.1",
      "2001:4860:4860::8888",
      "2606:4700:4700::1111",
      "localhost"
    ]
  },
  "routing": {
    "domainStrategy": "IPIfNonMatch",
    "rules": [
      {
        "type": "field",
        "ip": ["geoip:private"],
        "outboundTag": "block"
      }
    ]
  }
}

6、编写OpenRC守护进程

cat << 'EOF' > /etc/init.d/xray
#!/sbin/openrc-run

name="xray"
description="Xray Core Service"
command="/usr/local/bin/xray"
command_args="run -config /usr/local/etc/xray/config.json"
command_background="yes"
pidfile="/run/${name}.pid"
output_log="/var/log/xray.log"
error_log="/var/log/xray.err"

depend() {
    need net
}
EOF

7、启动并设置开机自启,下载规则并重启

# 赋予脚本执行权限
chmod +x /etc/init.d/xray

# 设置开机自启
rc-update add xray default
cd /usr/local/bin/ && \
wget -O geoip.dat https://github.com/v2fly/geoip/releases/latest/download/geoip.dat && \
wget -O geosite.dat https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat && \
rc-service xray restart

shortid可空

# 启动服务
rc-service xray start

# 查看运行状态
rc-service xray status

#查看xray报错
/usr/local/bin/xray run -config /usr/local/etc/xray/config.json

四个推荐的 dest 站点

站点

dest填写值

TLS1.3

全球CDN

Microsoft learn

learn.microsoft.com:443

Azure CDN

Microsoft

www.microsoft.com:443

Azure CDN

Apple

www.apple.com:443

Akamai CDN

Cloudflare

www.cloudflare.com:443

Cloudflare CDN


0
  • 0

评论区