实验三 VTP
一、 拓扑图
F0/1 Trunk F0/1 F0/2Trunk F0/1
SW14 SW16 SW13
二、实验原理
Sw14 sw16 sw13 vtp运行模式分别为 client server client,在这种模式下,sw16作为服务器,它的功能是向sw14和sw16发送汇总通告,通知它们交换机目前的vtp域名和配置修订号,两台client交换机收到了配置修订号大的汇总通告,则向sw16发送通告请求,sw16将含有vlan详细信息的子集通告发送给client。
另外一种情况,如果client中的修订号比server大,则server如果向client发送汇总通告,client则发送回sever汇总通告,通知它自己的修订号更大,这时server交换机就会发送请求通告请求client交换机它的vlan信息,client将含有vlan信息的子集通告回送给server交换机,当server交换机收到后更新vtp status信息 ,当它再次对vlan进行修改的时候修订号就会增加,而client的修订号不会再增加,所以client还是会向server学习。
三、实验步骤
1、基本配置
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname sw1
sw14(config)#no ip domain
sw14(config)#no ip domain-lookup
sw14(config)#line con 0
sw14(config-line)#logging s
sw14(config-line)#logging synchronous
sw14(config-line)#no login
sw14(config-line)#line vty 0 4
sw14(config-line)#no login
sw14(config-line)#end
2、创建vtp域,域名为cisco
Sw1:
sw1#vlan database
sw1(vlan)#vty domain cisco
sw1 (vlan)#vtp domain cisco
Domain name already set to cisco .
sw1 (vlan)#vtp client
Setting device to VTP CLIENT mode.
sw1 (vlan)#exit
Sw16:
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname sw2
Sw2(config)#no ip do
Sw2(config)#no ip domain-lookup
Sw2config)#line con 0
Sw2(config-line)#logging s
Sw2config-line)#logging synchronous
Sw2(config-line)#no login
Sw2(config-line)#line vty 0 4
Sw2(config-line)#no login
sw16(config-line)#end
sw2#
00:23:24: %SYS-5-CONFIG_I: Configured from console by console
Sw2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Sw2(config)#hostname sw2
sw2(config)#vlan database
sw2(config)#exit
sw2#vlan database
sw2(vlan)#vtp domain cisco
Domain name already set to cisco .
sw2(vlan)#vtp server
Device mode already VTP SERVER.
sw2(vlan)#exit
APPLY completed.
Exiting....
Sw13:
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname sw
sw3(config)#no ip domain
sw3(config)#no ip domain-lookup
sw3(config)#line con 0
sw3(config-line)#logging s
sw3(config-line)#logging synchronous
sw3(config-line)#no login
sw3(config-line)#line vty 0 4
sw3(config-line)#no login
sw3(config-line)#end
00:02:34: %SYS-5-CONFIG_I: Configured from console by console
sw3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
sw3(config)#hostname sw3
sw3(config)#exit
sw3#vlan
00:13:27: %SYS-5-CONFIG_I: Configured from console by console
sw3#vlan database
sw3(vlan)#vtp domain cisco
Domain name already set to cisco .
sw3(vlan)#vtp cl
sw3(vlan)#vtp client
Setting device to VTP CLIENT mode.
sw3(vlan)#vtp server
Setting device to VTP SERVER mode.
sw3(vlan)#end
sw3(vlan)#exit
APPLY completed.
Exiting....
sw3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
sw3(config)#exit
3、设置trunk
查看version
sw1#show version
Cisco Internetwork Operating System Software
IOS (tm) C2950 Software (C2950-I6K2L2Q4-M), Version 12.1(22)EA8a, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2006 by cisco Systems, Inc.
Compiled Fri 28-Jul-06 17:00 by weiliu
版本号c2950,所以不用封装协议
Sw14
sw1(config)#int f0/1
sw1(config-if)#switchport mode trunk
sw1(config-if)#no shutdown
sw1(config-if)#exit
sw1(config)#exit
sw16
sw2(config)#int rang f0/1 -2
sw2(config-if-range)#switchport mode trunk
sw2(config-if-range)#no shutdown
sw2(config-if-range)#exit
sw13
sw3(config)#INterface F0/1
sw3(config-if)#SWItchport mode trunk
查看trunk链路是否配置成功
sw14
sw1#show interface trunk
Explain:接口fa0/1的模式是on 封装协议是802.1q , 接口连接状态为trunk,本地vlan是vlan1. 该接口允许vlan1-4094 |
Fa0/1 on 802.1q trunking 1
Port Vlans allowed on trunk
Fa0/1 1-4094
Port Vlans allowed and active in management domain
Fa0/1 1-2,10
Port Vlans in spanning tree forwarding state and not pruned
Fa0/1 1-2,10
sw1#
sw16
sw2#show interfaces trunk
Port Mode Encapsulation Status Native vlan
Fa0/1 on 802.1q trunking 1
Fa0/2 on 802.1q trunking 1
Port Vlans allowed on trunk
Fa0/1 1-4094
Fa0/2 1-4094
Port Vlans allowed and active in management domain
Fa0/1 1
Fa0/2 1
Port Vlans in spanning tree forwarding state and not pruned
Fa0/1 1
Fa0/2 1
Sw13
sw3#show interfaces trunk
Port Mode Encapsulation Status Native vlan
Fa0/1 on 802.1q trunking 1
Port Vlans allowed on trunk
Fa0/1 1-1005
Port Vlans allowed and active in management domain
Fa0/1 1
Port Vlans in spanning tree forwarding state and not pruned
Fa0/1 1
查看后发现 trunk 数据链路已经配置成功
4 、查看有没有改变 vlan 之前的 vtp 参数
Sw13 :
sw3#show vtp s
sw3#show vtp status
VTP Version : 2 //vtp 的版本号为 2
Configuration Revision : 73 // 修订号为 73
Maximum VLANs supported locally : 64 // 本地支持最大 vlan 数目
Number of existing VLANs : 5 // 目前存在的 vlan 数目是 5
VTP Operating Mode : Server //vtp 的操作类型是 server
VTP Domain Name : cisco //vtp 的域名是 cisco
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xFE 0xB0 0xD1 0xBD 0x61 0x1B 0x8C 0x8B
Configuration last modified by 0.0.0.0 at 3-1-93 00:37:25
Local updater ID is 0.0.0.0 (no valid interface found)
Sw16 :
sw2#show vtp s
sw2#show vtp status
VTP Version : 2
Configuration Revision : 73
Maximum VLANs supported locally : 128
Number of existing VLANs : 5
VTP Operating Mode : Server
VTP Domain Name : cisco
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xFE 0xB0 0xD1 0xBD 0x61 0x1B 0x8C 0x8B
Configuration last modified by 0.0.0.0 at 3-1-93 00:37:25
Local updater ID is 0.0.0.0 (no valid interface found)
sw2#vlan d
sw2#vlan database
% Warning: It is recommended to configure VLAN from config mode,
as VLAN database mode is being deprecated. Please consult user
documentation for configuring VTP/VLAN in config mode.
Sw14 :
sw1#show vtp status
VTP Version : 2
Configuration Revision : 73
Maximum VLANs supported locally : 128
Number of existing VLANs : 5
VTP Operating Mode : Client
VTP Domain Name : cisco
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xFE 0xB0 0xD1 0xBD 0x61 0x1B 0x8C 0x8B
Configuration last modified by 0.0.0.0 at 3-1-93 00:37:25
sw1#show vtp stat
VTP Version : 2
Configuration Revision : 74
Maximum VLANs supported locally : 128
Number of existing VLANs : 6
VTP Operating Mode : Client
VTP Domain Name : cisco
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x54 0x32 0xC6 0x30 0x6F 0x45 0xD4 0x49
Configuration last modified by 0.0.0.0 at 3-1-93 00:56:02
Client 的 vlan 数目与修订号和 server 相同
5 、 sw16 上创建 vlan2
sw2(vlan)#vlan 2
VLAN 2 added:
Name: VLAN0002
sw2(vlan)#name server
sw2(vlan)#exit
APPLY completed.
Exiting....
6 、查看增加 vlan 后的 vtp 参数
Sw16 :
sw2#show vtp s
VTP Version : 2
Configuration Revision : 74
Maximum VLANs supported locally : 128
Number of existing VLANs : 6
VTP Operating Mode : Server
VTP Domain Name : cisco
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x54 0x32 0xC6 0x30 0x6F 0x45 0xD4 0x49
Configuration last modified by 0.0.0.0 at 3-1-93 00:56:02
Local updater ID is 0.0.0.0 (no valid interface found)
增加 vlan 后的 vtp 参数中修订号变为 73+1=74 , vlan 为 5+1=6
Sw14 :
sw1#show vtp stat
VTP Version : 2
Configuration Revision : 74
Maximum VLANs supported locally : 128
Number of existing VLANs : 6
VTP Operating Mode : Client
VTP Domain Name : cisco
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x54 0x32 0xC6 0x30 0x6F 0x45 0xD4 0x49
Configuration last modified by 0.0.0.0 at 3-1-93 00:56:02
增加 vlan 后的参数同 server 一样
Sw13 :
sw1#show vtp stat
VTP Version : 2
Configuration Revision : 74
Maximum VLANs supported locally : 128
Number of existing VLANs : 6
VTP Operating Mode : Client
VTP Domain Name : cisco
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x54 0x32 0xC6 0x30 0x6F 0x45 0xD4 0x49
Configuration last modified by 0.0.0.0 at 3-1-93 00:56:02
增加 vlan 后的参数同 server 一样
7 、查看其它交换机的 vlan 是否更改
sw3#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/2, Fa0/3, Fa0/4, Fa0/5
Fa0/6, Fa0/7, Fa0/8, Fa0/9
Fa0/10, Fa0/11, Fa0/12
2 VLAN0002 active
10 shengchan active
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
10 enet 100010 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
扩展实验
一、 拓扑图
二、实验原理
透明模式: S-T-C
首先, sw16 作为透明模式,它自身可以创建、添加和删除 vlan ,但只在本地生效
其次,它不学习不提供 VTP 消息
再次,它可以转发相同域名的 VTP 消息
当 server 发送汇总通告时, sw16 并不接受,而是将汇总通告转发给 client , client 收到后将请求通告通过 sw16 转发给 server , server 再通过 sw16 将子集通告转发给 client
当 sw16 修改 vlan 时,修订号不变,总是最小的,所以它不会对 server 跟 client 造成影响
二、 实验步骤
1 、将 sw14 改为 server , sw16 改为 transparent
sw1(vlan)#vtp server
Setting device to VTP SERVER mode.
sw1(vlan)#exit
APPLY completed.
Exiting....
sw2(vlan)#vtp transparent
Setting device to VTP TRANSPARENT mode.
sw2(vlan)#exit
APPLY completed.
Exiting....
2、验证透明模式修订号对server mode和client mode 的影响
①查看sw16的vtp数据
sw2#show vtp status
VTP Version : 2
Configuration Revision : 0
Maximum VLANs supported locally : 128
Number of existing VLANs : 6
VTP Operating Mode : Transparent
VTP Domain Name : cisco
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x01 0x83 0x7E 0xF0 0xDC 0x2A 0xF4 0x94
Configuration last modified by 0.0.0.0 at 3-1-93 00:56:02
此时的修订号为0
②增加一个vlan
sw2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
sw2(config)#vlan 20
sw2(config-vlan)#name lala
sw2(config-vlan)#exit
sw2(config)#exit
③查看增加vlan之后的修订号
sw2#show vtp status
VTP Version : 2
Configuration Revision : 0
Maximum VLANs supported locally : 128
Number of existing VLANs : 7
VTP Operating Mode : Transparent
VTP Domain Name : cisco
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xEE 0xC4 0xC5 0x08 0xFE 0xD3 0xD7 0xAA
Configuration last modified by 0.0.0.0 at 3-1-93 00:56:02
修订号仍然为0,说明:无论transparent mode 怎样增删vlan,只要修订号不变则不会对server 和client造成影响
④查看transparent的vlan表
sw2#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
11 wode active
20 lala active
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
⑤查看server跟client的vlan表
Server :
sw1#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active 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, Fa0/16, Fa0/17
Fa0/18, Fa0/19, Fa0/20, Fa0/21
Fa0/22, Fa0/23, Fa0/24
2 VLAN0002 active
10 shengchan active
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
Client:
sw3#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/2, Fa0/3, Fa0/4, Fa0/5
Fa0/6, Fa0/7, Fa0/8, Fa0/9
Fa0/10, Fa0/11, Fa0/12
2 VLAN0002 active
10 shengchan active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
结论:在transparent mode中添加的名为lala 的vlan并未出现在server mode 和 client mode中 证明了它不会对它们造成影响。