实验目的
理解VTP的三种模式
熟悉VTP的配置
实验拓扑
VTP
实验过程
第一步 配置SW1和SW2之间、SW3和SW2之间Trunk
SW1# configure terminal

SW1(config-if)# interface f0/11
SW1(config-if)# switchport mode trunk
SW2# configure terminal
SW2(config)# interface f0/11
SW2(config-if)# switchport mode trunk
SW2(config-if)# interface f0/14
W2(config-if)# switchport mode trunk
SW3# configure terminal
SW3(config)# interface f0/14
SW3(config-if)# switchport mode trunk
第二步 配置SW1为VTP   server
SW1# vlan database
SW1(vlan)# vtp domain ccna
SW1(vlan)# vtp server .
SW1(vlan)# vtp password 123
SW1(vlan)# exit
APPLY completed.
Exiting….
[ 绿色表示在全局控制模式下进行的配置=上面在数据库模式下的配置]
SW1(config)#vtp mode server
Device mode already VTP SERVER.
//以上配置SW1 为VTP server,实际上这是默认值
SW1(config)#vtp domain ccna
Changing VTP domain name from NULL to ccna
//以上配置VTP 域名
SW1(config)#vtp password 123
Setting device VLAN database password to 123
//以上配置VTP 的密码,目的是为了安全,防止不明身份的交换机加入到域中
第三步 配置SW3为VTP  transparent
SW3# vlan database                            //进入数据库模式
SW3(vlan)# vtp transparent                 //配置SW3的VTP为transpsrent
SW3(vlan)# vtp domain ccna              //配置VTP域名为ccna
SW3(vlan)# vtp password 123           //配置VTP的密码为123
SW3(vlan)# exit                                  //退出数据库模式使配置生效
APPLY completed.
Exiting….
第四步 配置SW2为VTP   client
SW2# vlan database
SW2(vlan)# vtp domain ccna
Domain name already set to ccna .
SW2(vlan)# vtp client
SW2(vlan)# vtp password 123
SW3(vlan)# exit
APPLY completed.
Exiting….
SW2(config)#vtp mode client
Setting device to VTP CLIENT mode.
SW2(config)#vtp domain ccna
Domain name already set to ccna
SW2(config)#vtp password 123 
实验调试
在SW1上创建VLAN,检查SW2 和SW3的VLAN信息
SW1# vlan database
SW1(vlan)# vlan 2 name vlan002
VLAN 2 added:
    Name: vlan002
SW1(vlan)# vlan 3 name vlan003
VLAN 3 added:
    Name: vlan003
SW1(vlan)# exit 
SW2# show vlan-switch             
VLAN Name                             Status    Ports
—- ——————————– ——— ——————————-
1    default                          active    Fa0/0, Fa0/1, Fa0/2, Fa0/3
                                                Fa0/4, Fa0/5, Fa0/6, Fa0/7
                                                Fa0/8, Fa0/9, Fa0/10, Fa0/13
                                                Fa0/14, Fa0/15
2    vlan002                          active   
3    vlan003                          active
      //可以看到SW2已经学到SW1上创建的信息                          
1002 fddi-default                     active   
1003 token-ring-default               active   
1004 fddinet-default                  active   
1005 trnet-default                    active  
VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
—- —– ———- —– —— —— ——– —- ——– —— ——
1    enet  100001     1500  -      -      -        -    -        1002   1003
2    enet  100002     1500  -      -      -        -    -        0      0  
3    enet  100003     1500  -      -      -        -    -        0      0  
1002 fddi  101002     1500  -      0      -        -    -        1      1003
1003 tr    101003     1500  1005   0      -        -    srb      1      1002
1004 fdnet 101004     1500  -      -      1        ibm  -        0      0  
1005 trnet 101005     1500  -      -      1        ibm  -        0      0
SW3# show vlan-switch
VLAN Name                             Status    Ports
—- ——————————– ——— ——————————-
1    default                          active    Fa0/0, Fa0/1, Fa0/2, Fa0/3
                                                Fa0/4, Fa0/5, Fa0/6, Fa0/7
                                                Fa0/8, Fa0/9, Fa0/10, Fa0/11
                                                Fa0/12, Fa0/13, Fa0/14, Fa0/15
1002 fddi-default                     active   
1003 token-ring-default               active   
1004 fddinet-default                  active   
1005 trnet-default                    active  
VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
—- —– ———- —– —— —— ——– —- ——– —— ——
1    enet  100001     1500  -      -      -        -    -        1002   1003
1002 fddi  101002     1500  -      -      -        -    -        1      1003
1003 tr    101003     1500  1005   0      -        -    srb      1      1002
1004 fdnet 101004     1500  -      -      1        ibm  -        0      0  
1005 trnet 101005     1500  -      -      1        ibm  -        0      0 
//可以看到SW2上有了VLAN002和VLAN 003的信息,而SW3上并没有。因为S3是透明模式
查看VTP信息
SW1# show vtp status
VTP Version                     : 2                    //该VTP支持版本2
Configuration Revision          : 1                //修订号为2,该数值很重要
Maximum VLANs supported locally : 256
Number of existing VLANs        : 7            //VLAN数量
VTP Operating Mode              : Server      //VTP模式
VTP Domain Name                 : ccna        //VTP域名
VTP Pruning Mode                : Disabled    //VTP修剪有没有启动
VTP V2 Mode                     : Disabled     //VTP版本2没有启用,现在是版本1
VTP Traps Generation            : Disabled
MD5 digest                      : 0×42 0×36 0×25 0×9D 0xE3 0xA0 0xF5 0xAE
Configuration last modified by 0.0.0.0 at 3-1-02 00:17:55
Local updater ID is 0.0.0.0 (no valid interface found)