本文档介绍Catalyst交换机上的VLAN中继协议(VTP)配置。
本文档没有任何特定的要求。
本文档涵盖各种Catalyst交换机型号,并不限于特定软件版本。
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您的网络处于活动状态,请确保您了解所有命令的潜在影响。
VTP 可简化交换网络中的管理。在一台 VTP 服务器上配置新的 VLAN 时,该 VLAN 将通过域中的所有交换机进行分发。这样可以减少在各处配置相同 VLAN 的需求。VTP 是一种 Cisco 专有协议,适用于大多数 Cisco Catalyst 系列产品。
有关VTP的详细信息,请参阅了解VLAN中继协议(VTP)。
本部分提供在网络中配置 VTP 的一些指南。
除非网络设计需要不同的VTP域,否则所有交换机都必须共享相同的VTP域名
VTP 域中的所有交换机都必须运行相同的 VTP 版本。
VTP域中的所有交换机都具有相同的VTP口令(如果有)。
对于VTP第1版和第2版,在将交换机连接到现有VTP域之前,请验证配置修订版。处于VTP服务器或客户端模式的交换机,如果配置有较高的配置修订版并匹配VTP域名和口令,则在配置时可能会导致其它交换机替换其VLAN数据库。在连接交换机之前,请使用平台支持的过程将配置修订版重置为0。
如果将交换机配置为VTP透明模式,则可以创建和修改VLAN,但这些更改不会发送到域中的其它交换机,并且只影响单个交换机。
注意:对于需要VTP的新部署,请在支持的平台和软件版本上使用VTP版本3。在从VTP版本1或2迁移之前,验证平台兼容性和部署要求。
本部分提供了一些基本命令,用于在最常用的 Catalyst 交换机上配置 VTP。
本节介绍两种配置VTP的方法。方法可用性取决于Catalyst平台和Cisco IOS软件版本。仅在支持此传统方法的版本上使用VLAN数据库模式。在支持的当前版本上使用全局配置模式。
方法1. VLAN数据库模式(传统)
在支持的传统Cisco IOS软件版本中,可以将VTP域名、VTP模式和VLAN配置为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 配置模式。
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 XE全局配置模式下,可以通过运行以下命令配置所有VTP参数:
Switch#configure terminal Enter configuration commands, one per line. End with CNTL/Z. 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(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 Switch(config)#end
运行以下命令以验证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交换机:
步骤1.交换机A是没有VTP域名且没有用户配置VLAN的新交换机。Switch-C是当前存在的交换机,在VTP域测试中运行有16个VLAN。
步骤2.在show vtp status命令的输出示例中,您可以看到VTP版本默认为1,交换机A支持VTP V2。然而,在本例中,交换机不会运行 VTP V2。如果使用vtp version 2命令配置了V2版本,则交换机只运行VTP V2。在本示例中,交换机A配置为VTP客户端。在将交换机连接到VTP域之前,请确保其VTP模式、版本、域名、口令和配置修订版正确。对于VTP版本1和2,请使用平台支持的过程重置配置修订版,并在连接之前验证修订版是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#
步骤3.在此阶段,在两台交换机之间手动创建中继。请注意这两台交换机如何同步,并观察 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#
步骤4.交换机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
!--- Switch-A learns the VTP domain at this stage.
步骤5.启用debug后,您可以看到交换机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.
步骤6.交换机C发送另一个跟随者字段设置为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
步骤7.此时,两台交换机都同步:
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
注意:收集所需的输出后,使用undebug all命令禁用VTP调试条件,并验证调试不再处于活动状态。
示例2.此示例显示如何验证VTP版本运行和配置修订版号:
Switch#show vtp status
VTP Version capable : 1 to 3
VTP version running : 2
VTP Domain Name : Lab_Network
VTP Pruning Mode : Disabled (Operationally Disabled)
VTP Traps Generation : Disabled
Device ID : f87a.41a8.ca00
Configuration last modified by 10.10.10.2 at 8-17-26 20:47:55
Local updater ID is 10.10.10.2 on interface Vl10 (lowest numbered VLAN interface found)
Feature VLAN:
--------------
VTP Operating Mode : Server
Maximum VLANs supported locally : 1005
Number of existing VLANs : 6
Configuration Revision : 1
MD5 digest : 0xFD 0x47 0xA0 0x3D 0x02 0x88 0x96 0x04
0x52 0xDE 0x4D 0x51 0x6A 0x5E 0xEC 0x49
示例3.此示例说明如何显示VTP统计信息:
Swtich#show vtp counters
VTP statistics:
Summary advertisements received : 0
Subset advertisements received : 0
Request advertisements received : 0
Summary advertisements transmitted : 2
Subset advertisements transmitted : 2
Request advertisements transmitted : 10
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
---------------- ---------------- ---------------- ---------------------------
Te1/1/6 0 0 0
| 版本 | 发布日期 | 备注 |
|---|---|---|
5.0 |
18-Aug-2026
|
重新认证 — 更新的参与者列表和格式。 |
4.0 |
10-Jul-2025
|
已更新链接标题和格式。 |
3.0 |
27-Feb-2024
|
更新的CLI输出、样式要求、SEO、语法和格式。 |
2.0 |
24-Nov-2022
|
更新的CLI输出 |
1.0 |
29-Jul-2007
|
初始版本 |