2024年4月19日发(作者:)
4.3 VTP的配置
【实验目的】
学习思科私有协议VTP的配置方法,观察VTP三种工作模式的通信方式
【知识点】
VTP的工作原理,VTP的工作模式
【实验场景】
三台交换机串联,其中一个作为sever模式,通过VLAN配置信息,一个作为transparent
模式,一个作为client模式。
【实验原理】
(1) VTP Server维护该VTP域中所有VLAN 信息列表,VTP Server可以建立、删除或
修改VLAN,发送并转发相关的通告信息,同步VLAN配置,会把配置保存在NVRAM中。
(2) VTP 虽然也维护所有VLAN信息列表,但其VLAN的配置信息是从VTP Server学到
的,VTP Client不能建立、删除或修改VLAN,但可以转发通告,同步VLAN配置,不保存配
置到NVRAM中。
(3) VTP Transparent相当于是一项独立的交换机,它不参与VTP工作,不从VTP Se
rver学习VLAN的配置信息,而只拥有本设备上自己维护的VLAN信息。VTP Transparent可
以建立、删除和修改本机上的 VLAN信息,同时会转发通告并把配置保存到NVRAM中。
【实验设备】
Cisco Packet Tracer软件中:三台2960交换机。
【实验拓扑】
【实验思路】
1. 配置交换机接口模式
2. 做VTP模式配置
3. 查看三台交换机VLAN配置信息
4. 创建VLAN
5. 查看三台交换机VLAN配置信息
【实验步骤】
1. 先在三台交换机上做配置,将接口全部配置为trunk模式。配置命令为:
SwitchSwitch>enable
Switch#configure terminal
(config-if)#int f0/1
Switch(config-if)#switchport mode trunk
2. 在三台交换机上做VTP基础配置。需要注意的是,所有需要共享 VLAN 信息的服务器
必须使用同样的域名,而且交换机一次只能在一个域中。因此,这意味着如果它们被配
置到同一个 VTP 域中,交换机就只能与其他交换机共享 VTP 域信息。如果在网络中
连接了多台交换机,就可以使用 VTP 域,但如果让所有的交换机都只在一个 VLAN
中, 就不需要使用 VTP 了。
Switch 0交换机 :
Switch(config)#vtp domain test
//配置VTP域名为test
Changing VTP domain name from NULL to test
Switch(config)#vtp mode ?
client Set the device to client mode.
server Set the device to server mode.
transparent Set the device to transparent mode.
Switch(config)#vtp mode server
//配置vtp模式为server
Switch(config)#vtp password test
//配置vtp域的密码为test
Setting device VLAN database password to test
Switch 1交换机 :
Switch(config)#vtp domain test
//配置VTP域名为test
Changing VTP domain name from NULL to test
Switch(config)#vtp mode ?
client Set the device to client mode.
server Set the device to server mode.
transparent Set the device to transparent mode.
Switch(config)#vtp mode transparent
//配置vtp模式为transparent
Switch(config)#vtp password test
//配置vtp域的密码为test
Setting device VLAN database password to test
Switch 2交换机 :
Switch(config)#vtp domain test
//配置VTP域名为test
Changing VTP domain name from NULL to test
Switch(config)#vtp mode ?
client Set the device to client mode.
server Set the device to server mode.
transparent Set the device to transparent mode.
Switch(config)#vtp mode client
//配置vtp模式为client
Switch(config)#vtp password test
//配置vtp域的密码为test
Setting device VLAN database password to test
3. 由于在之前的配置中并没有做VLAN的创建或删除操作,查看三台设备的VLAN信息,
可以看到依旧为初始状态。
4. 分别在三台设备上创建VLAN 10 、VLAN 20 和VLAN30 。
在switch 0 上:
Switch(vlan)#vlan 10
在switch 1 上:
Switch(vlan)#vlan 20
在switch 2 上:
Switch(vlan)#vlan 30
VTP VLAN configuration not allowed when device is in CLIENT mode.
//在client模式不可以进行VLAN的配置
5. 再次查看三台设备的VLAN配置信息
在switch 0 上:
在switch 1 上:
在switch 2 上:
综上我们可以发现,在switch2 即client模式上无法创建VLAN,但是switch 0 即
server上创建的VLAN可以通告给switch 2 ,但是在switch 1 即transparent上不会学
习到switch 0 创建的VLAN,并且它自身创建的VLAN不会通告给其他设备。[切记实验配
置完成要保存配置]
【实验思考】
1. 一台交换机作为client模式时,如何通过配置将此交换机的VLAN信息全部清空且不会
再学习到其他VLAN信息?
【实验拓展】
1. 思考【实验思考】的问题,搭建拓扑环境,尝试配置。
发布评论