STP note organization and experiments


STP generation process


Spanning tree election process


1. Elect Root (port role of spanning tree)


2. Select RP root ports on all non-root switches (there is only one)


3. Select DP designated ports on all links (there is only one)


4. The last remaining nothing is called the AP port


Spanning tree port status


1.DisabledClose


2.Blocking----------AP port (Huawei's embodiment is the Discarding discarding state of RSTP)


3.Listening


4.Learning


5.Forwarding----------DP, RP port


Spanning tree port status change switching


1. The port is initialized or enabled and enters the Blocking state. -----Initial stage of spanning tree. Regardless of whether there is a ring or not, it will be treated as if there is a ring, and it will be blocked.


2. The port is selected as the root port or designated port and enters the Listening state.


3. When the Forward Delay time of the port expires, it enters the Learning state; after another Forward Delay, it enters the Forwarding state.

------Forwarding is the final state. Before entering the final stable state, it must first go through two Lis and Lrn forwarding delays (15 seconds each. The STP of Huawei devices is a modified version. It is closer to the concept of RSTP, so you cannot see the Listening authentication status, and you can only see the Discarding status for 15 seconds)


4. The port is no longer a root port or a designated port, and enters the Blocking state. ------If the election result is the AP port, then block it directly


5. The port is disabled or the link fails. ----Disable state



Direct connection failure 30 seconds


Indirect connection failure. Theory 50 seconds. Because suboptimal BPDUs will be received in the middle, standard STP will wait for 20 seconds, while Huawei's optimization mechanism is to receive suboptimal BPDUs as soon as possible. Directly forward the optimal BPDU. and change the port role. therefore. In fact, Huawei also takes 30 seconds.


STP direct fault and indirect fault convergence test


normal live



Direct connection failure



After about 30 seconds, the port enters the forwarding state, and the two bits in the BPDU flags in the message after sending the topology change message TCN are both set to 1.


Indirect connection failure



It also takes about 30 seconds (Huawei's optimization mechanism is to receive secondary BPDU. Directly forward the optimal BPDU)



STP topology change mechanism



Topology change, STP processing process:


When a switch detects a topology change, it notifies the spanning tree's root bridge, which then floods the topology change information to the entire network. Topology change process, as shown in the figure:


1. If a new switch is added to the network, causing the working topology to change, the switch at the change point can directly perceive this change through the port status, but other switches cannot directly perceive it.


2. The switch at the change point will continue to send TCN BPDUs to the upstream through its root port with a period of Hello Time (default 2s) until it receives a configuration BPDU with TCA bit 1 sent from the upstream switch. The TCA bit is set to notify the downstream device to stop sending TCN BPDU messages.


3. After the upstream switch receives the TCN BPDU, on the one hand it will reply with the configuration BPDU with TCA position 1 through its designated port, and on the other hand it will continuously send TCN BPDUs to its upstream through its root port in a Hello Time cycle. This process is repeated until the root bridge receives the TCN BPDU.


4. After receiving the TCN BPDU, the root bridge will send a configuration BPDU with TC position 1 to notify all switches of the network topology change and notify downstream devices to directly delete the bridge MAC address entry.