stp的基础配置
原理
1)BPDU bridge protocol data unit 桥协议数据单元
运行了生成树协议的交换机彼此之间用来交流生成树信息的数据包
类型:
配置BPDU :详细介绍生成树的基本信息
拓扑变更BPDU:把生成树的变化信息告诉别的交换机
内容:
根网桥的网桥ID、自己的网桥ID、到根网桥的成本、端口ID
2)stp端口状态
生成树选举需要一定的时间和过程:stp收敛
收敛:设备从不稳定到稳定的过程
禁用 disabled 强制关闭
阻塞 blocking 不能转发数据帧,可以接收BPDU;
侦听 listening 不能转发数据帧,可以发送和接收BPDU;
学习 leraning 构建 MAC地址表
转发 forwarding 转发数据帧
3)STP计时器
hello时间:2s,交换机发送BPDU的频率和周期
max-age(最大老化时间):20s, 表示的是交换机的接口如果在指定时间没有接收到
BPDU的更新,那就把原来BPDU信息删除;
forward-relay(转发延迟):15s
侦听---->学习 15s
学习---->转发 15s
拓扑图
配置命令
sw1
<Huawei>sys
[Huawei]sys
[Huawei]sysname sw1
[sw1]dis stp
-------[CIST Global Info][Mode MSTP]-------
CIST Bridge :32768.4c1f-ccf6-5fa1
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :32768.4c1f-cc14-43f4 / 200000
CIST RegRoot/IRPC :32768.4c1f-ccf6-5fa1 / 0
CIST RootPortId :128.1
BPDU-Protection :Disabled
TC or TCN received :5
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:31m:2s
Number of TC :3
[sw1]stp mode stp
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw1]dis stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge :32768.4c1f-ccf6-5fa1
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :32768.4c1f-cc14-43f4 / 200000
CIST RegRoot/IRPC :32768.4c1f-ccf6-5fa1 / 0
CIST RootPortId :128.1
BPDU-Protection :Disabled
TC or TCN received :5
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:31m:34s
Number of TC :3
Last TC occurred :Ethernet0/0/1
[sw1]display stp brief
MSTID Port Role STP State Protection
0 Ethernet0/0/1 ROOT FORWARDING NONE
0 Ethernet0/0/2 ALTE DISCARDING NONE
[sw1]quit
<sw1>display bridge mac-address
System bridge MAC address: 4c1f-ccf6-5fa1
<sw1>
sw2
<Huawei>u t m
<Huawei>sys
[Huawei]sys
[Huawei]sysname sw2
[sw2]dis stp
-------[CIST Global Info][Mode MSTP]-------
CIST Bridge :32768.4c1f-cc14-43f4
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :32768.4c1f-cc14-43f4 / 0
CIST RegRoot/IRPC :32768.4c1f-cc14-43f4 / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :5
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:31m:4s
Number of TC :5
Last TC occurred :Ethernet0/0/3
----[Port1(Ethernet0/0/1)][FORWARDING]----
Port Protocol :Enabled
[sw2]stp mode stp
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw2]dis stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge :32768.4c1f-cc14-43f4
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :32768.4c1f-cc14-43f4 / 0
CIST RegRoot/IRPC :32768.4c1f-cc14-43f4 / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :5
TC count per hello :0
STP Converge Mode :Normal
[sw2]display stp brief
MSTID Port Role STP State Protection
0 Ethernet0/0/1 DESI FORWARDING NONE
0 Ethernet0/0/3 DESI FORWARDING NONE
[sw2]display bridge mac-address
System bridge MAC address: 4c1f-cc14-43f4
[sw2]
sw3
<Huawei>sys
[Huawei]sysname sw3
[sw3]dis stp
-------[CIST Global Info][Mode MSTP]-------
CIST Bridge :32768.4c1f-cc96-3d85
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :32768.4c1f-cc14-43f4 / 200000
CIST RegRoot/IRPC :32768.4c1f-cc96-3d85 / 0
CIST RootPortId :128.3
BPDU-Protection :Disabled
TC or TCN received :2
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:31m:4s
Number of TC :4
Last TC occurred :Ethernet0/0/2
[sw3]stp mode stp
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw3]dis stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge :32768.4c1f-cc96-3d85
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :32768.4c1f-cc14-43f4 / 200000
CIST RegRoot/IRPC :32768.4c1f-cc96-3d85 / 0
CIST RootPortId :128.3
BPDU-Protection :Disabled
TC or TCN received :3
TC count per hello :0
STP Converge Mode :Normal
<sw3>display stp brief
MSTID Port Role STP State Protection
0 Ethernet0/0/2 DESI FORWARDING NONE
0 Ethernet0/0/3 ROOT FORWARDING NONE
<sw3>display
<sw3>display br
<sw3>display bridge mac
<sw3>display bridge mac-address
System bridge MAC address: 4c1f-cc96-3d85
<sw3>