1.开启和禁用STP
[SWA]stp disable //手动关闭交换机的STP
Warning: The global STP state will be changed. Continue? [Y/N]y
Info: This operation may take a few seconds. Please wait for a moment...done.
[SWA]dis stp //查看STP状态
Oct 10 2022 21:31:39-08:00 SWA DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 5, the c
hange loop count is 0, and the maximum number of records is 4095.
Protocol Status :Disabled //STP状态是Disabled,被关闭的
Protocol Standard :IEEE 802.1s //默认情况下华为交换机开启了MSTP
Version :3
CIST Bridge Priority :32768
MAC address :4c1f-cccb-0cba
Max age(s) :20
Forward delay(s) :15
Hello time(s) :2
Max hops :20
[SWA]dis stp
Protocol Status :Disabled
Protocol Standard :IEEE 802.1s
Version :3
CIST Bridge Priority :32768
MAC address :4c1f-cccb-0cba
Max age(s) :20
Forward delay(s) :15
Hello time(s) :2
Max hops :20
[SWA]stp enable //开启STP
Warning: The global STP state will be changed. Continue? [Y/N]y
Info: This operation may take a few seconds. Please wait for a moment...done.
[SWA]dis stp
-------[CIST Global Info][Mode MSTP]-------
CIST Bridge :32768.4c1f-cccb-0cba
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-cccb-0cba / 0
CIST RegRoot/IRPC :32768.4c1f-cccb-0cba / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :3
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:0m:10s
Number of TC :1
Last TC occurred :Ethernet0/0/1
----[Port25(Ethernet0/0/1)][FORWARDING]----
Port Protocol :Enabled
Port Role :Designated Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=200000
Designated Bridge/Port :32768.4c1f-cccb-0cba / 128.25
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=true
Transit Limit :147 packets/hello-time
Protection Type :None
2.修改交换机STP模式
[SWA]stp mode stp
Info: This operation may take a few seconds. Please wait for a moment...done.
[SWA]dis stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge :32768.4c1f-cccb-0cba
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-cccb-0cba / 0
CIST RegRoot/IRPC :32768.4c1f-cccb-0cba / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :6
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:2m:30s
Number of TC :7
Last TC occurred :Ethernet0/0/3
----[Port25(Ethernet0/0/1)][DISCARDING]----
3.修改桥优先级以控制根桥选举
[SWA]stp prior //修改桥优先级,优先级的范围为0~61440,输入的值必须是4096的倍数
[SWA]stp priority ?
INTEGER<0-61440> Bridge priority, in steps of 4096
[SWA]stp priority 0 //修改SWA的桥优先级为0,那么SWA具有最大可能性成为根交换机
[SWA]dis stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge :0 .4c1f-cccb-0cba
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-cccb-0cba / 0 //此处显示了根桥MAC地址以及到达根桥的开销是0
CIST RegRoot/IRPC :0 .4c1f-cccb-0cba / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :9
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:1m:18s
Number of TC :14
Last TC occurred :Ethernet0/0/1
----[Port25(Ethernet0/0/1)][DISCARDING]----
Port Protocol :Enabled
Port Role :Designated Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=200000
Designated Bridge/Port :0.4c1f-cccb-0cba / 128.25
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=true
Transit Limit :147 packets/hello-time
Protection Type :None
4.修改端口优先级以控制根端口和指定端口的选举
[SWB]display stp brief //STP收敛后,SWB的G0/0/1成为根端口
MSTID Port Role STP State Protection
0 Ethernet0/0/1 ROOT FORWARDING NONE
0 Ethernet0/0/2 ALTE DISCARDING NONE
0 Ethernet0/0/3 DESI FORWARDING NONE
在SWA上修改端口优先级,让SWB的G0/0/2端口被选举为根端口。在SWA上有两种调整方法:
①将G0/0/1的端口优先级调大。
[SWA]int g 0/0/1
[SWA-GigabitEthernet0/0/1]stp port priority ?
INTEGER<0-240> Port priority, in steps of 16
[SWA-GigabitEthernet0/0/1]stp port priority 240
②将G0/0/2的端口优先级调小。
[SWA]int g 0/0/2
[SWA-GigabitEthernet0/0/1]stp port priority ?
INTEGER<0-240> Port priority, in steps of 16
[SWA-GigabitEthernet0/0/2]stp port priority 16
5.修改端口开销、控制根端口和指定端口的选举
在SWB上修改端口优先级,让SWB的G0/0/2端口选举为根端口。在SWB上有两种调整方法:
①将G0/0/1的端口开销调大。
[SWB]display stp interface g 0/0/1
-------[CIST Global Info][Mode STP]-------
CIST Bridge :32768.4c1f-ccf3-6146
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-cccb-0cba / 200000 //SWB到达根桥的总开销(RPC)是20000
CIST RegRoot/IRPC :32768.4c1f-ccf3-6146 / 0
CIST RootPortId :128.25
BPDU-Protection :Disabled
TC or TCN received :270
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:1m:47s
Number of TC :5
Last TC occurred :Ethernet0/0/1
----[Port47(GigabitEthernet0/0/1)][DOWN]----
Port Protocol :Enabled
Port Role :Disabled Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=200000000
Designated Bridge/Port :32768.4c1f-ccf3-6146 / 128.47
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=false
Transit Limit :147 packets/hello-time
Protection Type :None
Port STP Mode :MSTP
Port Protocol Type :Config=auto / Active=dot1s
BPDU Encapsulation :Config=stp / Active=stp
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20
TC or TCN send :0
TC or TCN received :0
BPDU Sent :0
TCN: 0, Config: 0, RST: 0, MST: 0
BPDU Received :0
TCN: 0, Config: 0, RST: 0, MST: 0
②将G0/0/2的端口开销调小。
6.配置边缘端口
stp edged-port enable
标签:SWA,CIST,配置,TC,STP,stp,Port
From: https://www.cnblogs.com/xl4ng/p/16777572.html