1. OpenWRT设置

OpenWRT 路由器 lan 使用和网关同一 ip 段的静态 ip, 如主网关为 192.168.1.1, OpenWRT lan ip 设置为 192.168.1.2 .

网关和DNS设置为 192.168.1.1 .

禁用 OpenWRT lan 口的 DHCP Server .

OpenWRT 防火墙取消勾选 Enable SYN-flood protection .

2. 下载Hysteria

下载对应的 Hysteria 执行文件, https://github.com/apernet/hysteria/releases/latest

hysteria config.json 添加 tproxy : 注意端口冒号!!!

"tproxy_tcp": {
  "listen": ":60080",
  "timeout": 300
},
"tproxy_udp": {
  "listen": ":60080",
  "timeout": 300
}

3. 部署Hysteria Client Service

编辑 Hysteriainitd 文件:

vi /etc/init.d/hysteria

"""
#!/bin/sh /etc/rc.common

USE_PROCD=1

START=99
STOP=01

DAEMON=main

start_service() {
echo "start hysteria service!"
procd_open_instance hysteria
procd_set_param command /usr/bin/hysteria client --config /root/hysteria/config.json '&'
procd_set_param respawn 3600 5 10
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}

stop_service() {
echo "stop hysteria service!"
killall $DAEMON
}

reload_service() {
stop
start
}

restart() {
stop
start
}
"""

chmod +x /etc/init.d/hysteria

Hysteria 自启动:

/etc/init.d/hysteria enable
/etc/init.d/hysteria start

4. 配置iptables

配置 Proxy 并下载 iptables :