测试编号:STP-1
测试目的:测试STP的选举过程
测试环境:
测试过程:
1、搭建一个环形的网络拓扑;
2、给VLAN1配置优先级
测试方法1、
SW1(config)#spanning-tree vlan 1 priority 65535
SW2(config)#spanning-tree vlan 1 priority 4096
SW3(config)#spanning-tree vlan 1 priority 0
测试方法1的结果:
SW1#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 0
Address c202.0e48.0000
Cost 19
Port 43 (FastEthernet1/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 65535
Address c200.0e48.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 BLK 19 4096 c201.0e48.0000 128.41
FastEthernet1/2 128.43 128 19 FWD 0 0 c202.0e48.0000 128.42
F1/1 为阻塞端口 F1/2为根端口
SW2#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 0
Address c202.0e48.0000
Cost 19
Port 42 (FastEthernet1/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 4096
Address c201.0e48.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 19 4096 c201.0e48.0000 128.41
FastEthernet1/1 128.42 128 19 FWD 0 0 c202.0e48.0000 128.43
F1/0 为指定端口 F1/1为根端口
SW3#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 0
Address c202.0e48.0000
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 0
Address c202.0e48.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 0 c202.0e48.0000 128.42
FastEthernet1/2 128.43 128 19 FWD 0 0 c202.0e48.0000 128.43
F1/1为指定端口 F1/2为指定端口
测试预期效果:SW3为根网桥,SW2为备份根网桥,阻塞端口为SW1的F1/2
测试结果:SW3为根网桥,SW2为备份根网桥,阻塞端口为SW1的F1/2
测试方法2、
R1(config)#spanning-tree vlan 1 priority 0
R2(config)#spanning-tree vlan 1 priority 4096
R3(config)#spanning-tree vlan 1 priority 65535
测试方法2的结果:
SW1#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 0
Address c200.0e48.0000
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 0
Address c200.0e48.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 0 c200.0e48.0000 128.42
FastEthernet1/2 128.43 128 19 FWD 0 0 c200.0e48.0000 128.43
SW2#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 0
Address c200.0e48.0000
Cost 19
Port 41 (FastEthernet1/0)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 4096
Address c201.0e48.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 0 c200.0e48.0000 128.42
FastEthernet1/1 128.42 128 19 FWD 19 4096 c201.0e48.0000 128.42
SW3#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 0
Address c200.0e48.0000
Cost 19
Port 42 (FastEthernet1/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 65535
Address c202.0e48.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 0 c200.0e48.0000 128.43
FastEthernet1/2 128.43 128 19 BLK 19 4096 c201.0e48.0000 128.42
测试预期效果:SW1为根网桥,SW2为备份根网桥,阻塞端口为SW3的F1/2
测试结果:SW1为根网桥,SW2为备份根网桥,阻塞端口为SW3的F1/2
测试结果分析:
在选举根网桥,备份根网桥时,越小越优先
测试示例:
测试目的:STP的状态转换
测试环境:如上图
测试过程:
1、搭建一个环形的网络拓扑;
2、给VLAN1配置优先级
测试方法:
SW1(config)#spanning-tree vlan 1 priority 0
SW2(config)#spanning-tree vlan 1 priority 4096
SW3(config)#spanning-tree vlan 1 priority 0
3、查看结果;
SW3#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 0
Address c200.0e48.0000
Cost 19
Port 42 (FastEthernet1/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 65535
Address c202.0e48.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 0 c200.0e48.0000 128.43
FastEthernet1/2 128.43 128 19 BLK 19 4096 c201.0e48.0000 128.42
BLK 阻塞状态:接收BPDU但不转发BPDU,不接收数据也不转发数据,不学习MAC地址
R3#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 0
Address c200.0e48.0000
Cost 19
Port 42 (FastEthernet1/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 0
Address c202.0e48.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 0 c200.0e48.0000 128.43
FastEthernet1/2 128.43 128 19 LIS 19 0 c202.0e48.0000 128.43
LIS 监听状态:接收BPDU也转发BPDU,不接收数据也不转发数据,不学习MAC地址
R3#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 0
Address c200.0e48.0000
Cost 19
Port 42 (FastEthernet1/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 0
Address c202.0e48.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 0 c200.0e48.0000 128.43
FastEthernet1/2 128.43 128 19 LRN 19 0 c202.0e48.0000 128.43
LRN 学习状态:接收BPDU也转发BPDU,接收数据但不转发数据,学习MAC地址
R3#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 0
Address c200.0e48.0000
Cost 19
Port 42 (FastEthernet1/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 0
Address c202.0e48.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 0 c200.0e48.0000 128.43
FastEthernet1/2 128.43 128 19 FWD 19 0 c202.0e48.0000 128.43
FWD 转发状态:接收BPDU也转发BPDU,接收数据也转发数据,学习MAC地址
测试预期效果:STP的状态变化:BLK->LIS->LRN->FWD
测试结果:STP的状态变化:BLK->LIS->LRN->FWD
STP的状态时间: 20S 15S 15S
测试结果分析:
STP有四个状态:阻塞状态、监听状态、学习状态、转发状态
阻塞状态:接收BPDU但不转发BPDU,不接收数据也不转发数据,不学习MAC地址
监听状态:接收BPDU也转发BPDU,不接收数据也不转发数据,不学习MAC地址
学习状态:接收BPDU也转发BPDU,接收数据但不转发数据,学习MAC地址
转发状态:接收BPDU也转发BPDU,接收数据也转发数据,学习MAC地址