路由器固件备份与恢复操作笔记
路由器固件备份与恢复操作笔记
1. 进入 Telnet 控制台
- 按
Win + R,输入cmd打开命令提示符。 输入以下命令连接路由器:
telnet 192.168.2.1输入用户名和密码(默认):
admin admin
登录后显示 BusyBox 信息,进入 ash shell。
2. 查看 MTD 分区信息
cat /proc/mtd输出示例:
| dev | size | erasesize | name |
|---|---|---|---|
| mtd0 | 00800000 | 00010000 | ALL |
| mtd1 | 00030000 | 00010000 | Bootloader |
| mtd2 | 00010000 | 00010000 | Config |
| mtd3 | 00010000 | 00010000 | Factory |
| mtd4 | 00790000 | 00010000 | Kernel |
| mtd5 | 00010000 | 00010000 | nvbackup |
| mtd6 | 00010000 | 00010000 | nvram |
3. 备份分区
进入 /tmp 目录:
cd /tmp备份所有分区到 .bin 文件:
cat /dev/mtd0 > /tmp/ALL.bin
cat /dev/mtd1 > /tmp/Bootloader.bin
cat /dev/mtd2 > /tmp/Config.bin
cat /dev/mtd3 > /tmp/Factory.bin
cat /dev/mtd4 > /tmp/Kernel.bin
cat /dev/mtd5 > /tmp/nvbackup.bin
cat /dev/mtd6 > /tmp/nvram.bin4. 通过 TFTP 下载备份文件到电脑
在电脑端(IP 为 192.168.2.100)运行 TFTP 服务器,然后在路由器执行:
tftp -p -r ALL.bin -l /tmp/ALL.bin 192.168.2.100
tftp -p -r Bootloader.bin -l /tmp/Bootloader.bin 192.168.2.100
tftp -p -r Config.bin -l /tmp/Config.bin 192.168.2.100
tftp -p -r Factory.bin -l /tmp/Factory.bin 192.168.2.100
tftp -p -r Kernel.bin -l /tmp/Kernel.bin 192.168.2.100
tftp -p -r nvbackup.bin -l /tmp/nvbackup.bin 192.168.2.100
tftp -p -r nvram.bin -l /tmp/nvram.bin 192.168.2.1005. 恢复分区(如需还原备份)
mtd_write write /tmp/ALL.bin ALL
mtd_write write /tmp/Bootloader.bin Bootloader
mtd_write write /tmp/Config.bin Config
mtd_write write /tmp/Factory.bin Factory
mtd_write write /tmp/Kernel.bin Kernel
mtd_write write /tmp/nvbackup.bin nvbackup
mtd_write write /tmp/nvram.bin nvram6. 刷入 Breed 引导加载器
方式一:通过 TFTP 上传 Breed 文件
tftp -g -l /tmp/breed-mt7620-reset1.bin -r breed-mt7620-reset1.bin 192.168.2.100
mtd_write write /tmp/breed-mt7620-reset1.bin Bootloader方式二:通过 wget 下载 Breed 文件并刷入
wget http://breed.hackpascal.net/breed-mt7620-phicomm-psg1208.bin
mtd_write write breed-mt7620-phicomm-psg1208.bin Bootloader方式三:使用本地 HTTP 服务器
wget http://192.168.2.5:806/breed/r1126/breed-mt7620-phicomm-psg1208.bin
mtd_write write /tmp/breed-mt7620-phicomm-psg1208.bin Bootloader注意事项
- 操作前请确保路由器 IP 与电脑 IP 在同一网段(如
192.168.2.x)。 - 刷写 Bootloader 存在变砖风险,请谨慎操作。
- 建议在刷写前完成所有分区备份。
- Breed 文件请根据实际路由器型号选择正确版本。