在公司 当中经常会遇到交换机比较多的情况、vlan也比较多、如果手工一台一台配置非常费时而且有可能配错、这种时候可以配置VTP 、一台配置和修改vlan其他同步即可。(有vlan和trunk才能有vtp) 如图:sw1 作为vtp 主机模式、sw 2、3作为客户模式、sw4 作为独立模式

SW1>enable configure terminal interface fa 0/2 switchport trunk encapsulation dot1q switchport mode trunk exit vlan 100划分vlan100 name v100 命名为v100 vlan 200 name v200 vlan 300 name v300 exit vtp mode server 设置VTP主机模式 vtp domain idcqq 设置VTP 域名为idcqq vtp password xxwj 设置vtp 域名密码为 xxwj exit show vtp status 查看VTP情况 show vlan 查看vlan 情况 ,检测上面配置的情况是否正确 第一台主交换机VTP server配置完成,现在配置其它的交换机。 SW3>enable configure terminal interface fa 0/2 switchport trunk encapsulation dot1q switchport mode trunk exit vtp mode client vtp domain idcqq vtp password xxwj exit show vtp status show vlan 因为SW3 并没有配置VLAN,发现自动学习到vlan了 同理SW2 也是和SW3一样配置,一样能自动学习到VLAN 现在我在SW1 VTP server上删除vlan 100 ,新加入一个vlan 111看看其它2台、马上就可以学到.

现在把SW4 设成VTP transparent模式,发现无法学习VLAN。