目标:
- 启动be7000的ssh并软固化(不考虑升级问题)
- 精细化配置ipv6防火墙,对内网特定mac的ipv6访问
针对目标1实际测试使用xmir-patcher可以解锁它的ssh.https://github.com/openwrt-xiaomi/xmir-patcher
- 运行run.sh
- 先使用1修改目标ip命令
- 然后使用2命令解开ssh
- 然后使用6命令
- 完成后就能够ssh连接小米
- 账号密码均为root:root,立即修改密码
软固化
mkdir /data/auto_ssh && cd /data/auto_ssh curl -O https://cdn.jsdelivr.net/gh/lemoeo/AX6S@main/auto_ssh.sh chmod +x auto_ssh.sh ./auto_ssh.sh install此部分参考https://www.right.com.cn/forum/forum.php?mod=viewthread&tid=8283638&extra=page%3D1&page=1
精细化配置ipv6防火墙,对内网特定mac的ipv6访问
默认使用cui来进行防火墙配置直接编辑文件/etc/config/firewall
以外网特定ping内网ip为例在文件中追加
config rule option name 'Allow_WAN_to_Specific_MAC_ICMPv6_Ping' option src 'wan' option dest 'lan' option proto 'ipv6-icmp' option icmp_type 'echo-request' option target 'ACCEPT' option family 'ipv6' option mac 'xx:xx:xx:xx:xx:xx'/etc/init.d/firewall restart实际测试外网ping没有问题
进行特定端口及mac地址的开放,使用Ip6tables方案
- 网上及ai生成的方法均有问题常见问题如下
- -m mac方案没有
--mac-destination选项,而ai幻觉有 - 使用-m u32方案,筛选数据包的字节,但给出方案都不生效,但抓包进行数据分析估计可以解决
- 使用-d方案,用具体mac转换为ip地址后64bit,大概率是固定的,但这里给出方案有问题-d::xxxx:xxxx:xxxx:xxxx/128,这里我想匹配后64,但这里的掩码数据含义为从左侧算有多少个1所以匹配有问题,参考官方文件可以改为-d::xxxx:xxxx:xxxx:xxxx/::FFFF:FFFF:FFFF:FFFF可以满足要求
ip6tables -I FORWARD 8 \ -i pppoe-wan -o br-lan \ -p tcp --dport 433 \ -m conntrack --ctstate NEW \ -d ::xxxx:xxxx:xxxx:xxxx/0000:0000:0000:0000:ffff:ffff:ffff:ffff \ -j ACCEPT查看规则是否生效
ip6tables -L FORWARD -n -v --line-numbers持久化
持久化遇到了比较多的问题,路由器下很多文件无法写入。
参考auto_ssh.sh脚本的方式,在data下新建ip6tables文件夹,建立firewall_tv.sh文件
#!/bin/shinstall() { # Add script to system autostart docker uci set firewall.startup_script=include uci set firewall.startup_script.type='script' uci set firewall.startup_script.path="/data/ip6tables/firewall_tv.sh" uci set firewall.startup_script.enabled='1' uci commit firewall echo -e "\033[32m startup_script complete. \033[0m"}uninstall() { # Remove scripts from system autostart uci delete firewall.firewall_tv.sh uci commit firewall echo -e "\033[33m startup_script has been removed. \033[0m"}
startup_script() { # Put your custom script here. echo "Starting custom scripts..." sleep 20 ip6tables -I FORWARD 8 -i pppoe-wan -o br-lan -p tcp --dport 433 -m conntrack --ctstate NEW -d ::xxxx:xxxx:xxxx:xxxx/0000:0000:0000:0000:ffff:ffff:ffff:ffff -j ACCEPT 2>/dev/null}
main() { [ -z "$1" ] && startup_script && return case "$1" in install) install ;; uninstall) uninstall ;; *) echo -e "\033[31m Unknown parameter: $1 \033[0m" return 1 ;; esac}
main "$@"chmod +x firewall_tv.sh./firewall_tv.sh install实际测试可以完成功能
目前打开了设备防火墙实际仍然禁止访问,但可以穿过路由器
后续考虑使用api将ipv6与阿里域名进行绑定,单开帖说明