VTP 配置<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

1. 实验目的

通过本实验,读者可以掌握如下技能:

1) 理解VTP 的三种模式

2) 熟悉VTP 的配置

2. 实验拓扑

13-4 实验3 拓扑图

3. 实验步骤

1)设置交换机S1F0/10/2trunk

S1(config)#interface fastEthernet 0/1

S1(config-if)#switchport mode trunk

S1(config)#interface fastEthernet 0/2

S1(config-if)#switchport mode trunk

 

2) 配置S1 VTP server

S1(config)#vtp mode server

Device mode already VTP SERVER.

//以上配置S1 VTP server,实际上这是默认值

S1(config)#vtp domain VTP-TEST

Changing VTP domain name from NULL to VTP-TEST

//以上配置VTP 域名

S1(config)#vtp password cisco

Setting device VLAN database password to cisco

//以上配置VTP 的密码,目的是为了安全,防止不明身份的交换机加入到域中

3) 配置S3 VTP transparent

S3#vlan database

S3(vlan)#vtp transparent

Setting device to VTP TRANSPARENT mode.

S3(vlan)#vtp domain VTP-TEST

Domain name already set to VTP-TEST .

S3(vlan)#vtp password cisco

Setting device VLAN database password to cisco.

【提示】有的IOS 版本只支持在vlan database 下配置vlan

5) 配置S2 VTP client

S2(config)#vtp mode client

Setting device to VTP CLIENT mode.

S2(config)#vtp domain VTP-TEST

Domain name already set to VTP-TEST.

S2(config)#vtp password cisco

4. 实验调试

1) 在S1 上创建VLAN,检查S2S3 上的VLAN 信息

S1(config)#vlan 2

S1(config)#vlan 3

S2#show vlan

VLAN Name Status Ports

---- -------------------------------- --------- -------------------------------

1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4

Fa0/5, Fa0/6, Fa0/7, Fa0/8

2 VLAN0002 active

3 VLAN0003 active

1002 fddi-default act/unsup

//可以看到S2 已经学习到了在S1 上创建的VLAN 了。

S3#show vlan

VLAN Name Status Ports

---- -------------------------------- --------- -------------------------------

1 default active Fa0/3, Fa0/4, Fa0/5, Fa0/6

Fa0/7, Fa0/8, Fa0/9, Fa0/10

Fa0/11, Fa0/12

1002 fddi-default active

1003 token-ring-default active

1004 fddinet-default active

1005 trnet-default active

//可以看到S2 上有了VLAN2 VLAN3,而S3 上并没有,因为S3 是透明模式。

2) 查看VTP 信息

S1#show vtp status

VTP Version : 2 //VTP 支持版本2

Configuration Revision : 2 //修订号为2,该数值非常重要

Maximum VLANs supported locally : 1005

Number of existing VLANs : 7 //VLAN 数量

VTP Operating Mode : Server //VTP 模式

VTP Domain Name : VTP-TEST //VTP 域名

VTP Pruning Mode : Disabled //VTP 修剪没有启用

VTP V2 Mode : Disabled //VTP 版本2 没有启用,现在是版本1

VTP Traps Generation : Disabled

MD5 digest : 0xD4 0x30 0xE7 0xB7 0xDC 0xDF 0x1B 0xD8

Configuration last modified by <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />0.0.0.0 at 3-1-93 00:22:16

Local updater ID is 0.0.0.0 (no valid interface found)

3) 观察VTP revision 数值

S1 上,修改、创建或者删除VLAN,在S2S3 上观察revision 数值是否增加1

4) 配置修剪、版本2

S1(config)#vtp pruning

S1(config)#vtp version 2

S1#show vtp status

VTP Version : 2

Configuration Revision : 4

Maximum VLANs supported locally : 1005

Number of existing VLANs : 7

VTP Operating Mode : Server

VTP Domain Name : VTP-TEST

VTP Pruning Mode : Enabled //VTP 修剪启用了

VTP V2 Mode : Enabled //VTP 版本为2

VTP Traps Generation : Disabled

MD5 digest : 0xA6 0x56 0x25 0xDE 0xE2 0x39 0x6A 0x10

Configuration last modified by 0.0.0.0 at 3-1-93 00:32:28

Local updater ID is 0.0.0.0 (no valid interface found)

【提示】VTP 修剪和VTP 版本只需要在一个VTP server 进行即可,其他server 或者client

会自动跟着更改。VTP 修剪是为了防止不必要的流量从trunk 链路上通过,通常需要启用。