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 .
下载对应的 Hysteria 执行文件, https://github.com/apernet/hysteria/releases/latest
为 hysteria config.json 添加 tproxy : 注意端口冒号!!!
"tproxy_tcp": {
"listen": ":60080",
"timeout": 300
},
"tproxy_udp": {
"listen": ":60080",
"timeout": 300
}
编辑 Hysteria 的 initd 文件:
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
配置 Proxy 并下载 iptables :