通过Commander实现零配置设备部署(不使能网络拓扑收集功能)示例
组网需求
如图3-19所示,在某企业网络中,文件服务器和DHCP服务器与SwitchA之间路由可达。现在需要将企业新建楼宇中的设备Client1、Client2、Client3加入到网络中。新加入的Client与DHCP服务器不在同一网段。为了降低人工成本、节省部署的时间,用户希望为新部署的设备实现统一自动的配置和后续的维护功能。
其中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-6所示。
配置思路
- 配置文件服务器,将Client需要加载的文件保存至文件服务器。
- 在SwitchB上配置基于全局地址池的DHCP服务器,在SwitchA上配置DHCP中继功能,实现新加入的Client自动获取IP地址及Commander的IP地址。
在SwitchA上配置Commander功能,以实现通过Commander进行零配置部署。
- 为了后期的维护,需要在Commander上配置自动备份配置文件功能,便于后续进行故障替换。
- Client1和Client2由于是同类型设备且需要加载配置文件相同,所以可以配置内置Group。Client3与Client1、Client2加载的配置文件不同,所以可以直接指定此Client的下载信息。
- 由于Client3与Client1是串联组网,所以需要在Commander全局下配置延时时间,以确保Client3能够下载文件成功。
操作步骤
- 配置文件服务器
请根据文件服务器的操作指导进行配置。
配置完成后,将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] backup configuration interval 2
- 配置下载文件信息
# 为Client1和Client2配置根据设备类型匹配的内置Group,并指定需要加载的文件信息。
[SwitchA-easyoperation] group build-in S600-E [SwitchA-easyoperation-group-build-in-S600-E] configuration-file s600-e_1.cfg [SwitchA-easyoperation-group-build-in-S600-E] custom-file header1.txt [SwitchA-easyoperation-group-build-in-S600-E] quit [SwitchA-easyoperation] client auto-join enable Warning: The commander will create the client information in database automatica lly when received message from unknown client. Continue? [Y/N]: y [SwitchA-easyoperation]
# 为Client3指定下载文件信息。
[SwitchA-easyoperation] client 3 mac-address 5489-9875-edff [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] 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 : Disable Topology collection : Disable 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 # 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 # 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 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 3 mac-address 5489-9875-EDFF client 3 configuration-file s600-e_2.cfg client 3 custom-file header2.txt group build-in S600-E configuration-file s600-e_1.cfg custom-file header1.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