STP / BPDU

STP Spanning Tree Protocol

*Why is there a Spanning Tree Protocol?
Because when there is a loop, the transmission of broadcast will cause a broadcast storm in the entire network, so it is necessary to break the generation conditions of the loop, and the spanning tree protocol is an important means to solve the two-layer broadcast storm. In addition, we will block some ports and break Loop generation conditions. When the link has problems, these blocked ports can transition to the forwarding state to realize the backup function of the link.
* Loops will cause broadcast storms and MAC address instability.

BPDU-Bridge Protocol Data Unit

*STP's various elections are realized by exchanging BPDU messages, which are directly encapsulated in Ethernet frames.
*BPDU is directly encapsulated in the second layer protocol
*BPDU functions:
1. Election of the root bridge
2. Determine the location of redundant paths
3. Avoid loops by blocking specific ports
4. Notify network topology changes
5. Monitor spanning tree Status
*BPDUs are sent by the root bridge every 2s (the switch with the smallest bridge-id becomes the root bridge)
*In the initial network, each sw considers itself as the root bridge and sends BPDUs, compares the Lowest BID, and elects a root bridge At this time, only the root bridge sends BPUD. The non-root bridge only forwards, and only the bridge-id and cost fields are modified during forwarding.
*BPDU is divided into two types:
1. Configuration BPDU-usually sent by the root bridge at periodic intervals, including STP parameters, used for various elections.
2. TCN BPDU-
This BPDU is generated when the switch detects a topology change. TCN BPDU is a BDPU generated when sw detects a topology change. Can be issued by a non-root bridge.
*The rules for electing the root bridge switch:
Lowest BID=bridge priority + MAC address (the smaller the better) The
default bridge priority of the switch is 32768.
Two ways to set the root bridge:
1. Modify the bridge priority command
stp priorisy 0 (the value is a multiple of 4096)
2. Set this bridge as the root bridge
stp root primary (primary root, priority becomes 0)

*Command to view port status:
display stp brief

Port role

RP: Root port. There is only one switch on each non-root bridge, and the root port with the smallest path cost on the root bridge is elected.
DP: Specify the port. Each port on the root bridge is a designated port, and the port that needs to forward data on a non-root bridge is also a designated port.
AP: Reserve port. The interface state is the blocking state, only receiving BPDUs but not sending BPDUs.
Port status description: Disbled: Do not forward data frames, do not learn MAC addresses, and do not participate in spanning tree calculations.
Blocking/Discarding (blocking state): Does not learn the MAC address table, accepts and processes BPDUs, and does not send BPDUs.
Listening (listening state): do not forward data frames, do not learn MAC address table, participate in spanning tree calculation, receive and send BPDU
Learning (learning state): do not forward data frames, learn MAC address, participate in spanning tree calculation, receive and send BPDU
Forwarding (forwarding state): does not forward data frames, learns the MAC address table, participates in spanning tree calculations, receives and sends BPDUs
* There is a 50s delay in port transition from Blocking to Forwarding, 20s aging time from Blocking to Listening, 15s from Listening to Learning Transition time, there is a 15s transition time from Learning to Forwaring.
*Elect the root port and specify the rules of the port:
1. Lowest Path cost to root bridge (the minimum path cost to the root)
2. lowest sender port id (the smallest sender BID)
3. lowest sender port id (the smallest sender) PID)
port priority (default 128) + sender port number
BW COST
10M 100
100M 19
1G 4
10G 2
Command to modify the priority of the bridge interface:
stp port priority 0

RSTP

Rapid spanning tree protocol shortens spanning tree protocol and shortens the transition time of spanning tree port from blocking to forwarding state.
Open the rapid spanning tree method
stp enable
stp mode rstp
MSTP: Multi-instance spanning tree, let a specified VLAN or multiple VLANs generate a tree, realize the load balance of the link
stp mode mstp stp mode is set to mstp
stp region-configuration Enter mstp setting mode
region-name huawei region name Huawei
revision-level 1 version level is 1
instance 1 vlan 10 defines instance 1 as vlan 10
instance 2 vlan 20 defines instance 2 as vlan 20
active region-configuration saves
stp instance 1 root for mstp configuration primary defines the switch as the root of instance 1
stp instance 2 root secondary defines the switch as the alternate root of instance 2

Guess you like

Origin blog.csdn.net/hotshortgg/article/details/111884880