下载小米路由器R1CL开发版
通过手动上传更新,更改固件版本
将之前地址栏URL中的 /web/home#router 替换为(密码为admin)
/api/xqsystem/set_name_password?oldPwd=123456789&newPwd=admin
如果网页返回 {“code”:0} ,则说明修改成功。
将之前地址栏URL中的
/web/home#router 替换为/api/xqnetwork/set_wifi_ap?ssid=xiaomi&encryption=NONE&enctype=NONE&channel=1%3B%2Fusr%2Fsbin%2Ftelnetd
如果网页返回 {“msg”:“未能连接到指定WiFi(Probe timeout)”,“code”:1616},则说明修改成功
先通过telnet登录,账号:root 密码:admin
sed -i ":x;N;s/if \[.*\; then\n.*return 0\n.*fi/#tb/;b x" /etc/init.d/dropbear
/etc/init.d/dropbear start
nvram set ssh_en=1; nvram commit
执行完,就可以通过ssh登录路由器了
备份
cd /tmp
mkdir rom
dd if=/dev/mtd0 of=/tmp/rom/ALL.bin
dd if=/dev/mtd1 of=/tmp/rom/Bootloader.bin
dd if=/dev/mtd2 of=/tmp/rom/Config.bin
dd if=/dev/mtd3 of=/tmp/rom/Factory.bin
dd if=/dev/mtd4 of=/tmp/rom/OS1.bin
dd if=/dev/mtd5 of=/tmp/rom/rootfs.bin
dd if=/dev/mtd6 of=/tmp/rom/OS2.bin
dd if=/dev/mtd7 of=/tmp/rom/overlay.bin
dd if=/dev/mtd8 of=/tmp/rom/crash.bin
dd if=/dev/mtd9 of=/tmp/rom/reserved.bin
dd if=/dev/mtd10 of=/tmp/rom/Bdata.bin
执行的输出:
32768+0 records in
32768+0 records out
root@XiaoQiang:/tmp# dd if=/dev/mtd1 of=/tmp/rom/Bootloader.bin
384+0 records in
384+0 records out
root@XiaoQiang:/tmp# dd if=/dev/mtd2 of=/tmp/rom/Config.bin
128+0 records in
128+0 records out
root@XiaoQiang:/tmp# dd if=/dev/mtd3 of=/tmp/rom/Factory.bin
128+0 records in
128+0 records out
root@XiaoQiang:/tmp# dd if=/dev/mtd4 of=/tmp/rom/OS1.bin
dd: writing '/tmp/rom/OS1.bin': No space left on device
23801+0 records in
23800+0 records out
root@XiaoQiang:/tmp# dd if=/dev/mtd5 of=/tmp/rom/rootfs.bin
dd: writing '/tmp/rom/rootfs.bin': No space left on device
1+0 records in
0+0 records out
root@XiaoQiang:/tmp# dd if=/dev/mtd6 of=/tmp/rom/OS2.bin
dd: writing '/tmp/rom/OS2.bin': No space left on device
1+0 records in
0+0 records out
root@XiaoQiang:/tmp# dd if=/dev/mtd7 of=/tmp/rom/overlay.bin
dd: writing '/tmp/rom/overlay.bin': No space left on device
1+0 records in
0+0 records out
root@XiaoQiang:/tmp# dd if=/dev/mtd8 of=/tmp/rom/crash.bin
dd: writing '/tmp/rom/crash.bin': No space left on device
1+0 records in
0+0 records out
root@XiaoQiang:/tmp# dd if=/dev/mtd9 of=/tmp/rom/reserved.bin
dd: writing '/tmp/rom/reserved.bin': No space left on device
1+0 records in
0+0 records out
root@XiaoQiang:/tmp# dd if=/dev/mtd10 of=/tmp/rom/Bdata.bin
dd: writing '/tmp/rom/Bdata.bin': No space left on device
1+0 records in
0+0 records out
使用winsicp将配置备份,避免内存不足刷出砖头
#删除路由器/tmp/rom的备份文件,否则空间不够。将openwrt-ramips-mt7628-miwifi-nano-squashfs-sysupgrade.bin文件传到/tmp
mv -f /tmp/rom/openwrt-ramips-mt7628-miwifi-nano-squashfs-sysupgrade.bin /tmp/
下载官方编译好得固件:
https://downloads.openwrt.org/snapshots/trunk/ramips/mt7628/openwrt-ramips-mt7628-miwifi-nano-squashfs-sysupgrade.bin
执行安装
mtd -r write /tmp/openwrt-ramips-mt7628-miwifi-nano-squashfs-sysupgrade.bin firmware
修改lan网卡
vi /etc/config/network
加载luci(路由器需要连上网络)
opkg update
opkg install luci
/etc/init.d/uhttpd enable
/etc/init.d/uhttpd start
安装iperf3
输入命令:opkg install iperf3
创建自启脚本:
#!/bin/sh /etc/rc.common
START=99 #这里是启动优先级
STOP=15 #这里是停止优先级
start(){
iperf3 -s &
}
stop(){
killall iperf3
}
restart(){
killall iperf3
iperf3 -s &
}
enable(){
iperf3 -s &
}
disable(){
killall iperf3
}
使能脚本自启:
touch /etc/init.d/myshell
chmod 777 /etc/init.d/myshell
ln -s /etc/init.d/myshell /etc/rc.d/S99myshell
/etc/rc.d/S99myshell enable