1. Use four S3700 switch, 2 PC, set up the network topology
2. Set mengyu-S1
(1) Enable Spanning Tree switch (MSTP Huawei switches enabled by default), change the STP mode switch to normal spanning tree STP;
(2) configuration, the wait time is 30s by default spanning tree is recalculated, using the commands "display stp" See spanning tree state mengyu-S1
(3) You can also use the command "display stp brief", view summary information
3. Set mengyu-S2
(1) Enable Spanning Tree switch (MSTP Huawei switches enabled by default), change the STP mode switch to normal spanning tree STP;
(2) is configured, by default wait time is 30s spanning tree recalculation, then the command "display stp" View mengyu-S2 spanning tree state
(3) You can also use the command "display stp brief", view summary information
4. Set mengyu-S3
(1) Enable Spanning Tree switch (MSTP Huawei switches enabled by default), change the STP mode switch to normal spanning tree STP;
(2) configuration, the wait time is 30s by default spanning tree is recalculated, using the commands "display stp" See spanning tree state mengyu-S3
(3) You can also use the command "display stp brief", view summary information
5. mengyu-S4 set
(1) Enable Spanning Tree switch (MSTP Huawei switches enabled by default), change the STP mode switch to normal spanning tree STP;
(2) is configured, by default wait time is 30s spanning tree recalculation, then the command "display stp" View mengyu-S4 spanning tree state
(3) You can also use the command "display stp brief", view summary information
Currently we can see, mengyu-S2 root switch
4. Now we have to manually set the root switch
(1) Manually Set mengyu-S1 is the root switch, mengyu-S2 is a standby switch, we mengyu-S1 priority is set to 0, menyu-S2 priority is set to 4096 (4096 is a multiple of the priority of the default The priority is 32768);
① 设置 mengyu-S1
② Set mengyu-S2
③ After configuration view mengyu-S1 and status information mengyu-2
④ we can find a priority mengyu-S1 becomes 0, is the root switch; mengyu-S2 becomes the priority of 4096, for the root switch;
(2) in another way to the root switch mengyu-S1, mengyu-S2 to the backup exchange
①先用命令“undo stp priority”,删除在mengyu-S1配置的优先级(让它回到默认值32768);然后用命令“stp root primary”,把mengyu-S1交换机设为根交换机
②先用命令“undo stp priority”,删除在mengyu-S2配置的优先级(让它回到默认值32768);然后用命令“stp root secondary”,把mengyu-S2交换机设为备份根交换机
③查看交换机状态,发现mengyu-S1的优先级还是0,mengyu-S2的优先级为4096
5.根端口的选举
(1)在mengyu-S1为根交换机,mengyu-S2为备份交换机是用命令“display stp brief”查看生成树信息,发现E0/0/2为根端口,状态为转发状态
①由于拓扑中所有的链路都是百兆以太网链路,mengyu-S4经过mengyu-S3到mengyu-S1与mengyu-S2到mengyu-S1的开销值相同;接下来比较交换机标识, mengyu-S2的优先级是4096,而mengyu-S3默认是32768,所以与mengyu-S2连接的E0/0/2接口为根端口。
②使用命令 display stp interface Ethernet 0/0/2 的开销值
(2)配置mengyu-S4的E0/0/1的开销值为20000,减少其接口的开销
配置完成后,用 display stp interface Ethernet 0/0/1 查看E0/0/1接口开销值
查看mengyu-S4生成树状态后,因为从E0/0/1的开销是20000,比E0/0/2的开销小,所以E0/0/1成为根端口
6.理解指定端口的选举
(1)现在确保mengyu-S3连接的mengyu-S2的E0/0/3的接口被选择为指定接口,可以通过修改开销来实现
(2)为了模拟实验场景,先把mengyu-S2的优先级改为32768
(3) 配置完成后,查看mengyu-S2生成树的状态
(4)查看mengyu-S2与mengyu-S3的stp的摘要信息
发现mengyu-S2的E0/0/3为指定端口,mengyu-S3的E0/0/3为Alternate端口
(5)查看mengyu-S2和mengyu-S3的E0/0/3接口信息(在用户视图查看)
开销相同,mengyu-S2和mengyu-S3的优先级相同,mengyu-S2的MAC小于mengyu-S3,所以默认mengyu-S2的E0/0/3为指定端口
(6)修改mengyu-S3的开销值为20000,减小其开销值,确保让其E0/0/3成为指定端口
(7)再次查看mengyu-S3的stp的摘要状态,发现mengyu-S3E0/0/3变成了指定端口
(8)为了验证确保mengyu-S3E0/0/3成为指定端口,下面调整mengyu-S2的优先级为4096,并查看stp状态
(9)再次查看mengyu-S2和mengyu-S3stp摘要状态
可以观察到,即使mengyu-S2的优先级修改的比mengyu-S3更低,但是mengyu-S3仍为指定端口,再次验证了选定指定端口时先比较端口开销