通过Option参数实现零配置设备部署示例
组网需求
如图3-17所示,在小区接入组网环境下的部署场景中,汇聚设备SwitchD连接着整个小区各个楼层的新出厂设备(如SwitchA、SwitchB和SwitchC)。
用户希望为小区内的各楼层的新设备加载相同的系统软件、补丁文件和配置文件;并且由于待配置的新设备较多,为了降低人工成本、节省部署的时间,用户希望各楼层设备能实现统一自动的配置。
实现零配置设备部署前,需要确保文件服务器、DHCP服务器与待配置设备(获取IP地址后)之间路由可达。
配置思路
- 用户PC与SwitchD直接相连,在PC上配置文件服务器。将需要加载的配置文件、系统软件和补丁文件放至文件服务器的工作目录下,保证SwitchA、SwitchB和SwitchC能够获取到需要加载的文件。
- 在SwitchD上配置DHCP服务器,为SwitchA、SwitchB和SwitchC提供网络配置信息。由于待配置设备需加载相同的系统软件、补丁文件和配置文件,所以在配置DHCP服务器时,通过Option67和Option145提供需加载文件的信息。
- SwitchA、SwitchB和SwitchC上电,实现通过EasyDeploy功能自动加载配置文件、系统软件和补丁文件。
操作步骤
- 配置文件服务器
请根据文件服务器的操作指导进行配置。
配置完成后,将待配置设备需要加载的文件保存至文件服务器中。
- 配置DHCP服务器
<HUAWEI> system-view [HUAWEI] sysname DHCP_Server [DHCP_Server] dhcp enable [DHCP_Server] vlan batch 10 20 [DHCP_Server] interface gigabitethernet 0/0/1 [DHCP_Server-GigabitEthernet0/0/1] port link-type hybrid [DHCP_Server-GigabitEthernet0/0/1] port hybrid pvid vlan 10 [DHCP_Server-GigabitEthernet0/0/1] port hybrid untagged vlan 10 [DHCP_Server-GigabitEthernet0/0/1] quit [DHCP_Server] interface gigabitethernet 0/0/2 [DHCP_Server-GigabitEthernet0/0/2] port link-type hybrid [DHCP_Server-GigabitEthernet0/0/2] port hybrid pvid vlan 10 [DHCP_Server-GigabitEthernet0/0/2] port hybrid untagged vlan 10 [DHCP_Server-GigabitEthernet0/0/2] quit [DHCP_Server] interface gigabitethernet 0/0/3 [DHCP_Server-GigabitEthernet0/0/3] port link-type hybrid [DHCP_Server-GigabitEthernet0/0/3] port hybrid pvid vlan 10 [DHCP_Server-GigabitEthernet0/0/3] port hybrid untagged vlan 10 [DHCP_Server-GigabitEthernet0/0/3] quit [DHCP_Server] interface gigabitethernet 0/0/4 [DHCP_Server-GigabitEthernet0/0/4] port link-type hybrid [DHCP_Server-GigabitEthernet0/0/4] port hybrid pvid vlan 20 [DHCP_Server-GigabitEthernet0/0/4] port hybrid untagged vlan 20 [DHCP_Server-GigabitEthernet0/0/4] quit [DHCP_Server] interface vlanif 10 [DHCP_Server-Vlanif10] ip address 192.168.2.6 255.255.255.0 [DHCP_Server-Vlanif10] dhcp select global [DHCP_Server-Vlanif10] quit [DHCP_Server] interface vlanif 20 [DHCP_Server-Vlanif20] ip address 192.168.1.1 255.255.255.0 [DHCP_Server-Vlanif20] quit [DHCP_Server] ip pool auto-config [DHCP_Server-ip-pool-auto-config] network 192.168.2.0 mask 255.255.255.0 [DHCP_Server-ip-pool-auto-config] gateway-list 192.168.2.6 [DHCP_Server-ip-pool-auto-config] option 67 ascii s_V200R019C10.cfg [DHCP_Server-ip-pool-auto-config] option 141 ascii user [DHCP_Server-ip-pool-auto-config] option 142 cipher huawei123 [DHCP_Server-ip-pool-auto-config] option 143 ip-address 192.168.1.6 [DHCP_Server-ip-pool-auto-config] option 145 ascii vrpfile=s_V200R019C10.cc;vrpver=V200R019C10SPC200;patchfile=s_V200R019C10.pat; [DHCP_Server-ip-pool-auto-config] quit
- 待配置设备SwitchA、SwitchB和SwitchC上电启动,EasyDeploy流程开始运行
- 验证配置结果
# EasyDeploy流程结束后,登录到待配置设备执行命令display startup查看设备当前的启动系统软件,启动配置文件和启动补丁文件。以SwitchA为例:
<HUAWEI> display startup MainBoard: Configured startup system software: flash:/s_V200R019C10.cc Startup system software: flash:/s_V200R019C10.cc Next startup system software: flash:/s_V200R019C10.cc Startup saved-configuration file: flash:/s_V200R019C10.cfg Next startup saved-configuration file: flash:/s_V200R019C10.cfg Startup paf file: NULL Next startup paf file: NULL Startup license file: NULL Next startup license file: NULL Startup patch package: flash:/s_V200R019C10.pat Next startup patch package: flash:/s_V200R019C10.pat
配置文件
DHCP_Server的配置文件
# sysname DHCP_Server # vlan batch 10 20 # dhcp enable # ip pool auto-config gateway-list 192.168.2.6 network 192.168.2.0 mask 255.255.255.0 option 67 ascii s_V200R019C10.cfg option 141 ascii user option 142 cipher %^%#%AC[/dp2*'%0FWN7]p{SWrB`$}i[:7VBPZQj5@)%%^%# option 143 ip-address 192.168.1.6 option 145 ascii vrpfile=s_V200R019C10.cc;vrpver=V200R019C10SPC200;patchfile=s_V200R019C10.pat; # interface Vlanif10 ip address 192.168.2.6 255.255.255.0 dhcp select global # interface Vlanif20 ip address 192.168.1.1 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 10 port hybrid untagged vlan 10 # interface GigabitEthernet0/0/4 port link-type hybrid port hybrid pvid vlan 20 port hybrid untagged vlan 20 # return