|
本帖最后由 le062 于 2021-1-2 20:31 编辑
因为想继续使用原装系统的游戏加速器功能,所以得搞一下。注意规则是加在指定Chain上面:- ip6tables -I forwarding_rule -p tcp --dport 1234 -j ACCEPT
- ip6tables -I forwarding_rule -p tcp --dport 5678 -j ACCEPT
复制代码 这两条命令会暴露路由器下端所有IPV6设备的1234,5678端口。风险自行评估。
开机自动开端口:
方法一
#vi /etc/rc.local- # Put your custom commands here that should be executed once
- # the system init finished. By default this file does nothing.
- ip6tables -I forwarding_rule -p tcp --dport 1234 -j ACCEPT
- ip6tables -I forwarding_rule -p tcp --dport 5678 -j ACCEPT
- exit 0
复制代码 长时间测试发现,此方法不能百分百保证端口被打开
方法二
#crontab -e
尾部增加定时检测命令:
- */5 * * * * ip6tables -L | grep "tcp dpt:ssh"; [ $? != 0 ] && echo "add port" && ip6tables -I forwarding_rule -p tcp --dport 22 -j ACCEPT
- */5 * * * * ip6tables -L | grep "tcp dpt:1234"; [ $? != 0 ] && echo "add port" && ip6tables -I forwarding_rule -p tcp --dport 1234 -j ACCEPT
- */5 * * * * ip6tables -L | grep "tcp dpt:5678"; [ $? != 0 ] && echo "add port" && ip6tables -I forwarding_rule -p tcp --dport 5678 -j ACCEPT
复制代码 需要注意的是,22端口开启后,iptables中显示的是ssh,所以判定字符串是 "tcp dpt:ssh"
补充说明:
注意到此命令对非AC2100的小米路由器也有效,比如AX5,AX3600。
|
评分
-
查看全部评分
|