实验:配置STP与VTP
一.实验环境
三台交换机,形成一个全互连结构,本实验所使用的三台交换机匀由路由器C2691添加NM-16ESW板卡。
本实验所使用GNS3模拟器模拟,与真实Cisco设备配置有少许不同之处!
二.实验要求
设置sw1为VTP server,设置sw2和sw3为VTP client,域名为cisco,密码为:cisco,在server创建vlan 10和vlan20;设置sw1为vlan1的根桥,sw2为vlan10的根桥,sw3为vlan20的根桥;
三.设备与拓扑
四.技术描述
STP - Spanning Tree Protocol(生成树协议)
逻辑上断开环路,防止广播风暴的产生
当线路故障,阻塞接口被激活,恢复通信,起备份线路的作用
五.操作步骤
1/设备开机加电自检
2/基本配置
SW1#conf terminal 进入特权模式
SW1(config)#no ip routing 关闭路由功能
同上,SW2,SW3也关闭了路由功能
3/配置VTP
配置VTP ServerSW1#conf terminal 进入特权模式
SW1(config)#vtp mode server 启用VTP Server
Device mode already VTP SERVER.
SW1(config)#vtp domain cisco 设置域名
Changing VTP domain name from NULL to cisco
SW1(config)#vtp password cisco 设置密码
Setting device VLAN database password to cisco
配置 VTP Client
SW2(config)#vtp mode client 启动 VTP Client
Setting device to VTP CLIENT mode.
SW2(config)#vtp domain cisco 设置域名
Changing VTP domain name from NULL to cisco
SW2(config)#vtp password cisco 设置密码
Setting device VLAN database password to cisco
SW3(config)#vtp mode client
Setting device to VTP CLIENT mode.
SW3(config)#vtp domain cisco
Changing VTP domain name from NULL to cisco
SW3(config)#vtp password cisco
Setting device VLAN database password to cisco
4/启动干道端口
SW1(config)#int fa 1/0 进入 fa 1/0接口
SW1(config-if)#switchport mode trunk 把模式改为干道模式
SW1(config-if)#switchport trunk encapsulationdot1q
SW1(config-if)#int fa 1/1
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk encapsulationdot1q
SW2(config)#int fa1/0
SW2(config-if)#switchport mode trunk
SW2(config-if)#switchport trunk encapsulationdot1q
SW2(config-if)#int fa 1/2
SW2(config-if)#switchport mode trunk
SW2(config-if)#switchport trunk encapsulationdot1q
SW3(config)#int fa 1/2
SW3(config-if)#switchport mode trunk
SW3(config-if)#switchport trunk encapsulationdot1q
SW3(config-if)#int fa 1/1
SW3(config-if)#switchport mode trunk
SW3(config-if)#switchport trunk encapsulationdot1q
5/查看VTP状态(添加VLAN前)
SW1#show vtp status 查看VTP状态
VTP Version : 2 版本最大支持个数
Configuration Revision : 2 修定次数
Maximum VLANs supported locally : 36 最大支持VLAN数
Number of existing VLANs : 5 已建立VLAN数
VTP Operating Mode : Server VTP模式
VTP Domain Name : cisco VTP域名
VTP Pruning Mode : Disabled VTP修剪
VTP V2 Mode : Disabled 版本号2是否启动
VTP Traps Generation : Disabled
MD5 digest : 0xDB 0xC9 0x79 0x040x1F 0x6C 0xCB 0x19
Configuration last modified by 0.0.0.0 at3-1-02 01:09:09
Local updater ID is 0.0.0.0 (no valid interfacefound)
SW2#show vtp status
VTP Version : 2
Configuration Revision : 2
Maximum VLANs supported locally : 36
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 : 0xDB 0xC9 0x79 0x040x1F 0x6C 0xCB 0x19
Configuration last modified by 0.0.0.0 at3-1-02 00:19:06
SW3#show vtp status
VTP Version : 2
Configuration Revision : 2
Maximum VLANs supported locally : 36
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 : 0xDB 0xC9 0x79 0x040x1F 0x6C 0xCB 0x19
Configuration last modified by 0.0.0.0 at3-1-02 00:19:06
6/在VTP Server 中添加VLAN信息
SW1#conf t
Enter configuration commands, one perline. End with CNTL/Z.
SW1(config)#vlan 10 创建VLAN10
SW1(config-vlan)#vlan 20 创建VLAN20
7/查看VTP状态(添加VLAN后)
SW1#show vtp status
VTP Version : 2
Configuration Revision : 4 修订号增加2
Maximum VLANs supported locally : 36
Number of existing VLANs : 7
VTP Operating Mode : Server
VTP Domain Name : cisco
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xB2 0x28 0x6A 0x320x85 0xFA 0x82 0xEA
Configuration last modified by 0.0.0.0 at3-1-02 02:27:13
Local updater ID is 0.0.0.0 (no valid interfacefound)
SW2#show vtp status
VTP Version : 2
Configuration Revision : 4
Maximum VLANs supported locally : 36
Number of existing VLANs : 7
VTP Operating Mode : Client
VTP Domain Name : cisco
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xB2 0x28 0x6A 0x32 0x85 0xFA0x82 0xEA
Configuration last modified by 0.0.0.0 at3-1-02 02:27:13
SW3#show vtp status
VTP Version : 2
Configuration Revision : 4
Maximum VLANs supported locally : 36
Number of existing VLANs : 7
VTP Operating Mode : Client
VTP Domain Name : cisco
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xB2 0x28 0x6A 0x320x85 0xFA 0x82 0xEA
Configuration last modified by 0.0.0.0 at3-1-02 02:27:13
8/查看VLAN信息
SW1#show vlan-s b
VLAN Name Status Ports
---- -------------------------------- ----------------------------------------
1 default active Fa1/2, Fa1/3, Fa1/4,Fa1/5
Fa1/6, Fa1/7, Fa1/8, Fa1/9
Fa1/10,Fa1/11, Fa1/12, Fa1/13
Fa1/14, Fa1/15
10 VLAN0010 active
20 VLAN0020 active
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
SW2#show vlan-s b
VLAN Name Status Ports
---- -------------------------------- ----------------------------------------
1 default active Fa1/1, Fa1/3, Fa1/4,Fa1/5
Fa1/6, Fa1/7, Fa1/8, Fa1/9
Fa1/10, Fa1/11, Fa1/12, Fa1/13
Fa1/14, Fa1/15
10 VLAN0010 active
20 VLAN0020 active
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
SW3#show vlan-s b
VLAN Name Status Ports
---- -------------------------------- ----------------------------------------
1 default active Fa1/0, Fa1/3, Fa1/4,Fa1/5
Fa1/6, Fa1/7, Fa1/8, Fa1/9
Fa1/10, Fa1/11, Fa1/12, Fa1/13
Fa1/14, Fa1/15
10 VLAN0010 active
20 VLAN0020 active
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
9/配置PVST
SW1(config)#spanning-tree vlan 1 root primary 设置为vlan1的根桥
% This switch is already the root of VLAN1spanning tree
VLAN 1bridge priority set to 8192
VLAN 1bridge max aging time unchanged at 20
VLAN 1bridge hello time unchanged at 2
VLAN 1bridge forward delay unchanged at 15
SW2(config)#spanning-tree vlan 10 root primary 设置为vlan10的根桥
VLAN 10bridge priority set to 8192
VLAN 10bridge max aging time unchanged at 20
VLAN 10bridge hello time unchanged at 2
VLAN 10bridge forward delay unchanged at 15
SW3(config)#spanning-tree vlan 20 root primary 设置为vlan20的根桥
VLAN 20bridge priority set to 8192
VLAN 20bridge max aging time unchanged at 20
VLAN 20bridge hello time unchanged at 2
VLAN 20bridge forward delay unchanged at 15
10/显示STP信息
SW1#show spanning-tree brief 显示每个VLAN信息
VLAN1
Spanning tree enabled protocol ieee
RootID Priority 8192
Address c003.11c8.0000
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
BridgeID Priority 8192
Address c003.11c8.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- -------- -------------------- -------
FastEthernet1/0 128.41 128 19 FWD 0 8192 c003.11c8.0000 128.41
FastEthernet1/1 128.42 128 19 FWD 0 8192 c003.11c8.0000 128.42
VLAN10
Spanning tree enabled protocol ieee
RootID Priority 8192
Address c004.11c8.0001
Cost 19
Port 41 (FastEthernet1/0)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
BridgeID Priority 32768
Address c003.11c8.0001
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- -------- -------------------- -------
FastEthernet1/0 128.41 128 19 FWD 0 8192 c004.11c8.0001 128.41
FastEthernet1/1 128.42 128 19 FWD 19 32768 c003.11c8.0001 128.42
VLAN20
Spanning tree enabled protocol ieee
RootID Priority 8192
Address c005.11c8.0002
Cost 19
Port 42 (FastEthernet1/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
BridgeID Priority 32768
Address c003.11c8.0002
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- -------- -------------------- -------
FastEthernet1/0 128.41 128 19 FWD 19 32768 c003.11c8.0002 128.41
FastEthernet1/1 128.42 128 19 FWD 0 8192 c005.11c8.0002 128.42
SW2#show spanning-tree brief
VLAN1
Spanning tree enabled protocol ieee
RootID Priority 8192
Address c003.11c8.0000
Cost 19
Port 41 (FastEthernet1/0)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
BridgeID Priority 32768
Address c004.11c8.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- -------- -------------------- -------
FastEthernet1/0 128.41 128 19 FWD 0 8192 c003.11c8.0000 128.41
FastEthernet1/2 128.43 128 19 FWD 19 32768 c004.11c8.0000 128.43
VLAN10
Spanning tree enabled protocol ieee
RootID Priority 8192
Address c004.11c8.0001
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15sec
BridgeID Priority 8192
Address c004.11c8.0001
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- -------- -------------------- -------
FastEthernet1/0 128.41 128 19 FWD 0 8192 c004.11c8.0001 128.41
FastEthernet1/2 128.43 128 19 FWD 0 8192 c004.11c8.0001 128.43
VLAN20
Spanning tree enabled protocol ieee
RootID Priority 8192
Address c005.11c8.0002
Cost 19
Port 43 (FastEthernet1/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
BridgeID Priority 32768
Address c004.11c8.0002
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- -------- -------------------- -------
FastEthernet1/0 128.41 128 19 BLK 19 32768 c003.11c8.0002 128.41
FastEthernet1/2 128.43 128 19 FWD 0 8192 c005.11c8.0002 128.43
SW3#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
RootID Priority 8192
Address c003.11c8.0000
Cost 19
Port 42 (FastEthernet1/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
BridgeID Priority 32768
Address c005.11c8.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- -------- -------------------- -------
FastEthernet1/1 128.42 128 19 FWD 0 8192 c003.11c8.0000 128.42
FastEthernet1/2 128.43 128 19 BLK 19 32768 c004.11c8.0000 128.43
VLAN10
Spanning tree enabled protocol ieee
RootID Priority 8192
Address c004.11c8.0001
Cost 19
Port 43 (FastEthernet1/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
BridgeID Priority 32768
Address c005.11c8.0001
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- -------- -------------------- -------
FastEthernet1/1 128.42 128 19 BLK 19 32768 c003.11c8.0001 128.42
FastEthernet1/2 128.43 128 19 FWD 0 8192 c004.11c8.0001 128.43
VLAN20
Spanning tree enabled protocol ieee
RootID Priority 8192
Address c005.11c8.0002
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
BridgeID Priority 8192
Address c005.11c8.0002
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- -------- -------------------- -------
FastEthernet1/1 128.42 128 19 FWD 0 8192 c005.11c8.0002 128.42
FastEthernet1/2 128.43 128 19 FWD 0 8192 c005.11c8.0002 128.43
六.实验结束