小米路由器青春版 ,采用 Micro USB 接口,重置键位于路由器背部,镂空小孔阵列的右上角(有 Reset 文字提示) ,操作按键需要使用取卡针或类似物体长按。
路由器连接电源
http://192.168.31.1/cgi-bin/luci/;stok=###/web/home#router进入页面后,对路由进行设置(如登录密码等),完成后保存退出。
固件等级低于2.1的可以忽略此步骤,由于新版本的固件,阻止开启ssh,故需要降级.
openwrt官网又下载链接:Official Developer ROM
将之前地址栏URL中的 /web/home#router 替换为
/api/xqsystem/set_name_password?oldPwd=当前路由器的管理密码&newPwd=新的路由器管理密码
如果网页返回 {“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},则说明修改成功。
使用MobaXterm,打开telnel连接,配置以下参数。
主机名称:192.168.31.1;用户名输入root,密码为刚修改后的新密码:

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
使用MobaXterm,打开SSH连接。
主机名称:192.168.31.1;用户名输入root,密码为刚修改后的新密码:

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
下载官方编译好得固件:https://downloads.openwrt.org/snapshots/trunk/ramips/mt7628/openwrt-ramips-mt7628-miwifi-nano-squashfs-sysupgrade.bin
通过SSH将固件放置路由器,然后输入命令:mtd -r write /tmp/openwrt-ramips-mt7628-miwifi-nano-squashfs-sysupgrade.bin firmware
待固件刷新并重启后,SSH重新登录路由。
此时主机名称:192.168.1.1;用户名输入root,密码为刚修改后的新密码:

成功登录后如界面:

由于默认不带luci,所以需要重新下载,输入以下命令:
opkg update
opkg install luci
/etc/init.d/uhttpd enable
/etc/init.d/uhttpd start
在电脑端的浏览器中输入“192.168.1.1”,可访问路由器就表示Luci安装成功.

输入命令: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/myshell enable
这样路由每次启动都会启动iperf server.