配置 VLAN 中继协议 (VTP)

简介本文档介绍如何配置 VLAN 中继协议 (VTP)。

先决条件要求本文档没有任何特定的要求。

使用的组件本文档不限于特定的软件和硬件版本。

本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您的网络处于活动状态,请确保您了解所有命令的潜在影响。

规则有关文档规则的详细信息,请参阅思科技术提示规则。

背景信息VTP 可简化交换网络中的管理。在一台 VTP 服务器上配置新的 VLAN 时,该 VLAN 将通过域中的所有交换机进行分发。这样可以减少在各处配置相同 VLAN 的需求。VTP 是一种 Cisco 专有协议,适用于大多数 Cisco Catalyst 系列产品。

有关VTP的详细信息,请参阅了解VLAN中继协议(VTP)。

注意:只有思科注册用户才能访问内部站点、工具和文档。

配置VTP 配置指南本部分提供在网络中配置 VTP 的一些指南。

除非网络设计需要不同的VTP域,否则所有交换机都具有相同的VTP域名。

注意:中继协商无法跨 VTP 域运行。有关详细信息,请参阅配置VLAN中继协议(VTP)中的VTP域之间阻止的数据流量部分。

VTP 域中的所有交换机都必须运行相同的 VTP 版本。

VTP域中的所有交换机都具有相同的VTP口令(如果有)。

所有VTP服务器交换机都必须具有相同的配置修订版号,并且还必须是域中的最高修订版。

当您将交换机的VTP模式从透明模式移到服务器时,服务器交换机上必须存在在VTP透明交换机上配置的VLAN。

Catalyst 交换机上的 VTP 配置本部分提供了一些基本命令,用于在最常用的 Catalyst 交换机上配置 VTP。

配置VTP有两种方法,如本部分所示。这些方法的可用性可能与Cisco IOS®软件的版本不同。例如,方法1在较新版本的Cisco IOS上不可用,另一方面,方法2(全局配置模式)在旧版软件中不可用。

方法1,在VLAN数据库模式下:

在 Cisco IOS 软件中,您可以在 VLAN 配置模式下配置 VTP 域名、VTP 模式和 VLAN。

在 EXEC 模式下,发出以下命令以进入 VLAN 配置模式:

Switch#vlan database

!--- Issue this command in privileged EXEC mode,

!--- not in global configuration mode.

Switch(vlan)#

!--- This is VLAN configuration mode.

发出以下命令以设置 VTP 域名:

Switch(vlan)#vtp domain example

发出以下命令以设置 VTP 模式:

Switch(vlan)#vtp {client | server | transparent}

发出 exit 命令以退出 VLAN 配置模式。

注意:end 和 Ctrl-Z 命令在此模式下不起作用。

Switch(vlan)#end

Switch(vlan)#^Z

% Invalid input detected at '^' marker.

Switch(vlan)#

Swtch(vlan)#exit

APPLY completed.

Exiting....

Switch#

方法2,在全局配置模式下:

在 Cisco IOS 软件全局配置模式下,您可以使用 Cisco IOS 软件命令配置所有的 VTP 参数。命令格式如下:

Switch(config)#vtp ?

domain Set the name of the VTP administrative domain.

file Configure IFS filesystem file where VTP configuration is stored.

interface Configure interface as the preferred source for the VTP IP updater

address.

mode Configure VTP device mode

password Set the password for the VTP administrative domain

pruning Set the administrative domain to permit pruning

version Set the administrative domain to VTP version

Switch#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#vtp domain ?

WORD The ascii name for the VTP administrative domain.

Switch(config)#vtp domain example

Changing VTP domain name from example to example

Switch(config)#vtp mode server

发出以下命令以监控 VTP 操作和状态:

Switch#show vtp status

VTP Version capable : 1 to 3

VTP version running : 2

VTP Domain Name : example

VTP Pruning Mode : Disabled

VTP Traps Generation : Disabled

Device ID : 6400.f13e.dc40

Configuration last modified by 10.122.190.226 at 0-0-00 00:00:00

