洋芋笔记

我自己用的hy2配置(包含端口跳跃)

  1. 安装hy2

    sudo apt-get update
    sudo apt-get install -y curl unzip wget && bash <(curl -fsSL https://get.hy2.sh/) && systemctl enable --now hysteria-server.service
  2. 我自己用的配置文件

    cd /etc/hysteria && wget https://blog.0112233.xyz/hy2.zip && unzip -o hy2.zip
  3. 安装nftables

    sudo apt-get install -y nftables && sudo systemctl enable nftables
  4. 配置端口转发,从而实现端口跳跃

    • nftables 默认配置文件地址
    /etc/nftables.conf
    • 把内容替换成这个

    是将40000-50000端口的UDP流量转发到9443

    #!/usr/sbin/nft -f
    
    flush ruleset
    
    define INGRESS_INTERFACE="eth0"
    define PORT_RANGE=40000-50000
    define HYSTERIA_SERVER_PORT=9443
    
    table inet hysteria_porthopping {
      chain prerouting {
     type nat hook prerouting priority dstnat; policy accept;
     iifname $INGRESS_INTERFACE udp dport $PORT_RANGE counter redirect to :$HYSTERIA_SERVER_PORT
      }
    }