小米 AX3000T 设置静态路由,通过旁路由 N1 的 WireGuard 连接到家庭内网(192.168.200.0/24)
一、解锁 SSH
Xiaomi 路由器 AX3000T MiWiFi 稳定版 1.0.90,无法使用原 1.0.64 的方法解锁 SSH,获取 stock 后,在 cmd 输入以下指令。
C:\Windows\System32>curl -X POST http://192.168.100.1/cgi-bin/luci/;stok=c2a9821dbfde2be9388310b6f4952830/api/xqsystem/start_binding -d "uid=1234&key=1234'%0Anvram%20set%20ssh_en%3D1'"
C:\Windows\System32>curl -X POST http://192.168.100.1/cgi-bin/luci/;stok=c2a9821dbfde2be9388310b6f4952830/api/xqsystem/start_binding -d "uid=1234&key=1234'%0Anvram%20commit'"
C:\Windows\System32>curl -X POST http://192.168.100.1/cgi-bin/luci/;stok=c2a9821dbfde2be9388310b6f4952830/api/xqsystem/start_binding -d "uid=1234&key=1234'%0Ased%20-i%20's%2Fchannel%3D.*%2Fchannel%3D%22debug%22%2Fg'%20%2Fetc%2Finit.d%2Fdropbear'"
C:\Windows\System32>curl -X POST http://192.168.100.1/cgi-bin/luci/;stok=c2a9821dbfde2be9388310b6f4952830/api/xqsystem/start_binding -d "uid=1234&key=1234'%0A%2Fetc%2Finit.d%2Fdropbear%20start'"
收到 {"hw":"RD03","sync":false,"code":0,"rtid":"09511b1f-a913-7721-aaec-f6c8462f0cc3","did":"935418484"}
说明成功了。
二、获取登录密码
先得通过 SN 计算才能得出,SN 在下图中,画框中的全部复制。通过这个 https://miwifi.dev/ssh 网址输入 SN 就能得出。我的路由器是 95c754e2
三、增加静态路由
# 使用route指令增加静态路由
route add -net 192.168.200.0 netmask 255.255.255.0 gw 192.168.100.2
# 检查路由是否正常
ping 192.168.200.100
PING 192.168.200.100 (192.168.200.100): 56 data bytes
64 bytes from 192.168.200.100: seq=0 ttl=62 time=7.495 ms
64 bytes from 192.168.200.100: seq=1 ttl=62 time=7.009 ms
--- 192.168.200.100 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 7.009/7.252/7.495 ms
四、放通防火墙
虽然此时路由器及其以下的设备能 ping 通,但是用到具体服务的时候比如 ssh/xrdp,路由器下的设备还是不能够成功连接。其实是小米路由器防火墙的问题。此时需要修改 /etc/config/firewall
,把转发 REJECT
改成 ACCEPT
;同时把 config defaults
中的 option drop_invalid
改为 0。修改完成后运行 /etc/init.d/firewall restarts
重启防火墙。
config defaults
#temp disable syn_flood proctect.
option syn_flood 0
option input ACCEPT
option output ACCEPT
option forward ACCEPT # 原值为 REJECT
option drop_invalid 0 # 原值为 1
# Uncomment this line to disable ipv6 rules
option disable_ipv6 0
option fw_enable '1'
option port_trigger '1'
五、重启保存配置
5.1 使用 rc.local
网上提供的编辑 /etc/rc.local
文件,在每次启动是配置静态路由
route add -net 192.168.200.0/24 gw 192.168.100.2
新的版本会自动清除文件,无法保持配置。
5.2 定时任务
在 crontab 里面增加任务,每两分钟下发静态路由
crontab -e
# 每两分钟下发静态路由
*/2 * * * * route add -net 192.168.200.0/24 gw 192.168.100.2
route
# 验证路由下发
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 112.115.17.1 0.0.0.0 UG 0 0 0 pppoe-wan
112.115.17.1 * 255.255.255.255 UH 0 0 0 pppoe-wan
192.168.32.0 * 255.255.255.0 U 0 0 0 br-miot
192.168.100.0 * 255.255.255.0 U 0 0 0 br-lan
192.168.200.0 192.168.100.2 255.255.255.0 UG 0 0 0 br-lan
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于