本帖最后由 sandylaw 于 2023-11-24 11:22 编辑
Redmi AX6000 Openwrt准备工作小米路由官方修复工具红米AX6000 RB06官方固件 网线接路由器和电脑,路由器断电,电脑退出杀毒软件,还有Windows的自带Windows Defender防火墙杀毒,关闭电脑防火墙,解压并打开小米路由修复工具,选择官方的rb06固件,网卡选择当前连接路由器的网卡,点下一步,工具会自动配置网卡IP为192.168.31.100/24,配置好后会显示刷机步骤,然后按住路由器RESET插电开机,大概12秒后等到黄灯闪烁后可以松开RESET,等待小米路由修复工具连接路由器开始上传固件,上传完后会刷机,刷机成功后蓝灯闪烁。等待10秒后重新断电插电即可恢复到官方系统。点击退出小米路由修复工具,网卡会自动恢复自动获取的配置。
踩坑1: 杀毒关了,防火墙没关,上传固件的界面不会弹出来,我也不知道怎么回事,没有任何提示,防火墙关掉后才会弹出传输固件的弹窗。
踩坑2:小米路由出厂固件开机,设置上网方式,我选择了wifi中继模式,结果后面的开启ssh的命令就是不生效,恢复到了dhcp或者拨号模式后,ip是192.168.31.1才可以。
获取token登陆小米路由器admin,浏览器地址栏stok=后面部分就是token, 这个token是每次登录都会变化,后面都会用到这个token。如果重新登录后,都要重新复制这个token. 开启开发者模式更改路由器的crash分区,使其进入到开发者模式 将下面的URL里面的stok=token的token替换成上面获取路由器的token值,然后复制到到浏览器并且按enter打开 - http://192.168.31.1/cgi-bin/luci/;stok=token/api/misystem/set_sys_time?timezone=%20%27%20%3B%20zz%3D%24%28dd%20if%3D%2Fdev%2Fzero%20bs%3D1%20count%3D2%202%3E%2Fdev%2Fnull%29%20%3B%20printf%20%27%A5%5A%25c%25c%27%20%24zz%20%24zz%20%7C%20mtd%20write%20-%20crash%20%3B%20
复制代码
浏览器返回{“code”:0},表示成功。 通过浏览器重启路由器 在浏览器地址栏输入下面的url, 和上面的做法一样,将stok=token的token替换成上面获取路由器的token值 - http://192.168.31.1/cgi-bin/luci/;stok=token/api/misystem/set_sys_time?timezone=%20%27%20%3b%20reboot%20%3b%20
复制代码
设置Bdata参数设置参数telnet_en、 ssh_en、uart_en 重启后,要重新获取token, 然后在浏览器地址栏输入下面的url, 将stok=token的token替换成上面获取路由器的token值 - http://192.168.31.1/cgi-bin/luci/;stok=token/api/misystem/set_sys_time?timezone=%20%27%20%3B%20bdata%20set%20telnet_en%3D1%20%3B%20bdata%20set%20ssh_en%3D1%20%3B%20bdata%20set%20uart_en%3D1%20%3B%20bdata%20commit%20%3B%20
复制代码
重启路由器在浏览器地址栏输入下面的url, 和上面的做法一样,将stok=token的token替换成上面获取路由器的token值 - http://192.168.31.1/cgi-bin/luci/;stok=token/api/misystem/set_sys_time?timezone=%20%27%20%3b%20reboot%20%3b%20
复制代码
通过telnet开启ssh在终端输入telnet 192.168.31.1, 可以看到Are you ok的界面,就证明telnet成功了。 telnet连接上,输入指令开启ssh并修改密码为admin: - bdata set boot_wait=on
- bdata commit
- nvram set ssh_en=1
- nvram set telnet_en=1
- nvram set uart_en=1
- nvram set boot_wait=on
- nvram commit
- sed -i 's/channel=.*/channel="debug"/g' /etc/init.d/dropbear
- /etc/init.d/dropbear restart
- echo -e 'admin\nadmin' | passwd root
复制代码
永久开启ssh开启新窗口,使用ssh登录路由器,输入指令开启ssh并修改密码为admin: ssh root@192.168.31.1不过ssh登录的时候如果报下面的错误no matching host key type found. Their offer: ssh-rsa, 是因为OpenSSH 7.0以后的版本不再支持ssh-rsa (RSA)算法, 解决方法是手动加上 - # vi ~/.ssh/config
- Host redmi
- HostName 192.168.31.1
- User root
- Port 22
- HostKeyAlgorithms +ssh-rsa
- PubkeyAcceptedKeyTypes +ssh-rsa
复制代码
或者 - # ssh -oHostKeyAlgorithms=+ssh-rsa <a href="mailto:root@192.168.31.1">root@192.168.31.1</a>
复制代码
从telnet开启的ssh,路由器重启会失效,添加一个开启自动运行的脚本,来实现自动开启ssh。如果恢复出厂设置或重新刷机后需要重新添加. - mkdir /data/auto_ssh && cd /data/auto_ssh
- touch auto_ssh.sh
- chmod +x auto_ssh.sh
复制代码
创建auto_ssh.sh文件,使用vi输入下面的内容并保存 - uci set firewall.auto_ssh=include
- uci set firewall.auto_ssh.type='script'
- uci set firewall.auto_ssh.path='/data/auto_ssh/auto_ssh.sh'
- uci set firewall.auto_ssh.enabled='1'
- uci commit firewall
复制代码
关闭开发者模式ssh连接上路由器后,输入指令关闭开发者模式
修复时区异常如果路由器时区异常,ssh连接中路由器后, 输入指令修复时区异常 - uci set system.@system[0].timezone='CST-8'
- uci set system.@system[0].webtimezone='CST-8'
- uci set system.@system[0].timezoneindex='2.84'
- uci commit
复制代码
刷hanwckf大佬的不死uboot查看FIP在哪个分区,有的非官方固件在分区4,官方固件在分区5;一定要看好自己的
刷不死uboot后不支持小米官方救砖工具,需要刷回原厂FIP分区后,才能用小米救砖工具刷回官方固件。
从hanwckf大佬的不死uboot刷回官方原理参考红米AX6刷回官方固件,就是把uboot还原回原厂uboot(因为没有刷分区表文件,所以没有刷回原厂分区表操作),再用官方修复工具恢复官方固件。目前只知道237大佬和hanwckf大佬的闭源OP是已解锁FIP的,可以直接刷uboot,如果当前固件不能刷FIP分区,请先刷回闭源OP,再刷回原厂uboot。建议使用自己机子的FIP备份,其他的我没试过。将自己的原厂FIP备份文件,如mtd5_FIP.bin,上传到tmp文件夹下,然后解锁FIP分区的固件下输入命令刷入: - md5sum /tmp/mtd5_FIP.bin
- mtd write /tmp/mtd5_FIP.bin FIP
- mtd verify /tmp/mtd5_FIP.bin FIP
复制代码
注意:写入FIP分区时不能断电、重启,不然就直接变砖,只能上编程器了。这里和刷不死uboot一样,使用md5sum检查上传到tmp文件夹的原厂uboot文件的md5值和你保存的是否一样,无误后用mtd write将原厂uboot文件写入FIP分区,再用mtd verify对比检查原厂uboot文件是否已写入FIP分区。注意mtd命令最后的FIP是大写。 对比检查最后输出“Success"说明刷入已成功,可以断电路由器,然后打开小米路由官方修复工具进行修复了。
常用软件配置open克拉什https://github.com/zerolabnet/open克拉什
这个版本 没有 kmod-inet-diag 依赖,适用于使用存储库 kmod-inet-diag 中没有的版本的用户。 - opkg update
- opkg install dnsmasq-full --download-only && opkg remove dnsmasq && opkg install dnsmasq-full --cache . && rm *.ipk
- opkg install wget-ssl coreutils-nohup bash iptables curl ca-certificates ipset ip-full iptables-mod-tproxy iptables-mod-extra libcap libcap-bin ruby ruby-yaml kmod-tun unzip luci-compat
- cd /tmp
- wget <a href="https://github.com/zerolabnet/open克拉什/releases/download/v0.45.121-beta/luci-app-open克拉什_0.45.121-beta_all.ipk" target="_blank">https://github.com/zerolabnet/op ... 45.121-beta_all.ipk</a>
- opkg install luci-app-open克拉什_0.45.121-beta_all.ipk
- reboot
复制代码
下载mesh内核
解压后的文件较大,使用upx压缩。 upx可以有效地对可执行文件进行压缩,并且压缩后的文件可以直接由系统执行,支持多系统和平台。 使用 UPX 来压缩可执行文件是一种减少发布包大小的有效方式。 upx 对文件的默认操作即为压缩,使用上述命令会使用默认参数压缩并替换文件 yourfile。 upx 支持如下可选参数: --best:最高压缩级别 --brute:尝试使用各种压缩方式来获取最高压缩比 --ultra-brute:尝试使用更多的参数来获取更高的压缩比 -o [file]:将压缩文件保存为 [file]
将压缩后的clash_meta传输到/etc/open克拉什/core/clash_meta
配置open克拉什,订阅一个,并启动。 Adguard home- opkg install luci-app-adguardhome_1.8-11_all.ipk
- reboot
复制代码
- filters:
- - enabled: true
- url: <a href="https://adguardteam.github.io/HostlistsRegistry/assets/filter_1.txt" target="_blank">https://adguardteam.github.io/Ho ... assets/filter_1.txt</a>
- name: AdGuard DNS filter
- id: 1
- - enabled: false
- url: <a href="https://adguardteam.github.io/HostlistsRegistry/assets/filter_2.txt" target="_blank">https://adguardteam.github.io/Ho ... assets/filter_2.txt</a>
- name: AdAway Default Blocklist
- id: 2
- - enabled: true
- url: <a href="https://ghproxy.com/https://raw.githubusercontent.com/217heidai/adblockfilters/main/rules/EasyList.txt" target="_blank">https://ghproxy.com/https://raw. ... /rules/EasyList.txt</a>
- name: EasyList
- id: 1700569140
- - enabled: true
- url: <a href="https://ghproxy.com/https://raw.githubusercontent.com/217heidai/adblockfilters/main/rules/EasyList_China.txt" target="_blank">https://ghproxy.com/https://raw. ... /EasyList_China.txt</a>
- name: EasyList China
- id: 1700569141
- - enabled: true
- url: <a href="https://ghproxy.com/https://raw.githubusercontent.com/217heidai/adblockfilters/main/rules/EasyPrivacy.txt" target="_blank">https://ghproxy.com/https://raw. ... les/EasyPrivacy.txt</a>
- name: EasyPrivacy
- id: 1700569142
- - enabled: true
- url: [url]https://ghproxy.com/https://raw.githubusercontent.com/217heidai/adblockfilters/main/rules/CJX's_Annoyance_List.txt[/url]
- name: CJX's Annoyance List
- id: 1700569144
- - enabled: true
- url: <a href="https://ghproxy.com/https://raw.githubusercontent.com/217heidai/adblockfilters/main/rules/SmartTV_Blocklist.txt" target="_blank">https://ghproxy.com/https://raw. ... artTV_Blocklist.txt</a>
- name: SmartTV Blocklist
- id: 1700569145
- - enabled: true
- url: <a href="https://ghproxy.com/https://raw.githubusercontent.com/217heidai/adblockfilters/main/rules/1Hosts_" target="_blank">https://ghproxy.com/https://raw. ... /main/rules/1Hosts_</a>(Lite).txt
- name: 1Hosts (Lite)
- id: 1700569146
复制代码
AdguardHome + open克拉什 配合使用
整体思路:客户端-->dnsmasq-->AdguardHome-->open克拉什-->互联网
- chmod 755 /etc/init.d/AdGuardHome
- service AdGuardHome restart
复制代码- 访问路由器ip:3000/install.html进行向导安装配置,举例设定:网页端口3000,dns端口5353。
OP设置:
禁用 本地DNS劫持 自定义上游DNS服务器 启用 Fallback-Filter 启用 dns服务器默认的即可
Adg设置:
- filters:
- - enabled: true
- url: <a href="https://adguardteam.github.io/HostlistsRegistry/assets/filter_1.txt" target="_blank">https://adguardteam.github.io/Ho ... assets/filter_1.txt</a>
- name: AdGuard DNS filter
- id: 1
- - enabled: false
- url: <a href="https://adguardteam.github.io/HostlistsRegistry/assets/filter_2.txt" target="_blank">https://adguardteam.github.io/Ho ... assets/filter_2.txt</a>
- name: AdAway Default Blocklist
- id: 2
- - enabled: true
- url: <a href="https://ghproxy.com/https://raw.githubusercontent.com/217heidai/adblockfilters/main/rules/EasyList.txt" target="_blank">https://ghproxy.com/https://raw. ... /rules/EasyList.txt</a>
- name: EasyList
- id: 1700569140
- - enabled: true
- url: <a href="https://ghproxy.com/https://raw.githubusercontent.com/217heidai/adblockfilters/main/rules/EasyList_China.txt" target="_blank">https://ghproxy.com/https://raw. ... /EasyList_China.txt</a>
- name: EasyList China
- id: 1700569141
- - enabled: true
- url: <a href="https://ghproxy.com/https://raw.githubusercontent.com/217heidai/adblockfilters/main/rules/EasyPrivacy.txt" target="_blank">https://ghproxy.com/https://raw. ... les/EasyPrivacy.txt</a>
- name: EasyPrivacy
- id: 1700569142
- - enabled: true
- url: [url]https://ghproxy.com/https://raw.githubusercontent.com/217heidai/adblockfilters/main/rules/CJX's_Annoyance_List.txt[/url]
- name: CJX's Annoyance List
- id: 1700569144
- - enabled: true
- url: <a href="https://ghproxy.com/https://raw.githubusercontent.com/217heidai/adblockfilters/main/rules/SmartTV_Blocklist.txt" target="_blank">https://ghproxy.com/https://raw. ... artTV_Blocklist.txt</a>
- name: SmartTV Blocklist
- id: 1700569145
- - enabled: true
- url: <a href="https://ghproxy.com/https://raw.githubusercontent.com/217heidai/adblockfilters/main/rules/1Hosts_" target="_blank">https://ghproxy.com/https://raw. ... /main/rules/1Hosts_</a>(Lite).txt
- name: 1Hosts (Lite)
- id: 1700569146
复制代码
确认网络设置: DHCP/DNS--> DNS 转发-->odg的dns端口,例如:127.0.0.1#5353
|