Spanning Tree Protocol: STP

Spanning Tree Protocol:
Enterprise Network Three-Layer Architecture—"Redundancy—"Line Redundancy—"Layer 2 Bridged Loops—
Causing problems:
1. Broadcast storm
2. MAC address table rollover
3. Repeated copy of the same data frame
4. 、 The above 3 conditions eventually cause the equipment to work overload, leading to restart protection

Spanning tree: In a two-layer switching network, a tree structure is generated, and some interfaces are logically blocked, so that there is only a unique path from the root to all nodes; when the best path fails, the partially blocked ports are automatically opened. To realize the role of line backup; during the
spanning tree generation process, a star structure and shortest path tree should be generated as much as possible;
there are algorithms: 802.1D PVST PVST+(CISCO) RSTP(802.1w) MSTP(802.1S)

1. 802.1D There is only one instance of spanning tree in a switching network;
BPDU-Bridge Protocol Data Unit is used between switches-data transmitted and received between switches
Insert picture description here

Configure BPDU—only the root bridge can send. In the initial state of the switching network, all switches define the local as the root bridge to send BPDUs; make all switches in the network receive BPDUs from other devices, and then based on the data The parameters are compared, and the root bridge is elected; all non-root bridges no longer send BPDUs, but only receive and forward the BPDUs of the root bridge; send in 2s period, hold time 20s;

TCN—Topology change message (also BPDU): After the local switch link fails, STP reconverges. In order to quickly refresh the MAC tables of all switches in the entire network, TCN (TCN position in the flag bit is 1) will be sent to all local STP interfaces. After receiving the TCN, the neighboring switch first marks the ACK bit as a reply for reliable transmission of the message; then forwards the TCN to the root bridge step by step, and the root bridge replies with a TC message to reply to all the switches step by step; The switch temporarily changes the old exchange time of the MAC table to 15s (default, forwarding delay)
Insert picture description here

Election — Root bridge root port designated port non-designated port (blocking port)

[1] Root bridge – In a spanning tree instance, one and only one switch is root;
the bridge ID in the BPDU determines the
bridge ID = bridge priority (0-65535 public) default 32768 + MAC address ( Only the switch with the svi interface has the mac address. If there are multiple macs, the smallest value is selected.)
The election of the root bridge first compares the priority, and the smaller is the best; if the priority is the same, compares the mac, the smaller the number is better;

[2] Root port—On each non-root bridge, there is one and only one interface; the local interface (shortest, star) closest to the root bridge receives BPDUs from the root bridge and forwards user traffic ( The interface is not blocked)

Rules:
1. Compare the smallest cost value when entering through the interface after it is sent from the root bridge;
2. If the inbound cost value is the same, compare the BID of the peer device of the interface, and it is small.
3. The peer BID is also the same, compare The PID of the interface of the opposite device of this interface; the priority is small first, if the priority is the same, the number is small
4, even the PID of the opposite end is the same, compare the local PID, small is better;
PID=port ID interface priority (0-240, Step size 16, default 128) Interface number

[3] Designated ports, there is one and only one on each physical link with STP; forwards BPDUs from the root bridge, and can forward user traffic (not blocked); all interfaces on the root bridge are designated by default Port;
1. Compare the minimum cost value when entering this link through the interface after it is sent from the root bridge (outgoing)
2. If the outgoing cost value is the same, the local BID must be small;
3. The local BID is the same. Compare the local PID;
4. If the local PID is the same, directly block the port;
[4] Non-designated ports (blocking ports) After all the above roles are elected, the remaining interfaces without any roles are non-designated;
the interface is logically blocked , The information can actually be received but not forwarded;

Cost value: Different bandwidths have different costs.
802.1d standard: 802.1T standard
10M = 100 1000M= 20000
100M=19 100M=200000
1000M=4
10000M=2

100000M=1

[SWA]stp pathcost-standard? By default, Huawei uses 802.1t standard
dot1d-1998 IEEE 802.1D-1998
dot1t IEEE 802.1T
legacy Legacy

In the generation protocol, the root bridge should at least interfere with the convergence layer;

Interface status:
down: No BPDU transmission and reception, once BPDU transmission and reception can proceed to the next state.
Listening: mandatory 15s; all switches perform BPDU transmission and reception and elect all roles; the interface role is a non-designated port and directly enters the blocking state;
if it is a designated port and Root port enters the next state;
learning: mandatory 15s; designated ports and root ports learn the MAC addresses of all interface connected devices to generate a MAC table; then enter the next
state;
forwarding: refers to the entry of the end port and the root port, and can forward users Message;
Blocking: logical blocking;
Note: Data messages can be forwarded for users only after the interface enters the forwarding state, and no data can be forwarded in the previous 30s;

Convergence time:
initial convergence—30s = 15 listening + 15s learning
Structure change:
direct connection detection: there is a blocked port locally, if other ports are disconnected, the blocked port will immediately enter 15 for listening (election); if the result is
enabled , Then it will enter 15s to learn again—
there is no direct connection detection for 30s : there is no blocked port locally. If a port is disconnected, it will send sub-optimal BPDUs (with the local root as the root) to other neighbor switches, and other switches ignore the data. Perform 20s hold time timing, block the interface to enter 15s listening when that time, 15s learning = total 50s

