温馨提示:欢迎对技术感兴趣的新手朋友们,希望这些知识点能对大家有帮助。如果有什么不解或疑惑或建议,可留言小编,我将尽快给予解决。谢谢!!
拓扑图
图1 配置STP实验拓扑图
场景:上一集我们讲到如何配置STP并验证,那接下来我们将继续下一个步骤:控制根桥选举。
控制根桥选举
执行display stp命令查看根桥信息。根桥设备的CIST Bridge与CIST Root/ERPC字段取值相同。
[SW1]display stp
-------CIST Global Info-------
CIST Bridge :0 .4c1f-cc16-05ac <本交换机SW1的网桥ID>
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :0 .4c1f-cc16-05ac / 0 <本设备SW1为根交换机>
CIST RegRoot/IRPC :0 .4c1f-cc16-05ac / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
CIST Root Type :Primary root
TC or TCN received :8
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:24m:37s
……output omit……
[SW2]display stp
-------CIST Global Info-------
CIST Bridge :4096 .4c1f-cc78-50fb <本交换机SW2的网桥ID>
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :0 .4c1f-cc16-05ac / 20000 <在SW2上看到SW1为根交换机>
CIST RegRoot/IRPC :4096 .4c1f-cc78-50fb / 0
CIST RootPortId :128.9
BPDU-Protection :Disabled
CIST Root Type :Secondary root
TC or TCN received :43
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:26m:12s
……output omit……
以上回显表示SW1为根桥,SW2为备份根桥。
通过配置优先级,使SW2为根桥,SW1为备份根桥。桥优先级取值越小,则优先级越高。把SW1和SW2的优先级分别设置为8192和4096。
配置SW1:
[SW1]undo stp root
[SW1]stp priority 8192
配置SW2:
[SW2]undo stp root
[SW2]stp priority 4096
执行display stp命令查看新的根桥信息。
[SW1]display stp
-------CIST Global Info-------
CIST Bridge :8192 .4c1f-cc16-05ac
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :4096 .4c1f-cc78-50fb / 20000
CIST RegRoot/IRPC :8192 .4c1f-cc16-05ac / 0
CIST RootPortId :128.33
BPDU-Protection :Disabled
TC or TCN received :24
TC count per hello :2
STP Converge Mode :Normal
Time since last TC :0 days 0h:0m:16s
……output omit……
[SW2]display stp
-------CIST Global Info-------
CIST Bridge :4096 .4c1f-cc78-50fb
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :4096 .4c1f-cc78-50fb / 0
CIST RegRoot/IRPC :4096 .4c1f-cc78-50fb / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :43
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:0m:52s
……output omit……
由上述回显信息中的灰色部分可以看出,SW2已经变成新的根桥。
关闭SW2的G0/0/9和G0/0/10端口,从而隔离SW1与SW2,模拟SW2发生故障。
[SW2]interface GigabitEthernet 0/0/9
[SW2-GigabitEthernet0/0/9]shutdown
[SW2-GigabitEthernet0/0/9]quit
[SW2]interface GigabitEthernet 0/0/10
[SW2-GigabitEthernet0/0/10]shutdown
[SW1]display stp
-------CIST Global Info-------
CIST Bridge :8192 .4c1f-cc16-05ac
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :8192 .4c1f-cc16-05ac / 0
CIST RegRoot/IRPC :8192 .4c1f-cc16-05ac / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :43
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:9m:17s
……output omit……
在上述回显信息中,灰色部分表明当SW2故障时,SW1变成根桥,然后开启SW2之前关闭的接口。
[SW2]interface GigabitEthernet 0/0/9
[SW2-GigabitEthernet0/0/9]undo shutdown
[SW2-GigabitEthernet0/0/9]quit
[SW2]interface GigabitEthernet 0/0/10
[SW2-GigabitEthernet0/0/10]undo shutdown
[SW1]display stp
-------CIST Global Info-------
CIST Bridge :8192 .4c1f-cc16-05ac
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :4096 .4c1f-cc78-50fb / 20000
CIST RegRoot/IRPC :8192 .4c1f-cc16-05ac / 0
CIST RootPortId :128.33
BPDU-Protection :Disabled
TC or TCN received :54
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:0m:14s
……output omit……
[SW2]display stp
-------CIST Global Info-------
CIST Bridge :4096 .4c1f-cc78-50fb
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :4096 .4c1f-cc78-50fb / 0 <SW2为根桥>
CIST RegRoot/IRPC :4096 .4c1f-cc78-50fb / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :45
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:0m:43s
……output omit……
在上述回显信息中,灰色部分表明SW2已经恢复正常,重新变成根桥。
下集预告: 控制根端口选举,明天更新
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。