通过Commander实现批量升级设备示例
组网需求
如图3-22所示,在企业网络中,Client1~Client6是某企业内部各楼宇中的设备,与Switch及文件服务器间的路由可达,Switch的IP地址是172.31.20.10/24,文件服务器的IP地址是172.31.1.90。为了降低人工成本也便于后续的升级维护操作,用户希望各个Client能够自动获取所需要文件,实现批量升级。
Client1~Client6的设备信息及需要加载的文件,如表3-8所示。
Client | 设备类型 | MAC地址 | IP地址 | 需要加载的文件 |
---|---|---|---|---|
Client1 | S600-E | - | 172.31.20.100/24 | s600-e_1.cc header1.txt |
Client2 | S600-E | - | – | s600-e_2.cc |
Client3 | S600-E | - | - | s600-e_2.cc |
Client4 | S600-E | - | 172.31.10.10/24 | s600-e_3.cc |
Client5 | S600-E | - | - | s600-e_2.cc |
Client6 | S600-E | 5489-9875-ea12 | - | web_1.web.7z header.txt |
配置思路
- 配置文件服务器,将用户需要加载的文件保存至文件服务器。
- 在各Client上配置Switch(Commander)的IP地址。
在Switch上配置Commander功能,以实现通过Commander进行批量升级。
- 配置Commander的基本功能。
- 根据需要待升级Client的设备类型及需要加载的文件,配置相应的Group进行匹配。
- 为了后期的维护,需要在Commander上配置自动备份配置文件功能,便于后续进行故障替换。
- 由于有Client串联组网,为了确保Client5和Client6能够下载文件成功,所以需要配置延时激活时间,同时为了减少升级带来的业务影响,所以选择在凌晨2点激活文件。
- 启动批量升级流程。
操作步骤
- 配置文件服务器
请根据文件服务器的操作指导进行配置。
配置完成后,将所有待升级Client需要加载的文件保存至文件服务器中。
- 在各Client上配置Commander的IP地址
# 在Client1上配置Commander的IP地址。
<HUAWEI> system-view [HUAWEI] easy-operation commander ip-address 172.31.20.10
在Client2~Client6进行同样的配置。
- 配置Commander的基本功能。
<HUAWEI> system-view [HUAWEI] sysname Commander [Commander] easy-operation commander ip-address 172.31.20.10 [Commander] easy-operation commander enable [Commander] easy-operation [Commander-easyoperation] sftp-server 172.31.1.90 username admin password EasyOperation [Commander-easyoperation] backup configuration interval 2
- 配置Client加入Commander的管理
[Commander-easyoperation] client auto-join enable
使能自动加入功能后,可以在Commander上学习到Client1~Client6的设备信息及当前加载的文件信息。可通过display easy-operation client进行查询。
- 配置下载文件信息及文件生效方式
# 为Client1配置根据IP地址匹配的Group,并指定需要加载的文件信息。
[Commander-easyoperation] group custom ip-address g1 [Commander-easyoperation-group-custom-g1] match ip-address 172.31.20.100 24 [Commander-easyoperation-group-custom-g1] system-software s600-e_1.cc [Commander-easyoperation-group-custom-g1] custom-file header1.txt [Commander-easyoperation-group-custom-g1] quit
# 为Client2、Client3、Client5配置根据设备类型匹配的内置Group,并指定需要加载的文件信息。
[Commander-easyoperation] group build-in s600-e [Commander-easyoperation-group-build-in-S600-E] system-software s600-e_2.cc [Commander-easyoperation-group-build-in-S600-E] quit
# 为Client4配置根据IP地址匹配的Group,并指定需要加载的文件信息。
[Commander-easyoperation] group custom ip-address g2 [Commander-easyoperation-group-custom-g2] match ip-address 172.31.10.10 24 [Commander-easyoperation-group-custom-g2] system-software s600-e_3.cc [Commander-easyoperation-group-custom-g2] quit
# 为Client6配置根据MAC地址匹配的Group,并指定需要加载的文件信息。
[Commander-easyoperation] group custom mac-address g3 [Commander-easyoperation-group-custom-g3] match mac-address 5489-9875-ea12 [Commander-easyoperation-group-custom-g3] web-file web_1.web.7z [Commander-easyoperation-group-custom-g3] custom-file header.txt [Commander-easyoperation-group-custom-g3] quit
# 在全局Commander下配置激活时间及方式。
[Commander-easyoperation] activate-file in 2:00 reload [Commander-easyoperation] quit
- 检查配置结果
# 查看Commander上的全局配置信息。
[Commander] display easy-operation configuration --------------------------------------------------------------------------- Role : Commander Commander IP address : 172.31.20.10 Commander UDP port : 60000 IP address of file server : 172.31.1.90 Type of file server : SFTP Username of file server : admin Default system-software file : - Default system-software version : - Default configuration file : - Default patch file : - Default WEB file : - Default license file : - Default custom file 1 : - Default custom file 2 : - Default custom file 3 : - Auto clear up : Disable Auto join in : Enable Topology collection : Disable Activating file time : In 02:00 Activating file method : Reload Aging time of lost client(hours): - Backup configuration file mode : Default Backup configuration file interval(hours): 2 ---------------------------------------------------------------------------
# 查看Commander上配置的所有Group的信息。
[Commander] display easy-operation group The total number of group configured is : 4 The number of build-in group is : 1 The number of custom group is : 3 ------------------------------------------------------- Groupname Type MatchType ------------------------------------------------------- S600-E build-in device-type g1 custom ip-address g2 custom ip-address g3 custom mac-address -------------------------------------------------------
# 查看Commander上配置的Group名称为g1的信息。
[Commander] display easy-operation group custom g1 --------------------------------------------------------------------------- Group name : g1 Configuration file : - System-software file : s600-e_1.cc Patch file : - WEB file : - License file : - Customs file 1 : header1.txt Customs file 2 : - Customs file 3 : - Activating file time : Immediately Activating file method : Default Ip-address list : Ip-address Ip-mask 172.31.20.100 255.255.255.0 ---------------------------------------------------------------------------
- 启动批量升级流程
[Commander] easy-operation [Commander-easyoperation] upgrade group Warning: This command will start the upgrade process of all groups and clients i n these groups may reboot. Ensure that configurations of the clients have been s aved. Continue?[Y/N]:y
在此过程中,可以执行命令display easy-operation download-status查看各Client的下载状态。[Commander-easyoperation] display easy-operation download-status The total number of client in downloading files is : 6 ---------------------------------------------------------------------------- ID Mac address IP address Method Phase Status ---------------------------------------------------------------------------- 1 0011-2233-4455 172.31.20.100 Upgrade Sys-file Upgrading 2 00E0-FC34-3190 172.31.10.15 Upgrade Sys-file Upgrading 3 0011-2233-4457 172.31.10.20 Upgrade Sys-file Upgrading 4 70F3-950B-1A52 172.31.10.10 Upgrade Sys-file Upgrading 5 0011-2233-4459 172.31.10.18 Upgrade Sys-file Upgrading 6 5489-9875-ea12 172.31.10.11 Upgrade Web-file Upgrading
配置文件
Commander的配置文件
# sysname Commander # easy-operation commander ip-address 172.31.20.10 easy-operation commander enable # easy-operation client auto-join enable sftp-server 172.31.1.90 username admin password %^%#=.X8C_TN##%&9P>3RK503O@w-=Fr%>naT#E3P4{0%^%# backup configuration interval 2 activate-file reload activate-file in 02:00 group build-in S600-E system-software s600-e_2.cc group custom ip-address g1 system-software s600-e_1.cc custom-file header1.txt match ip-address 172.31.20.100 255.255.255.0 group custom ip-address g2 system-software s600-e_3.cc match ip-address 172.31.10.10 255.255.255.0 group custom mac-address g3 web-file web_1.web.7z custom-file header.txt match mac-address 5489-9875-EA12 FFFF-FFFF-FFFF # return
Client1~Client6的配置文件
# easy-operation commander ip-address 172.31.20.10 # return