Local updater ID is 10.122.190.226 on interface Fa1 (first layer3 interface found)

Feature VLAN:

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

VTP Operating Mode : Server

Maximum VLANs supported locally : 1005

Number of existing VLANs : 16

Configuration Revision : 0

MD5 digest : 0x0A 0xF4 0xFD 0xE9 0x99 0xD7 0xAB 0x3F

0x0A 0x64 0x04 0x7C 0x42 0x98 0xD8 0xE5

Switch#

Switch#show vtp counters

VTP statistics:

Summary advertisements received : 0

Subset advertisements received : 0

Request advertisements received : 0

Summary advertisements transmitted : 0

Subset advertisements transmitted : 0

Request advertisements transmitted : 0

Number of config revision errors : 0

Number of config digest errors : 0

Number of V1 summary errors : 0

VTP pruning statistics:

Trunk Join Transmitted Join Received Summary advts received from

non-pruning-capable device

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

Switch#

实例示例 1:

本示例涉及两个通过TenGigabitEthernet链路连接的Catalyst 4500交换机:

交换机A是没有VTP域名和没有VLAN的新交换机。Switch-C是当前存在的交换机,在VTP域测试中运行有16个VLAN。

在show vtp status命令的输出示例中,您可以看到VTP版本默认为1,交换机A支持VTP V2。然而,在本例中,交换机不会运行 VTP V2。如果使用vtp version 2命令配置了V2版本,则交换机只运行VTP V2。在本示例中,交换机A配置为VTP客户端。在连接到网络之前,还必须确保所连接的交换机的配置修订版为0,或者低于当前VTP服务器的值:

Switch-A#show vtp status

VTP Version capable : 1 to 3

VTP version running : 1

VTP Domain Name :

VTP Pruning Mode : Disabled

VTP Traps Generation : Disabled

Device ID : 6400.f13e.dc40

Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00

Local updater ID is 10.122.190.226 on interface Fa1 (first layer3 interface found)

Feature VLAN:

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

VTP Operating Mode : Server

Maximum VLANs supported locally : 1005

Number of existing VLANs : 5

Configuration Revision : 0

MD5 digest : 0x57 0xCD 0x40 0x65 0x63 0x59 0x47 0xBD

0x56 0x9D 0x4A 0x3E 0xA5 0x69 0x35 0xBC

Switch-A#

Switch-A#

Switch-A#

Switch-A#show vlan brief

VLAN Name Status Ports

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

1 default active Gi1/1, Gi1/2, Gi1/4, Gi1/5

Gi1/6, Gi1/7, Gi1/8, Gi1/9

Gi1/10, Gi1/11, Gi1/12, Gi1/13

Gi1/14, Gi1/15, Gi1/16, Gi1/17

Gi1/18, Gi1/19, Gi1/20, Gi1/21

Gi1/22, Gi1/23, Gi1/24, Gi1/25

Gi1/26, Gi1/27, Gi1/28, Gi1/29

Gi1/30, Gi1/31, Gi1/32, Gi1/33

Gi1/34, Gi1/35, Gi1/36, Gi1/37

Gi1/38, Gi1/39, Gi1/40, Gi1/41

Gi1/42, Gi1/43, Gi1/44, Gi1/45

Gi1/46, Gi1/47, Gi1/48, Te3/2

Te3/3, Te3/4, Te3/5, Te3/6

Te3/7, Te3/8

1002 fddi-default act/unsup

1003 token-ring-default act/unsup

1004 fddinet-default act/unsup

1005 trnet-default act/unsup

Switch-A#Switch-C#show vtp status

VTP Version capable : 1 to 3

VTP version running : 2

VTP Domain Name : test

VTP Pruning Mode : Disabled

VTP Traps Generation : Disabled

Device ID : 503d.e583.3b40

Configuration last modified by 10.122.190.227 at 11-24-22 13:44:22

Local updater ID is 10.122.190.227 on interface Fa1 (first layer3 interface found)

Feature VLAN:

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

VTP Operating Mode : Server

