华为交换机配置-STP
1.STP
上述环境中,只对交换机3、4连接pc的端口设置为access模式,pc1和pc2可以通信,但是上图所示的网络中存在环路,所以需要开启STP
1.命令
交换机1
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname SW1
//开启全局STP
[sw1]stp enable
//设置STP模式为STP,此外还有mstp、rstp
[sw1]stp mode stp
//设置STP优先级,stp priority 4096 = stp root primary = 设置此交换机为根桥
[sw1]stp priority 4096
交换机2
[sw2]stp enable
[sw2]stp mode stp
//设置此交换机为备份网桥 stp priority 8192 = stp root secondary
//优先级的设置需要4096的倍数
[sw2]stp priority 8192
交换机3
[sw3]stp enable
[sw3]stp mode stp
//设置边缘端口,启用端口BPDU报文功能
[sw3]int g0/0/1
[sw3-GigabitEthernet0/0/1]stp edged-port enable
[sw3-GigabitEthernet0/0/1]stp bpdu-filter
交换机4
[sw4]stp enable
[sw4]stp mode stp
[sw4]int g0/0/1
[sw4-GigabitEthernet0/0/1]stp edged-port enable
[sw4-GigabitEthernet0/0/1]stp bpdu-filter enable
配置完成后,查看端口的状态
display stp查看STP状态,可以查看交换机是不是根网桥
display stp brief 查看每个端口的状态
其中FORWARDING表示转发,DISCARDING表示阻塞,ROOT表示根端口