VTP的配置步驟:
- 配置Trunk
- 配置VTP DOMAIN
- 配置VTP MODE
- 配置封裝 switchport trunk encapsulation dot1q
- 配置密碼 vtp password
- 配置VLAN
- 將端口加入VLAN
- 檢查vtp
配置SW1:
SW1#configure terminal
SW1(config)#interface fastEthernet 0/1
SW1(config-if)#switchport mode trunk
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#vtp domain testvtp
Domain name already set to testvtp.
SW1(config)#vtp mode server
Device mode already VTP SERVER.
SW1(config)#vtp password cisco
Setting device VLAN database password to cisco
SW1(config)#vtp pruning //配置VTP的修剪,只要在SERVER端配置就行.
Pruning switched on
(vtp修剪默認是關閉的,在交換機發送vtp報文更新的時候會向交換機上所有的TRUNK端口去發送,VTP修剪是爲了修剪掉那些廣播、組播以及未知目的地址的單播流量,不讓這些流量發送到不包含流量的源VLAN的交換機)
SW1#sho vtp status
創建VLAN2 VLAN3 VLAN4 VLAN5
配置SW2:
Switch#
Switch#config t
Enter configuration commands, one per line. End with CNTL/Z.
SW2(config)#int fastEthernet 0/1
SW2(config-if)#switchport trunk encapsulation dot1q //如果是3550端口先要封裝dot1q,因爲默認爲auto時不可以直接設置端口的trunk模式
SW2(config-if)#switchport mode trunk
SW2(config-if)#exit
SW2(config)#vtp domain testvtp
Changing VTP domain name from test to testvtp
SW2(config)#vtp mode client
Setting device to VTP CLIENT mode.
SW2(config)#vtp password cisco
SW2#show vlan
SW2不用配置VLAN,同步了SW1的VLAN信息