Disadvantages of 802.1D:
1. Slow convergence
2. Low link utilization

802.1 configuration command:
[sw1]stp mode stp is modified to 802.1d algorithm, currently Huawei defaults to MSTP;
[sw1]stp priority 4096 modify the bridge priority

[sw1-GigabitEthernet0/0/1]stp cost? Modify the interface cost value
INTEGER<1-200000000> Port path cost

[sw1-GigabitEthernet0/0/1]stp port priority? Modify the interface priority
INTEGER<0-240> Port priority, in steps of 16
2. PVST cisco private vlan-based spanning tree protocol
exists in each vlan Tree, the working principle of each tree is the same as 802.1d; the difference between the BPDUs of different vlans lies in the priority;
priority=4096 multiples + vlan id artificially only can modify the 4096 multiples backup, and can only be modified to the whole multiple of 4096,
only supports trunk Trunk encapsulation is ISL (cisco private encapsulation)

3. PVST + On the basis of PVST, it is compatible with the 802.1q trunk package; and part of the acceleration is designed;
port acceleration (entry layer to connect the user interface) uplink acceleration-for direct connection detection backbone acceleration-for sub-optimal BPDU
shortcomings :1. Slow convergence (incomplete acceleration) 2. Many trees (only cisco has a separate chip, and friends cannot load it)

Fourth,
the RSTP of the rapid spanning tree cisco-vlan-based rapid spanning tree-one vlan one tree pvst+ upgrade
Public RSTP (802.1w)-the entire switching network one tree 802.1d upgrade
Fast principle:
1. Cancel timing After the completion of the work in one state, it directly enters the next state;
2. Segmented synchronization, convergence between two devices step by step; use request and consent flags; rely on the first and sixth bits of the flag
3. The keep-alive of BPDU is 6s; hello time 2s;
4. Port acceleration (edge ​​interface), uplink acceleration, and backbone acceleration are integrated.
5. It is compatible with 802.1d and PVST, but 802.1d and PVST do not use the first mark bit. 1-6 bits, so fast convergence is not possible; therefore, if a device in the network does not support fast convergence, then other devices that enable fast convergence cannot be fast;
when the tcn message appears, there is no need to wait for the BPDU of the root bridge. Refresh the local cam table;

Remember: When the interface defaults to half-duplex, even if RSTP is allowed, it is still based on the slow 802.1D algorithm to converge;
[sw1] stp mode rstp
edge interface—the interface used to connect to the PC, once it is set as an edge interface; Sending BPDUs without STP convergence, directly in the forwarding state; but if the interface receives the BPDU from the opposite end, it will lose the edge characteristics and re-converge normally;
[sw1]interface GigabitEthernet 0/0/1
[sw1-GigabitEthernet0 /0/1]stp edged-port enable

[sw1]stp priority? Modify the bridge priority
INTEGER<0-61440> Bridge priority, in steps of 4096

[sw1]stp root? Quickly define the role of the root bridge
primary Primary root switch
secondary Secondary root switch

[sw1-GigabitEthernet0/0/1]stp port priority? Modify the interface priority
INTEGER<0-240> Port priority, in steps of 16

[sw1-GigabitEthernet0/0/1]stp cost? Modify interface cost
INTEGER<1-200000000> Port path cost

5. MSTP/MST/802.1S Huawei equipment uses this protocol
by default, inheriting the foundation of rapid spanning tree; placing multiple VLANs in a group, based on one spanning tree for each group;
priority in BPDUs between different groups = 4096 multiple + group number
[r1]stp mode mstp
defaults to group 0, and all VLANs are in this group by default; priority = 32768+0
grouping
[sw1]stp enable
[sw1]stp region-configuration
[sw1-mst-region] region-name a All devices should be in a group
[sw1-mst-region]instance 1 vlan 1 to 5
[sw1-mst-region]instance 2 vlan 6 to 10
[sw1-mst-region]active region-configuration to activate the current Configuration (must configure this command)
Remember: if a group will be created, but the vlan in the group is not created on this switch, and there is no interface serving the vlan; the group will have no information; the entire switching network The grouping information of all devices must be completely consistent;
define local as the primary root of group 1, and
change the priority of stp instance 1 root primary as the backup root of group 2 to 0
stp instance 2 root secondary priority to 4096

[sw1]stp instance 1 priority ?
INTEGER<0-61440> Bridge priority, in steps of 4096

[sw1]interface GigabitEthernet 0/0/1
[sw1-GigabitEthernet0/0/1]stp instance 1 cost ?
INTEGER<1-200000000> Port path cost

[sw1-GigabitEthernet0/0/1]stp instance 1 port priority ?
INTEGER<0-240> Port priority, in steps of 16

Guess you like

Origin blog.csdn.net/Han_V_Qin/article/details/112711118