Maximum VLANs supported locally : 1005

Number of existing VLANs : 16

Configuration Revision : 4

MD5 digest : 0xCB 0x67 0x2A 0xF1 0x9A 0x8D 0xD3 0x1B

0xA8 0xB3 0x89 0xB2 0x32 0x63 0xA6 0xD0

Switch-C#

Switch-C#show vlan brief

VLAN Name Status Ports

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

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

Gi1/5, Gi1/6, Gi1/7, Gi1/8

Gi1/9, Gi1/10, Gi1/11, Gi1/12

Gi1/13, Gi1/14, Gi1/15, Gi1/16

Gi1/17, Gi1/18, Gi1/19, Gi1/20

Gi1/21, Gi1/22, Gi1/23, Gi1/24

Gi1/25, Gi1/26, Gi1/27, Gi1/28

Gi1/29, Gi1/30, Gi1/31, Gi1/32

Gi1/33, Gi1/34, Gi1/35, Gi1/36

Gi1/37, Gi1/38, Gi1/39, Gi1/40

Gi1/41, Gi1/42, Gi1/43, Gi1/44

Gi1/45, Gi1/46, Gi1/47, Gi1/48

Te3/2, Te3/3, Te3/4, Te3/5

Te3/6, Te3/7, Te3/8

2 VLAN0002 active

3 VLAN0003 active

4 VLAN0004 active

5 VLAN0005 active

6 VLAN0006 active

7 VLAN0007 active

VLAN Name Status Ports

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

8 VLAN0008 active

9 VLAN0009 active

10 VLAN0010 active

11 VLAN0011 active

12 VLAN0012 active

1002 fddi-default act/unsup

1003 trcrf-default act/unsup

1004 fddinet-default act/unsup

1005 trbrf-default act/unsup

Switch-C#Switch-A#

Switch-A#configure terminal

Switch-A(config)#vtp version 2

Switch-A(config)#vtp mode client

Setting device to VTP Client mode for VLANS.

Switch-A(config)#end

Switch-A#

Switch-A#show vtp status

VTP Version capable : 1 to 3

VTP version running : 2

VTP Domain Name :

VTP Pruning Mode : Disabled

VTP Traps Generation : Disabled

Device ID : 6400.f13e.dc40

Configuration last modified by 10.122.190.226 at 11-25-22 02:34:10

Feature VLAN:

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

VTP Operating Mode : Client

Maximum VLANs supported locally : 1005

Number of existing VLANs : 5

Configuration Revision : 1

MD5 digest : 0xD2 0x3F 0x31 0x25 0x6D 0xD1 0x3E 0x27

0x62 0x77 0x7C 0xAF 0x0F 0xF6 0x72 0x02

Switch-A#

在此阶段,两台交换机之间手动创建了TRUNK。请注意这两台交换机如何同步,并观察 VTP 分组交换:

Switch-A#debug sw-vlan vtp events

vtp events debugging is on

Switch-A#debug sw-vlan vtp packets

vtp packets debugging is on

Switch-A#Switch-A#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

Switch-A(config)#interface tenGigabitEthernet3/2

Switch-A(config-if)#no shut

Switch-A(config-if)#end

Switch-A#

交换机C向交换机A发送总结通告。交换机A随后从中获取VTP域名,如以下输出示例所示:

!--- On Switch-A:*Nov 25 02:45:46.580: VTP LOG RUNTIME: switchport trunk mode on Te3/2 has changed

*Nov 25 02:45:46.580: VTP LOG RUNTIME: delaying first flood on new trunk

*Nov 25 02:45:51.100: VTP LOG RUNTIME: Summary packet received in NULL domain state

*Nov 25 02:45:51.100: VTP LOG RUNTIME: Summary packet received, domain = test, rev = 4, followers = 0, length 80, trunk Te3/2

!--- This indicates that Switch-A has received its first summary advertisement.*Nov 25 02:45:51.100: VTP LOG RUNTIME: Validate TLVs : #tlvs 1, max blk size 4

