Smart-config的测试配置示例

Smart-config的测试配置示例

功能工作流程:

1.启动设备。判断是否需要智能配置:设备开启智能配置功能(默认开启,配置命令:smartconf initial-switch-deploymen);设备上没有启动配置文件;

2.DHCP服务器通过150选项分配IP地址并携带TFTP服务器的IP地址;

3.设备在TFTP服务器上查找startup-config和image,下载到本地,重新启动并应用。

操作步骤:
1.按拓扑完成物理连接

构建如下简单的实验环境。图中没有物理连接端口,任何属于该vlan的物理端口都可以。要求:TFTP服务器、DHCP服务器和支持Smart config的测试交换机。

2.配置DHCP-Server

这里我们使用支持DHCP-Server功能的交换机(或其他DHCP-Server服务器,包括Option150: TFTP-Server IP)。这些配置请参考对应系列交换机的用户手册。

配置如下:
Switch# configure terminal

Switch(config)# service dhcp enable

Switch(config)# dhcp server

Switch(config)# dhcp pool pool100

Switch(config-dhcp)# network 192.168.100.0/24

Switch(config-dhcp)# gateway 192.168.100.77

Switch(config-dhcp)# tftp-server-address 192.168.100.3

Switch(config-dhcp)# exit

Switch(config)# dhcp excluded-address 192.168.100.3

Switch(config)# interface vlan1

Switch(config-if)# ip address 192.168.100.77/24

Switch(config-if)# dhcp server enable

Switch(config-if)# exit

Switch(config)#

3.准备TFTP-Server
构建TFTP服务器

使用应用软件打开PC(192.168.100.3)上的TFTP服务,在PC TFTP服务目录下创建“smartconfig”文件夹,目录结构如下(配置文件在conf目录下,镜像文件在images目录下):
Smartconfig/

|–conf/

|–images/

|–smartdeploy.xml

                                                                                              

从“smartdeploy.xml”文件中下载的控制映像文件和配置文件。xml文件中的标签有三种类型:MAC、product-id和SN。在“MAC”、“SN”和“product-id”对应的目录下查找镜像文件和配置文件。具体内容如下:
<SmartDeploy>

<ftype>init</ftype>

<hostprefix>Smart-Switch</hostprefix>

<defItem>

<option>enable</option>

<image>S5624.v7.4.50.0926.bin</image>

<config>startupdef.conf</config>

</defItem>

<groups>

<Item>

<type>MAC</type>

<value>d85b.2200.0423</value>

<image>S5624.v7.4.50.1014.bin</image>

<config>5624-startconf.conf</config>

</Item>

<Item>

<type>productid</type>

<value>09SWITCH-E48-10</value>

<image>productid.bin</image>

<config>productid.cfg</config>

</Item>

<Item>

<type>SN</type>

<value>S5624P-4N1Z-ECD68A8F18AD</value>

<image>wqt.sX624.v7.4.50.1007.bin</image>

<config>startupb.conf</config>

</Item>

</groups>

</SmartDeploy>

注意:在本例中,交换机通过匹配MAC地址(d85b.2200.0423)找到自己的镜像文件(S5624.v7.4.50.1014.bin)和配置文件(5624-startconf.conf)。

也由产品ID或SN匹配。

如果上述匹配失败,将下载<defItem>中指定的文件。
a .智能配置功能有“禁用”和“启用”两种,默认为“启用”,无需任何操作;

b .测试前删除配置文件:delete flash:/startup-config.conf delete flash:/boot/startup-config.conf

c .确保被测设备连接正确,然后将交换机下电,再上电(模拟交换机第一次使用)。交换机启动完成后,会自动下载匹配的文件,然后自动复位。

注意:一次启动后,交换机存在startup-config.conf文件,智能配置功能失败。