XuLaLa.Tech

首页客户端下载Windows 使用V2Ray 教程SSR 教程Clash 教程

hysteria2 协议介绍及如何配置教程

2025.04.17

Hysteria2,歇斯底里,是一款由go编写的网络优化工具,通过魔改的 QUIC 协议驱动,Hysteria 即使在最不稳定和容易丢包的网络环境中也能提供无与伦比的性能。

基于UDP协议,针对线路拉跨的VPS,可以优化速度。

Linux 服务端 安装 Hysteria 2

# 安装或升级 Hysteria

bash <(curl -fsSL https://get.hy2.sh/)

# 移除 Hysteria

# bash <(curl -fsSL https://get.hy2.sh/) --remove

systemctl enable hysteria-server # 开机自启

systemctl restart hysteria-server # 重启服务

配置 Hyteria 2

配置文件地址: /etc/hysteria/config.yaml

例子端口/密码/伪装 建议自己按需求修改

listen: :30000 # 监听端口

auth:

type: userpass

userpass:

aaa: bbb # 用户名:密码, 客户端使用时 password 填写: aaa:bbb

masquerade: # 伪装

type: proxy

proxy:

url: https://www.bing.com/

rewriteHost: true

# 证书 (acme 和 tls 二选一), tls自定义证书 应该是最简单的方案

tls: {cert: /etc/hysteria/cert.pem, key: /etc/hysteria/private.key} # 自定义证书

# acme: {domains: [yourDdns.com], email: [email protected]} # 使用acme.sh自动申请证书

生成自定义证书(自签名证书),这里拿 bing.com 举例

openssl req -x509 -nodes -newkey ec:<(openssl ecparam -name prime256v1) -keyout /etc/hysteria/private.key -out /etc/hysteria/cert.pem -subj "/CN=bing.com" -days 36500;

chmod 777 /etc/hysteria/private.key;

重启服务

systemctl restart hysteria-server;

客户端配置

举例,限速 150M,伪装 bing.com, 跳过证书验证

# Clash

- {name: VPS1, server: x.x.x.x, type: hysteria2, port: 30000, password: aaa:bbb, sni: bing.com, skip-cert-verify: true, down: "150", up: "30"}

# Surge

VPS1 = hysteria2, x.x.x.x, 30000, password=aaa:bbb, skip-cert-verify=true, sni=bing.com, download-bandwidth=150

其他信息

journalctl -u hysteria-server --output cat -f # 查看日志

systemctl status hysteria-server # 查看状态

# apt install -y netcat-openbsd # Debian/Ubuntu 安装nc

# yum install -y nmap-ncat # CentOS 安装nc

nc -vz x.x.x.x 30000 -u # 测试Hysteria端口是否通

Hysteria2 比 Hysteria1 增加了很多功能,使用也更方便,针对拉跨的线路,优化速度效果不错,延迟也比较低(相对一些tcp的协议)。IPLC线路效果可能不明显,有时可能还不如tcp协议.建议根据情况, 自行限速。

© 2010-2022 XuLaLa 保留所有权利 本站由 WordPress 强力驱动
请求次数:69 次,加载用时:0.665 秒,内存占用:32.19 MB