简介


这篇文章中,读者将会了解到如何通过 CLI(命令行)更新 EdgeRouter 固件。目前可以在 EdgeRouter 中存储两个固件映像。如果升级后无法正常工作,可以很容易的切换到老版本。


工具


EdgeRouter


操作步骤


1.查看当前版本的方法:

ubnt@RTR:~$ show version
Version:      v0.9.5
Build ID:     13450177
Build on:     08/15/12 01:02
Copyright:    2012 Ubiquiti, Inc
HW model:     EdgeRouter Lite 3-Port
HW S/N:       1226TDC9FDB170D87
Uptime:       18:03:12 up 4 min,  1 user,  load average: 0.32, 0.25, 0.11

(1)例如可以直接使用一个下载链接(当然要使用真实的网址):

  add system image http://dl.ubnt.com/...

(2)从本地文件添加一个新的映像:

ubnt@RTR:~$ add system image egdeos-120821.tar
Preparing to upgrade... Done
Copying upgrade image... Done
Removing old image... Done
Checking upgrade image... Done
Finishing upgrade... Done
Upgrade completed
ubnt@RTR:~$
注意: 在添加一个新的映像时,整个/config 目录都会被复制到新的映像,所以新的映像将会拥有跟旧的映像相同的配置。保存在/config/auth 目录下的 OpenVPN 密钥也会被复制。

2.可以从本地或者一个网址添加一个新的映像。

ubnt@RTR:~$ add system image ?
Possible completions:
     File name or URL of system image file to be installed

3.查看两个映像以及映像运行状态和下次重启时会运行的映像的方法:

ubnt@RTR:~$ show system image
The system currently has the following image(s) installed:
v0.9.5.13455361.120821.0102    (default boot)
v0.9.5.13450177.120815.0102    (running image)
A reboot is needed to boot default image

(1)重启后,新的映像正在运行并且是默认启动:

ubnt@RTR:~$ show system image
The system currently has the following image(s) installed:
v0.9.5.13455361.120821.0102    (running image) (default boot)
v0.9.5.13450177.120815.0102

(2)查看每个映像占用的存储空间的方法:

ubnt@RTR:~$ show system image storage
Image name                        Read-Only   Read-Write        Total
------------------------------ ------------ ------------ ------------
v0.9.5.13455361.120821.0102           69060          460        69520
v0.9.5.13450177.120815.0102           69056        77428       146484

(3)要切换到另一个映像,例如要恢复升级按照下述操作:

ubnt@RTR:~$ set system image default-boot
The system currently has the following image(s) installed:
v0.9.5.13455361.120821.0102    (running image) (default boot)
v0.9.5.13450177.120815.0102
Are you sure you want to switch images? (Yes/No) [Yes]:
 Moving images...
Done
Switched from
 Version:      v0.9.5.13455361.120821.0102
to
 Version:      v0.9.5.13450177.120815.0102

4.如果你要删除另一个映像,你需要使用 delete 指令来作业

ubnt@RTR:~$ delete system image
The system currently has the following image(s) installed:
v0.9.5.13455361.120821.0102    (running image) (default boot)
v0.9.5.13450177.120815.0102
You are about to delete image [v0.9.5.13450177.120815.0102]
Are you sure you want to delete ? (Yes/No) [Yes]:
Removing old image... Done

Video Tutorial (Web GUI)