通过Commander实现零配置设备部署(使能网络拓扑收集功能)示例
组网需求
如图3-20所示,在某企业网络中,文件服务器和DHCP服务器与SwitchA之间路由可达。现在需要将企业新建楼宇中的设备SwitchC、SwitchD、SwitchE加入到网络中。新加入的Switch与DHCP服务器不在同一网段。为了降低人工成本、节省部署的时间,用户希望为新部署的设备实现统一自动的配置和后续的维护功能。由于设备安装工程师未上报Client对应的MAC地址和ESN号,所以配置网络拓扑收集功能。
其中SwitchA上接口VLANIF20的地址为192.168.4.2/24,对端地址为192.168.4.1/24。
SwitchB上接口VLANIF30的地址为192.168.3.2/24,对端地址为192.168.3.1/24。
新加入的设备情况如表3-7所示。
配置思路
- 配置文件服务器,将Client需要加载的文件保存至文件服务器。
- SwitchB上配置基于全局地址池的DHCP服务器,在SwitchA上配置DHCP中继功能,实现新加入的Client自动获取IP地址及Commander的IP地址。
在SwitchA上配置Commander功能,以实现通过Commander进行零配置部署。
- 为了后期的维护,需要在Commander上配置自动备份配置文件功能,便于后续进行故障替换。
- 根据网络拓扑,配置Client的下载文件信息。
- 由于SwitchE与SwitchC是串联组网,所以需要在Commander全局下配置延时时间,以确保SwitchE能够下载文件成功。
操作步骤
- 配置文件服务器
请根据文件服务器的操作指导进行配置。
配置完成后,将Client需要加载的文件保存至文件服务器。
- 配置DHCP
# 在SwitchB上配置基于全局地址池的DHCP服务器。
<HUAWEI> system-view [HUAWEI] sysname SwitchB [SwitchB] dhcp enable [SwitchB] vlan batch 30 [SwitchB] interface vlanif 30 [SwitchB-Vlanif30] ip address 192.168.3.2 24 [SwitchB-Vlanif30] dhcp select global [SwitchB-Vlanif30] quit [SwitchB] interface gigabitethernet 0/0/1 [SwitchB-GigabitEthernet0/0/1] port link-type hybrid [SwitchB-GigabitEthernet0/0/1] port hybrid pvid vlan 30 [SwitchB-GigabitEthernet0/0/1] port hybrid untagged vlan 30 [SwitchB-GigabitEthernet0/0/1] quit [SwitchB] ip pool easy-operation [SwitchB-ip-pool-easy-operation] network 192.168.1.0 mask 255.255.255.0 [SwitchB-ip-pool-easy-operation] gateway-list 192.168.1.6 [SwitchB-ip-pool-easy-operation] option 148 ascii ipaddr=192.168.1.6; [SwitchB-ip-pool-easy-operation] quit
# 在SwitchB上配置缺省路由。
[SwitchB] ip route-static 0.0.0.0 0.0.0.0 192.168.3.1
# 在SwitchA(Commander)上配置DHCP中继。
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vlan batch 10 20 [SwitchA] dhcp enable [SwitchA] interface vlanif 10 [SwitchA-Vlanif10] ip address 192.168.1.6 24 [SwitchA-Vlanif10] quit [SwitchA] interface vlanif 20 [SwitchA-Vlanif20] ip address 192.168.4.2 24 [SwitchA-Vlanif20] quit [SwitchA] interface gigabitethernet 0/0/1 [SwitchA-GigabitEthernet0/0/1] port link-type hybrid [SwitchA-GigabitEthernet0/0/1] port hybrid pvid vlan 10 [SwitchA-GigabitEthernet0/0/1] port hybrid untagged vlan 10 [SwitchA-GigabitEthernet0/0/1] quit [SwitchA] interface gigabitethernet 0/0/2 [SwitchA-GigabitEthernet0/0/2] port link-type hybrid [SwitchA-GigabitEthernet0/0/2] port hybrid pvid vlan 10 [SwitchA-GigabitEthernet0/0/2] port hybrid untagged vlan 10 [SwitchA-GigabitEthernet0/0/2] quit [SwitchA] interface gigabitethernet 0/0/3 [SwitchA-GigabitEthernet0/0/3] port link-type hybrid [SwitchA-GigabitEthernet0/0/3] port hybrid pvid vlan 20 [SwitchA-GigabitEthernet0/0/3] port hybrid untagged vlan 20 [SwitchA-GigabitEthernet0/0/3] quit [SwitchA] interface vlanif 10 [SwitchA-Vlanif10] dhcp select relay [SwitchA-Vlanif10] dhcp relay server-ip 192.168.3.2 [SwitchA-Vlanif10] quit
# 在SwitchA上配置缺省路由。
[SwitchA] ip route-static 0.0.0.0 0.0.0.0 192.168.4.1
- 配置Commander的基本功能
[SwitchA] easy-operation commander ip-address 192.168.1.6 [SwitchA] easy-operation commander enable
- 配置文件服务器信息
[SwitchA] easy-operation [SwitchA-easyoperation] sftp-server 192.168.2.2 username admin password EasyOperation [SwitchA-easyoperation] quit
- 配置网络拓扑收集功能
[SwitchA] ndp enable [SwitchA] ntdp enable [SwitchA] ntdp timer 5 [SwitchA] easy-operation [SwitchA-easyoperation] topology enable [SwitchA-easyoperation] client auto-join enable [SwitchA-easyoperation] quit
- 配置集群和集群管理VLAN
[SwitchA] cluster enable [SwitchA] cluster [SwitchA-cluster] mngvlanid 10 [SwitchA-cluster] quit
- 配置下载文件信息
# 查看Commander收集到的网络拓扑信息。
[SwitchA] display easy-operation topology <-->:normal device <??>:lost device Total topology node number: 3 ------------------------------------------------------------------------------ [SwitchA: 4CB1-6C8F-0447](Commander) |-(GE0/0/1)<-->(GE0/0/1)[HUAWEI: 00E0-FC34-3190](Client 1) |-(GE0/0/2)<-->(GE0/0/1)[HUAWEI: 00E0-FC12-A34B](Client 2) | |-(GE0/0/2)<-->(GE0/0/1)[HUAWEI: 5489-9875-edff] (Client 3)
根据网络规划和网络拓扑信息,知道Client1对应SwitchD,Client2对应SwitchC,Client3对应SwitchE。
# 为Client1指定下载文件信息。
[SwitchA] easy-operation [SwitchA-easyoperation] client 1 configuration-file s600-e_1.cfg custom-file header1.txt
# 为Client2指定下载文件信息。
[SwitchA-easyoperation] client 2 configuration-file s600-e_1.cfg custom-file header1.txt
# 为Client3指定下载文件信息。
[SwitchA-easyoperation] client 3 configuration-file s600-e_2.cfg custom-file header2.txt
# 在全局Commander下配置延时激活时间。根据Client3下载文件的大小,将延时时间配置为15分钟(900秒)。
[SwitchA-easyoperation] activate-file delay 900
- 配置自动备份配置文件
[SwitchA-easyoperation] backup configuration interval 2 [SwitchA-easyoperation] quit
- 检查配置结果
# 查看Commander上的全局配置信息。
[SwitchA] display easy-operation configuration --------------------------------------------------------------------------- Role : Commander Commander IP address : 192.168.1.6 Commander UDP port : 60000 IP address of file server : 192.168.2.2 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 : Enable Activating file time : Delay 900s Activating file method : Default Aging time of lost client(hours): - Backup configuration file mode : Default Backup configuration file interval(hours): 2 ---------------------------------------------------------------------------
# 零配置部署流程开始后,查看各Client的下载状态。
[SwitchA] display easy-operation download-status The total number of client in downloading files is : 3 ---------------------------------------------------------------------------- ID Mac address IP address Method Phase Status ---------------------------------------------------------------------------- 1 00E0-FC12-A34B 192.168.1.254 Zero-touch Config-file Upgrading 2 00E0-FC34-3190 192.168.1.253 Zero-touch Config-file Upgrading 3 5489-9875-edff 192.168.1.252 Zero-touch Config-file Upgrading
配置文件
SwitchA的配置文件
# sysname SwitchA # vlan batch 10 20 # cluster enable # ntdp timer 5 # dhcp enable # interface Vlanif10 ip address 192.168.1.6 255.255.255.0 dhcp select relay dhcp relay server-ip 192.168.3.2 # interface Vlanif20 ip address 192.168.4.2 255.255.255.0 # interface GigabitEthernet0/0/1 port link-type hybrid port hybrid pvid vlan 10 port hybrid untagged vlan 10 # interface GigabitEthernet0/0/2 port link-type hybrid port hybrid pvid vlan 10 port hybrid untagged vlan 10 # interface GigabitEthernet0/0/3 port link-type hybrid port hybrid pvid vlan 20 port hybrid untagged vlan 20 # cluster mngvlanid 10 # ip route-static 0.0.0.0 0.0.0.0 192.168.4.1 # easy-operation commander ip-address 192.168.1.6 easy-operation commander enable # easy-operation client auto-join enable topology enable sftp-server 192.168.2.2 username admin password %^%#=.X8C_TN##%&9P>3RK503O@w-=Fr%>naT#E3P4{0%^%# backup configuration interval 2 activate-file delay 900 client 1 configuration-file s600-e_1.cfg client 1 custom-file header1.txt client 2 configuration-file s600-e_1.cfg client 2 custom-file header1.txt client 3 configuration-file s600-e_2.cfg client 3 custom-file header2.txt # return
SwitchB的配置文件
# sysname SwitchB # vlan batch 30 # dhcp enable # ip pool easy-operation gateway-list 192.168.1.6 network 192.168.1.0 mask 255.255.255.0 option 148 ascii ipaddr=192.168.1.6; # interface Vlanif30 ip address 192.168.3.2 255.255.255.0 dhcp select global # interface GigabitEthernet0/0/1 port link-type hybrid port hybrid pvid vlan 30 port hybrid untagged vlan 30 # ip route-static 0.0.0.0 0.0.0.0 192.168.3.1 # return