*Nov 25 02:45:51.100: VTP LOG RUNTIME: Validate TLVs : #00, val 6, len 4

*Nov 25 02:45:51.100:

*Nov 25 02:45:51.100: summary: 02 01 00 04 74 65 73 74 00 00 00 00 00 00 00 00 ....test........

*Nov 25 02:45:51.100: summary: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

*Nov 25 02:45:51.100: summary: 00 00 00 00 00 00 00 04 0A 7A BE E3 32 32 31 31 .........z>c2211

*Nov 25 02:45:51.100: summary: 32 34 31 34 30 31 31 35 8D 07 FE 82 E5 FE 49 AD 24140115..~.e~I-

*Nov 25 02:45:51.100: summary: 1A 6E A5 AB D0 35 C2 CA 00 00 00 01 06 01 00 02 .n%+P5BJ........

*Nov 25 02:45:51.100:

*Nov 25 02:45:51.108: VTP LOG RUNTIME: Transitioning from NULL to test domain!--- This is where Switch-A gets the VTP domain name.

启用调试后,您可以看到交换机A收到没有关注者的汇总通告。因此,交换机A更新其域名并发送通告请求以获取VLAN信息,如以下示例输出所示:

!--- On Switch-A*Nov 25 02:45:51.108: VTP LOG RUNTIME: Summary packet rev 4 greater than domain test rev 0

*Nov 25 02:45:51.108: VTP LOG RUNTIME: Domain test currently not in updating state

*Nov 25 02:45:51.108: VTP LOG RUNTIME: Summary packet with followers field zero

*Nov 25 02:45:51.108: VTP LOG RUNTIME: Transmit vtp request, domain test, start value 0

!--- This is where the advertisement request is sent.

交换机C向VLAN 1发送另一个带有字段跟随器的汇总通告。包含所有VLAN的子集通告将显示在此输出中。然后,交换机A配置所有VLAN:

!--- On Switch-A:*Nov 25 02:45:51.595: VTP LOG RUNTIME: Summary packet received, domain = test, rev = 4, followers = 1, length 80, trunk Te3/2

!--- Switch-A has received its second summary advertisement.!--- This configuration revision is higher than that on Switch-A. *Nov 25 02:45:51.595: VTP LOG RUNTIME: Validate TLVs : #tlvs 1, max blk size 4

*Nov 25 02:45:51.595: VTP LOG RUNTIME: Validate TLVs : #00, val 6, len 4

*Nov 25 02:45:51.595:

*Nov 25 02:45:51.596: summary: 02 01 01 04 74 65 73 74 00 00 00 00 00 00 00 00 ....test........

*Nov 25 02:45:51.596: summary: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

*Nov 25 02:45:51.596: summary: 00 00 00 00 00 00 00 04 0A 7A BE E3 32 32 31 31 .........z>c2211

*Nov 25 02:45:51.596: summary: 32 34 31 34 30 31 31 35 8D 07 FE 82 E5 FE 49 AD 24140115..~.e~I-

*Nov 25 02:45:51.596: summary: 1A 6E A5 AB D0 35 C2 CA 00 00 00 01 06 01 00 02 .n%+P5BJ........

*Nov 25 02:45:51.596:

*Nov 25 02:45:51.596: VTP LOG RUNTIME: Summary packet rev 4 greater than domain test rev 0

*Nov 25 02:45:51.596: VTP LOG RUNTIME: Domain test currently not in updating state

*Nov 25 02:45:51.596: VTP LOG RUNTIME: pdu len 80, #tlvs 1

*Nov 25 02:45:51.596: VTP LOG RUNTIME: Subset packet received, domain = test, rev = 4, seq = 1, length = 420

!--- Switch-A has received its subset advertisement.*Nov 25 02:45:51.596: subset: 02 02 01 04 74 65 73 74 00 00 00 00 00 00 00 00 ....test........

*Nov 25 02:45:51.596: subset: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

*Nov 25 02:45:51.596: subset: 00 00 00 00 00 00 00 04 14 00 01 07 00 01 05 DC ...............\

