STP protocol tree

Please

The STP protocol (Spanning Tree Protocol) can solve the problem of Layer 2 loops caused by redundant links. The specific method is to block some ports to ensure that there is only one logical forwarding link (based on the topology and use the spanning tree algorithm to avoid Loop)

  1. Problems caused by the Layer 2 loop
    (1) Broadcast storm: Broadcast frames are continuously forwarded in the loop, resulting in a decrease in switch performance and affecting normal services.
    (2) The MAC address table is unstable

2. BPDU (Bridge Protocol Data Unit) bridge protocol data unit

Various elections of STP are realized by exchanging BPDU messages, and BPDUs are directly encapsulated in Ethernet frames. (802.3+802.2)
For all SWs participating in STP, they obtain messages from other SWs in the network through the exchange of data messages, which are called BPDUs. BPDU is a protocol directly encapsulated in the second layer.

3. The function of BPDU

1. Election of the root bridge
2. Determine the location of the redundant path
3. Avoid loops by blocking specific ports
4. Announce network topology changes
5. Monitor the status of the ecological tree
BPDUs are sent by the root bridge every 2S (with the smallest bridge The switch with -id becomes the root bridge). In the initial network, each SW considered itself as the root bridge and would send BPDUs. Compare the Lowest BID and elect a root bridge. At this time, only the root bridge would send BPDUs, and non-root bridges would only forward the BPDUs, and only modify them during forwarding. id and cost fields.

4. Two types of BPDU

1. Configure BPDU-usually sent by the root bridge at periodic intervals, including STP parameters, used for various elections.
2. TC you (to pology change notification) BPDU-This kind of BPDU is generated when SW detects a topology change and can be sent by a non-root bridge.

5. Election and exchange rules

The lowest BID= bridge priority + MAC address (the smaller the better) the
default bridge priority of the switch is 32678.
There are two ways to set the root bridge:
1. Modify the bridge priority command
[] stp priority 0
2. Set this network The bridge is the root bridge
[] stp root primary (the priority will become 0)

6. Port role

RP: Root port, each non-root bridge has and owns one, and the root port with the least 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: Preparation port, the interface state is blocking state, only receiving BPDU, not sending BPDU,

bandwidth path cost
10M 100
-100M- 19
1G 4
10G 2

7. Port status description

Disabled (disabled state): Do not forward data frames, do not learn the MAC address table, and do not participate in spanning tree calculations.
Blocking (blocking state): Do not forward data frames, do not learn the MAC address table, receive and process BPDUs, and do not send BPDUs.
Listening (listening state): Does not forward data frames, does not learn the MAC address table, participates in spanning tree calculations, and receives and sends BPDUs.
Learning (learning state): Do not forward data frames, learn the MAC address table, participate in the calculation of the generated number, receive and send BPDUs.
Forwarding (forwarding state): forwarding data frames, learning the MAC address table, participating in the calculation of the generated number, receiving and sending BPDUs.
Port transition from Blocking to Forwarding, there is a 50s delay, blocking to listening has a 20s aging time, listening to learning has a 15s transition time, and learning to forwarding has a 15s transition time

8. Election of the root port, the rules of the designated port:

1.lowest path cost to root bridge (the least cost path to the root)
2.lowest sender BID (the smallest sender BID)
3.lowest sender port BID (the smallest sender PID)

Modify the bridge interface priority command

[SW1-Ethernet0/0/2]stp port priority o

Guess you like

Origin blog.csdn.net/qyf158236/article/details/107465654