
主机评测
如图所示,当前网络中SwitchA、SwitchB、SwitchC和SwitchD通过环形组网备份链路。希望通过运行生成树协议阻塞端口,将环形网络结构修剪成无环路的树形网络结构。
? 在主链路故障时,能够快速切换到备份链路上。
? SwitchA设备的性能较高,希望作为根桥,SwithB为备份根桥。
? SwtichC和SwitchD设备连接用户,希望阻塞SiwtchC和SwitchD之间的链路。
? SwitchC和SwitchD连接用户的接口GE0/0/3不要参与STP计算。同时预防用户攻击,在收到BPDU报文时,把端口down掉。
4.2 配置思路
采用如下的思路配置RSTP:
4.3 操作步骤
步骤1:配置模式为RSTP模式。
<HUAWEI> system-view
[HUAWEI] sysname SwitchA
[SwitchA] stp mode rstp
<HUAWEI> system-view
[HUAWEI] sysname SwitchB
[SwitchB] stp mode rstp
<HUAWEI> system-view
[HUAWEI] sysname SwitchC
[SwitchC] stp mode rstp
<HUAWEI> system-view
[HUAWEI] sysname SwitchD
[SwitchD] stp mode rstp
步骤2:配置SwitchA为根桥,SwitchB为备份根桥。
[SwitchA] stp root primary //也可以使用命令stp priority 0 配置优先级为0,和stp root primary的作用是一样的。
[SwitchB] stp root secondary //也可以使用命令stp priority 4096 配置优先级为4096,和stp root secondary的作用是一样的。
步骤3: 配置SwitchC和SwitchD设备GE0/0/3端口为边缘端口,并禁止该端口发送BPDU报文。
[SwitchC] interface gigabitethernet0/0/3
[SwitchC-GigabitEthernet0/0/3] stp edged-port enable //配置为边缘端口
[SwitchC-GigabitEthernet0/0/3] stp bpdu-filter enable //禁止该端口发送BPDU报文
[SwitchC-GigabitEthernet0/0/3] quit
[SwitchD] interface gigabitethernet 0/0/3
[SwitchD-GigabitEthernet0/0/3] stp edged-port enable
[SwitchD-GigabitEthernet0/0/3] stp bpdu-filter enable
[SwitchD-GigabitEthernet0/0/3] quit
步骤4:全局使能STP功能。
华为X7系列交换机默认是使能,该步骤可以省略。
[SwitchA] stp enable
[SwitchB] stp enable
[SwitchC] stp enable
[SwitchD] stp enable
步骤5:验证配置结果
查看RSTP简要信息,通过RSTP简要信息可以快速的看出端口的角色和状态。
4.4 配置文件
SwitchA的配置文件
- #
-
- sysname SwitchA
-
- #
-
- stp mode rstp
-
- stp instance 0 root primary
-
- stp enable
-
- #
-
- return
SwitchB的配置文件
- #
-
- sysname SwitchB
-
- #
-
- stp mode rstp
-
- stp instance 0 root secondary
-
- stp enable
-
- #
-
- return
SwitchC的配置文件
- #
-
- sysname SwitchC
-
- #
-
- stp mode rstp
-
- stp enable
-
- #
-
- interface GigabitEthernet0/0/3
-
- stp edged-port enable
-
- stp bpdu-filter enable
-
- #
-
- return
SwitchD的配置文件
- #
-
- sysname SwitchD
-
- #
-
- stp mode rstp
-
- stp enable
-
- #
-
- interface GigabitEthernet0/0/3
-
- stp edged-port enable
-
- stp bpdu-filter enable
-
- #
-
- return