*Nov 25 02:45:51.596: subset: 00 01 86 A1 64 65 66 61 75 6C 74 00 14 00 01 08 ...!default.....

*Nov 25 02:45:51.596: subset: 00 02 05 DC 00 01 86 A2 56 4C 41 4E 30 30 30 32 ...\..."VLAN0002

*Nov 25 02:45:51.596: subset: 14 00 01 08 00 03 05 DC 00 01 86 A3 56 4C 41 4E .......\...#VLAN

*Nov 25 02:45:51.596: subset: 30 30 30 33 14 00 01 08 00 04 05 DC 00 01 86 A4 0003.......\...$

*Nov 25 02:45:51.596: subset: 56 4C 41 4E 30 30 30 34 14 00 01 08 00 05 05 DC VLAN0004.......\

*Nov 25 02:45:51.596: subset: 00 01 86 A5 56 4C 41 4E 30 30 30 35 14 00 01 08 ...%VLAN0005....

*Nov 25 02:45:51.596: subset: 00 06 05 DC 00 01 86 A6 56 4C 41 4E 30 30 30 36 ...\...&VLAN0006

*Nov 25 02:45:51.596: subset: 14 00 01 08 00 07 05 DC 00 01 86 A7 56 4C 41 4E .......\...'VLAN

*Nov 25 02:45:51.596: subset: 30 30 30 37 14 00 01 08 00 08 05 DC 00 01 86 A8 0007.......\...(

*Nov 25 02:45:51.596: subset: 56 4C 41 4E 30 30 30 38 14 00 01 08 00 09 05 DC VLAN0008.......\

*Nov 25 02:45:51.596: subset: 00 01 86 A9 56 4C 41 4E 30 30 30 39 14 00 01 08 ...)VLAN0009....

*Nov 25 02:45:51.596: subset: 00 0A 05 DC 00 01 86 AA 56 4C 41 4E 30 30 31 30 ...\...*VLAN0010

*Nov 25 02:45:51.596: subset: 14 00 01 08 00 0B 05 DC 00 01 86 AB 56 4C 41 4E .......\...+VLAN

*Nov 25 02:45:51.596: subset: 30 30 31 31 14 00 01 08 00 0C 05 DC 00 01 86 AC 0011.......\...,

*Nov 25 02:45:51.596: subset: 56 4C 41 4E 30 30 31 32 18 00 02 0C 03 EA 05 DC VLAN0012.....j.\

*Nov 25 02:45:51.596: subset: 00 01 8A 8A 66 64 64 69 2D 64 65 66 61 75 6C 74 ....fddi-default

*Nov 25 02:45:51.596: subset: 30 00 03 0D 03 EB 11 78 00 01 8A 8B 74 72 63 72 0....k.x....trcr

*Nov 25 02:45:51.596: subset: 66 2D 64 65 66 61 75 6C 74 00 00 00 01 01 0C CC f-default......L

*Nov 25 02:45:51.596: subset: 04 01 03 ED 07 01 00 02 08 01 00 07 09 01 00 07 ...m............

*Nov 25 02:45:51.596: subset: 20 00 04 0F 03 EC 05 DC 00 01 8A 8C 66 64 64 69 ....l.\....fddi

*Nov 25 02:45:51.596: subset: 6E 65 74 2D 64 65 66 61 75 6C 74 00 03 01 00 01 net-default.....

*Nov 25 02:45:51.596: subset: 24 00 05 0D 03 ED 11 78 00 01 8A 8D 74 72 62 72 $....m.x....trbr

*Nov 25 02:45:51.596: subset: 66 2D 64 65 66 61 75 6C 74 00 00 00 02 01 00 0F f-default.......

*Nov 25 02:45:51.596: subset: 03 01 00 02 ....

*Nov 25 02:45:51.596:

