实验拓扑
image.png
实验需求
1.开启所有设备,等待STP收敛后观察STP状态
2.使SW4成为根网桥
3.使闭塞端口出现在SW2上
4.把SW1上连接的PC的端口配置为边缘端口
实验解法
1.等待STP收敛后,查看STP运行状态,找出根网桥,闭塞端口
步骤1:根据HCL模拟器的运行机制,SW1的Mac地址应该是最小的,会成为根网桥,在SW1上查看STP运行状态,确认SW1为根网桥
[SW1]display stp
-------[CIST Global Info][Mode MSTP]-------
Bridge ID : 32768.7aef-e4ea-0100
Bridge times : Hello 2s MaxAge 20s FwdDelay 15s MaxHops 20
Root ID/ERPC : 32768.7aef-e4ea-0100, 0
RegRoot ID/IRPC : 32768.7aef-e4ea-0100, 0
RootPort ID : 0.0
BPDU-Protection : Disabled
Bridge Config-
Digest-Snooping : Disabled
TC or TCN received : 7
Time since last TC : 0 days 0h:0m:40s
步骤2:根据STP计算机制,所有链路开销一致,闭塞端口应该会出现在SW4上。在SW4上查看端口状态,确认SW4的g1/0/2被闭塞
[SW4]display stp brief
MST ID Port Role STP State Protection
0 GigabitEthernet1/0/1 ROOT FORWARDING NONE
0 GigabitEthernet1/0/2 ALTE DISCARDING NONE
2.使SW4成为新的根网桥
分析:要想使SW4成为根网桥,最好的办法就是让SW4的优先级成为全网最小。默认优先级都为32768,只要把SW4的优先级改成比32768小就可以了
步骤1:修改SW4的优先级为4096
[SW4]stp priority 4096
[SW4]%Mar 21 20:50:27:109 2018 SW4 STP/6/STP_DETECTED_TC: Instance 0's port GigabitEthernet1/0/2 detected a topology change.
步骤2:在SW4上查看STP运行状态,发现SW4已经成为新的根网桥
[SW4]display stp
-------[CIST Global Info][Mode MSTP]-------
Bridge ID : 4096.7af0-0e17-0400
Bridge times : Hello 2s MaxAge 20s FwdDelay 15s MaxHops 20
Root ID/ERPC : 4096.7af0-0e17-0400, 0
RegRoot ID/IRPC : 4096.7af0-0e17-0400, 0
RootPort ID : 0.0
BPDU-Protection : Disabled
Bridge Config-
Digest-Snooping : Disabled
TC or TCN received : 8
Time since last TC : 0 days 0h:1m:30s
3.使闭塞端口出现在SW2上
分析:SW4成为了根网桥,按照STP计算机制,闭塞端口此时应该在SW1上。要使闭塞端口到SW2上,就需要让SW2到SW1的cost比SW4到SW1更大。H3C交换机千兆口的cost默认是20,我们可以把SW2的g1/0/2接口的cost改为1000
步骤1:在SW2上进入g1/0/2接口的接口视图,修改stp cost为1000
[SW2]interface g1/0/2
[SW2-GigabitEthernet1/0/2]stp cost 1000
[SW2-GigabitEthernet1/0/2]%Mar 21 22:16:05:399 2018 SW2 STP/6/STP_NOTIFIED_TC: Instance 0's port GigabitEthernet1/0/1 was notified a topology change.
步骤2:在SW2上查看STP接口状态,发现SW2的g1/0/2接口已经成为了新的闭塞端口
[SW2]display stp brief
MST ID Port Role STP State Protection
0 GigabitEthernet1/0/1 ROOT FORWARDING NONE
0 GigabitEthernet1/0/2 ALTE DISCARDING NONE
4.把SW1连接PC的所有接口配置为边缘接口
[SW4]interface g1/0/3
[SW4-GigabitEthernet1/0/3]stp edged-port
Edge port should only be connected to terminal. It will cause temporary loops if port GigabitEthernet1/0/3 is connected to bridges. Please use it carefully.
[SW4]interface g1/0/4
[SW4-GigabitEthernet1/0/4]stp edged-port
Edge port should only be connected to terminal. It will cause temporary