1.   按照下图的实验环境:<?xml:namespace prefix = "o" ns = "urn:schemas-microsoft-com:office:office" />

<?xml:namespace prefix = "v" ns = "urn:schemas-microsoft-com:vml" />

1)   sw1上和sw2上起trunk

Switch(config)#h sw2

sw2(config)#int f0/1

sw2(config-if)#switchport mode tr

sw2(config-if)#do sh int tr

Port        Mode         Encapsulation  Status        Native vlan

Fa0/1       on           802.1q         trunking      1

 

2)   sw1上设置vtp域名,sw2可以学习到:

sw1(config)#vtp domain cisco

sw1(config)#vtp mode server

sw2(config)#vtp mode client

sw1(config)#do sh vtp status

VTP Version                     : 2

Configuration Revision          : 0

Maximum VLANs supported locally : 255

Number of existing VLANs        : 5

VTP Operating Mode              : Server

VTP Domain Name                 : cisco     sw1上设置后域名变为cisco

sw2(config)#do sh vtp sta

VTP Version                     : 2

Configuration Revision          : 0

Maximum VLANs supported locally : 255

Number of existing VLANs        : 5

VTP Operating Mode              : Client

VTP Domain Name                 : cisco     sw2上学习到sw1上的cisco

 

3)   sw1上创建vlan2,在sw2上可以学习到:

sw1(config)#vlan 2

sw1(config-vlan)#do sh vlan

2    VLAN0002                         active   sw1vlan2

sw1(config-vlan)#do sh vtp sta

VTP Version                     : 2

Configuration Revision          : 1       修订编号为

Maximum VLANs supported locally : 255

Number of existing VLANs        : 6

VTP Operating Mode              : Server

VTP Domain Name                 : cisco

sw2(config)#do sh vlan

2    VLAN0002                         active   sw2上学到了新的vlan

sw2(config)#do sh vtp sta

VTP Version                     : 2

Configuration Revision          : 1      修订编号也同步server变为1

Maximum VLANs supported locally : 255

Number of existing VLANs        : 6

VTP Operating Mode              : Client

VTP Domain Name                 : cisco

 

4)   断开trunksw2上改变模式,创建vlan3sw1可以学习到:

sw2(config)#int f0/1

sw2(config-if)#shutdown

sw2(config)#vtp mode server

Setting device to VTP SERVER mode.

sw2(config)#vlan 3

sw2(config)#vtp mode client

Setting device to VTP CLIENT mode.

sw2(config)#int f0/1

sw2(config-if)#no sh

sw1上和sw2上的vlan信息和vtp状态是相同的:

sw1(config-vlan)#do sh vtp sta

Configuration Revision          : 2          修订编号变为2

Number of existing VLANs        : 7          vlan1

VTP Operating Mode              : Server

VTP Domain Name                 : cisco

 

5)   断开trunksw1创建vlan4sw2创建vlan5,连接trunk,结果发现互相不会学习,因为修订编号没有改变。

sw1(config)#int f0/1

sw1(config-if)#shutdown

sw1(config)#vlan 4

sw1(config-vlan)#do sh vlan

1    default                          active   

2    VLAN0002                         active   

3    VLAN0003                         active   

4    VLAN0004                         active   

sw1(config-vlan)#do sh vtp sta

Configuration Revision          : 3

Number of existing VLANs        : 8

VTP Operating Mode              : Server

VTP Domain Name                 : cisco

sw2(config)#vtp mode server

sw2(config)#vlan 5

sw2(config)#vtp mode client

sw2(config)#do sh vlan

1    default                          active  

2    VLAN0002                         active   

3    VLAN0003                         active   

5    VLAN0005                         active   

sw2(config)#do sh vtp sta

Configuration Revision          : 3

Number of existing VLANs        : 8

VTP Operating Mode              : Client

VTP Domain Name                 : cisco

sw1(config-vlan)#int f0/1

sw1(config-if)#no sh

连接后发现再show vlanshow vtp status结果跟刚才一样,并没有改变。

 

6)   Sw1上创建vlan6sw2上同步了,vlan5不存在了,完全同步了。

sw1(config)#vlan 6

sw1#sh vlan

1    default                          active  

2    VLAN0002                         active   

3    VLAN0003                         active   

4    VLAN0004                         active   

6    VLAN0006                         active   

sw1#sh vtp sta

Configuration Revision          : 4

Number of existing VLANs        : 9

VTP Operating Mode              : Server

VTP Domain Name                 : cisco

sw2#sh vlan

1    default                          active  

2    VLAN0002                         active   

3    VLAN0003                         active   

4    VLAN0004                         active   

6    VLAN0006                         active   

sw2#sh vtp sta

Configuration Revision          : 4

Number of existing VLANs        : 9

VTP Operating Mode              : Client

VTP Domain Name                 : cisco
 
----本文档由 联科教育 ( http://www.iLync.cn)原创提供,有任何问题访问我们站点并咨询我们专家团队,谢谢!