本文最后更新于 2024-09-30,文章内容可能已经过时。

注意:本文只做技术交流

一、准备一个VPS服务器

二、下载搭建工具

FinalShell下载
Windows X64版,下载地址:
https://dl.hostbuf.com/finalshell3/finalshell_windows_x64.exe


macOS Arm版,支持m1,m2,m3 cpu,下载地址:

https://dl.hostbuf.com/finalshell3/finalshell_macos_arm64.pkg


macOS X64版,支持旧款intel cpu,下载地址:

https://dl.hostbuf.com/finalshell3/finalshell_macos_x64.pkg

三、更新 VPS 系统

apt update -y
apt install curl sudo -y

四、Hysteria 2 一键搭建代码

wget -N --no-check-certificate https://raw.githubusercontent.com/flame1ce/hysteria2-install/main/hysteria2-install-main/hy2/hysteria.sh && bash hysteria.sh

五、Hysteria 服务相关命令

systemctl start hysteria-server.service    # 启动 hysteria 服务
systemctl enable hysteria-server.service   # 设置 hysteria 服务 开机自启动
systemctl restart hysteria-server.service  # 重启 hysteria 服务
systemctl stop hysteria-server.service     # 停止 hysteria 服务
systemctl status hysteria-server.service   # 查看 hysteria 服务 状态

六、Hysteria客户端配置

七、sing-box 配置文件

{
  "dns": {
    "servers": [
      {
        "tag": "cf",
        "address": "https://1.1.1.1/dns-query"
      },
      {
        "tag": "local",
        "address": "223.5.5.5",
        "detour": "direct"
      },
      {
        "tag": "block",
        "address": "rcode://success"
      }
    ],
    "rules": [
      {
        "geosite": "category-ads-all",
        "server": "block",
        "disable_cache": true
      },
      {
        "outbound": "any",
        "server": "local"
      },
      {
        "geosite": "cn",
        "server": "local"
      }
    ],
    "strategy": "ipv4_only"
  },
  "inbounds": [
    {
      "type": "tun",
      "inet4_address": "172.19.0.1/30",
      "auto_route": true,
      "strict_route": false,
      "sniff": true
    }
  ],
  "outbounds": [
    {
      "type": "hysteria2",
      "tag": "proxy",
      "server": "IP",             // VPS IP
      "server_port": 443,         // 端口
      "up_mbps": 30,              //上传速率,按本地速度填写
      "down_mbps": 100,           //下载速率,按本地速度填写
      "password": "88888888",     //hysteria2 服务密码
      "tls": {
        "enabled": true,
        "server_name": "www.bing.com",
        "insecure": true              
      }
    },
    {
      "type": "direct",
      "tag": "direct"
    },
    {
      "type": "block",
      "tag": "block"
    },
    {
      "type": "dns",
      "tag": "dns-out"
    }
  ],
  "route": {
    "rules": [
      {
        "protocol": "dns",
        "outbound": "dns-out"
      },
      {
        "geosite": "cn",
        "geoip": [
          "private",
          "cn"
        ],
        "outbound": "direct"
      },
      {
        "geosite": "category-ads-all",
        "outbound": "block"
      }
    ],
    "auto_detect_interface": true
  }
}

八、常见问题

  • 节点如果不能正常使用,请放行端口,请将以下命令复制到搭建工具,再点回车
    iptables -I INPUT -p tcp --dport 443 -j ACCEPT
    *请将 443 改为你节点的端口

  • 如果不能使用,请重新搭建一次