2026年 搭建 – Hysteria2
官方主页:
https://v2.hysteria.network/zh/
安装脚本
bash <(curl -fsSL https://get.hy2.sh/)
卸载脚本
bash <(curl -fsSL https://get.hy2.sh/) –remove
重启服务
systemctl restart hysteria-server.service
设置开机自启, 并立即启动服务
systemctl enable –now hysteria-server.service
查询服务状态
systemctl status hysteria-server.service
日志
journalctl --no-pager -e -u hysteria-server.service
服务端 – 配置
# 服务端配置
# nano /etc/hysteria/config.yaml
# 监听地址
listen: :443
# 可以选择使用 `tls` 或 `acme`,但不能同时包含两者。
tls:
cert: /etc/hysteria/server.crt
key: /etc/hysteria/server.key
sniGuard: strict | disable | dns-san
auth:
type: password
password: Se7RAuFZ8Lzg
# 混淆:配置文件中加入如下
obfs:
type: salamander
salamander:
password: Se7RA2aduFsdfa123Z8Lzg #修改为自己的密码
# 拥塞控制算法 (Brutal)
服务端 – 自签证书
openssl req -x509 -nodes -newkey ec:<(openssl ecparam -name prime256v1) -keyout /etc/hysteria/server.key -out /etc/hysteria/server.crt -subj "/CN=bing.com" -days 36500
sudo chown hysteria /etc/hysteria/server.key
sudo chown hysteria /etc/hysteria/server.crt
服务端 – 端口跳跃
# IPv4
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 20000:50000 -j REDIRECT --to-ports 443
# IPv6
ip6tables -t nat -A PREROUTING -i eth0 -p udp --dport 20000:50000 -j REDIRECT --to-ports 443
# 端口转发的命令清空
iptables -F
客户端 – 配置
# 客户端配置
server: your.domain.net:443
auth: Se7RAuFZ8Lzg
# Hysteria 内置了两套拥塞控制算法(BBR 与 Brutal)
# bandwidth:
# up: 500 mbps
# down: 500 mbps
tls:
sni: another.example.com
insecure: false
pinSHA256: BA:88:45:17:A1...
ca: custom_ca.crt
# 混淆
# 默认 Hysteria 协议伪装为 HTTP/3。如果你的网络针对性屏蔽了 QUIC 或 HTTP/3 流量(但允许其他 UDP 流量),可以使用混淆来解决此问题。
obfs:
type: salamander
salamander:
password: cry_me_a_r1ver
# 客户端将随机选择一个端口进行初始连接,并定期随机跳跃到另一个端口
# 用于控制时间间隔的选项是 `transport` 部分中的 `hopInterval`:
transport:
udp:
hopInterval: 30s
fastOpen: true
socks5:
listen: 127.0.0.1:1080
http:
listen: 127.0.0.1:8080
📌 版权声明
文章作者:大神K
原文链接:https://dashenk.com/2026/04/30/2026%e5%b9%b4-%e6%90%ad%e5%bb%ba-hysteria2/
版权说明:本文为原创内容,转载请注明出处。