*Nov 25 02:45:51.666: VTP LOG RUNTIME: Transmit vtp summary, domain test, rev 4, followers 1, tlv blk size 8 (inc #tlv field),

MD5 digest calculated = 8D 07 FE 82 E5 FE 49 AD 1A 6E A5 AB D0 35 C2 CA

此时,两台交换机会进行同步:

Switch-A#show vtp status

VTP Version capable : 1 to 3

VTP version running : 2

VTP Domain Name : test

VTP Pruning Mode : Disabled

VTP Traps Generation : Disabled

Device ID : 6400.f13e.dc40

Configuration last modified by 10.122.190.227 at 11-24-22 14:01:15

Feature VLAN:

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

VTP Operating Mode : Client

Maximum VLANs supported locally : 1005

Number of existing VLANs : 16

Configuration Revision : 4

MD5 digest : 0x8D 0x07 0xFE 0x82 0xE5 0xFE 0x49 0xAD

0x1A 0x6E 0xA5 0xAB 0xD0 0x35 0xC2 0xCA

Switch-A#show vlan brief

VLAN Name Status Ports

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

1 default active Gi1/1, Gi1/2, Gi1/4, Gi1/5

Gi1/6, Gi1/7, Gi1/8, Gi1/9

Gi1/10, Gi1/11, Gi1/12, Gi1/13

Gi1/14, Gi1/15, Gi1/16, Gi1/17

Gi1/18, Gi1/19, Gi1/20, Gi1/21

Gi1/22, Gi1/23, Gi1/24, Gi1/25

Gi1/26, Gi1/27, Gi1/28, Gi1/29

Gi1/30, Gi1/31, Gi1/32, Gi1/33

Gi1/34, Gi1/35, Gi1/36, Gi1/37

Gi1/38, Gi1/39, Gi1/40, Gi1/41

Gi1/42, Gi1/43, Gi1/44, Gi1/45

Gi1/46, Gi1/47, Gi1/48, Te3/3

Te3/4, Te3/5, Te3/6, Te3/7

Te3/8

2 VLAN0002 active

3 VLAN0003 active

4 VLAN0004 active

5 VLAN0005 active

6 VLAN0006 active

7 VLAN0007 active

VLAN Name Status Ports

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

8 VLAN0008 active

9 VLAN0009 active

10 VLAN0010 active

11 VLAN0011 active

12 VLAN0012 active

1002 fddi-default act/unsup

1003 trcrf-default act/unsup

1004 fddinet-default act/unsup

1005 trbrf-default act/unsup

示例 2:

本示例显示如何在运行 Cisco IOS 软件的 Catalyst 6000 上验证 VTP 配置:

Switch#show vtp status

VTP Version: 2

Configuration Revision: 247

Maximum VLANs supported locally: 1005

Number of existing VLANs: 33

VTP Operating Mode: Client

VTP Domain Name: Lab_Network

VTP Pruning Mode: Enabled

VTP V2 Mode: Disabled

VTP Traps Generation: Disabled

MD5 digest: 0x45 0x52 0xB6 0xFD 0x63 0xC8 0x49 0x80

Configuration last modified by 0.0.0.0 at 8-12-99 15:04:49

Switch#

示例 3:

本示例显示如何在运行 Cisco IOS 软件的 Catalyst 6000 上显示 VTP 统计数据:

Switch#show vtp counters

VTP statistics:

Summary advertisements received: 7

Subset advertisements received: 5

Request advertisements received: 0

Summary advertisements transmitted: 997

Subset advertisements transmitted: 13

Request advertisements transmitted: 3

Number of config revision errors: 0

Number of config digest errors: 0

Number of V1 summary errors: 0

VTP pruning statistics:

Trunk Join Transmitted Join Received Summary advts received

from on-pruning-capable device

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

Fa5/8 43071 42766 5

VTP 故障排除有关VTP故障排除的信息,请参阅配置VLAN中继协议(VTP)。

注意:只有思科注册用户才能访问内部站点、工具和文档。

相关信息

虚拟 LAN/VLAN 中继协议 (VLAN/VTP)

IP 路由

Cisco IOS配置基础命令参考

思科技术支持和下载

Copyright © 2088 02年世界杯中国队_1930年乌拉圭世界杯 - n360l.com All Rights Reserved.
友情链接