STP Spanning Tree Protocol and Introduction and Rules for Selecting Root Switch

STP (Spanning Tree Protocol)

Reasons for STP (Spanning Tree):

  1. Broadcast storm
  2. Instability of MAC address table

The role of STP

1. Break the loop
2. Link backup
3. Configure BPDU

BPDU:
Bridge Protocol Data Unit (BPDU, Bridge Protocol Data Unit) spanning tree protocol is a bridge nesting protocol defined in the IEEE 802.1d specification and can be used to eliminate bridge loops. Its working principle is as follows: Spanning Tree Protocol defines a data packet called Bridge Protocol Data Unit (BPDU). The bridges use BPDUs to communicate with each other, and use the relevant functions of the BPDUs to dynamically select the root bridge and the backup bridge. But because there is only one path from the central bridge to any network segment, the bridge loop is eliminated. In a spanning tree environment, bridges do not immediately start forwarding functions. They must first select a bridge as the root bridge and then establish a designated path. The one with the lowest bridge ID in a network becomes a root bridge, and there is only one root bridge in all spanning tree networks.

**BPDU function:

1: Election of the root bridge
2: Determine the choice of redundant paths
3: Avoid loops by blocking specific ports
4: Announce network topology changes
5: Monitor the status of the spanning tree

BPDU: issued by the root bridge every 2S (the switch with the smallest bridge-id becomes the root bridge)

The original network: Every SW thinks that it is the root bridge and will send BPDUs. Compare the lowest BID to elect a root bridge. At this time, only the root bridge sends BPDUs, and the non-root bridges only forward the BPDUs. The bridge is simply modified during forwarding. id and cost fields

Classification of BPDUs:

1: Configure BPDU; usually sent by a bridge at periodic intervals, including STP parameters, for each election.
2: TCN BPDU; This kind of BPDU is generated when the switch detects that the topology structure changes, TCN BPDU, this kind of BPDU is generated when the SW detects the topology structure change, and can be sent by a non-bridge.

Rules for selecting the root switch:

The lowest BID=root bridge priority + MAC address (the smaller the better) The
default bridge priority of the switch is 32768

The method of setting the root bridge:

1: Modify the bridge priority command
[SW1] stp priorrity 0 (the value needs to be set to a multiple of 4096)

2: Set this bridge as the root bridge
[SW2] stp root primary (the priority will become 0)

The command
display stp to see who is the root bridge

Port role

DR : Root port. There is only one on each non-root bridge. The root port is elected to the root bridge with the smallest path cost.
DP : designated port, each port on the root bridge is a designated port, the port that needs to forward data on the non-root bridge is also a pointing port
AP : standby port, the interface state is backing state, only receiving BPDU, not sending BPDU

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

Port status description

Disabled: Do not forward data frames, do not learn the MAC address table, and do not participate in spanning tree calculation.
Blocking (blocking state): Do not forward data frames, do not learn the MAC address table, accept and process BPDUs, and do not send BPDU
Listening. Listening state): Do not forward data frames, do not learn MAC address tables, participate in spanning tree calculations, receive and send BPDUs
Learning (learning state): Do not forward data frames, learn MAC address tables, participate in spanning tree calculations, receive and send BPDUs
Forwarding (forwarding state): forwarding data frames, learning MAC address table, participating in spanning tree calculation, receiving and sending BPDUs

Elect the root port and specify port rules

lowest path to root bridge (lowest path cost to the root)
lowest sender BID (
lowest sender BID) lowest sender port ID (lowest sender PID)

PID = port priority (default 128) + port number

Modify the bridge interface priority command
[SW1-Ethernet0/0/2]: stp port priority 0 (must be a multiple of 16)

RSTP

The rapid spanning tree protocol shortens the transition time of spanning tree ports from blocking to forwarding.
PS: Port transition from Blocking to Forwarding has 50S delay, Blocking to Listening has 20S aging time, Listening to Learning has 15S transition time, Learning to Forwarding has 15S transition time
*

*MSTP

A VLAN implements a spanning tree to achieve link load balancing**

Guess you like

Origin blog.csdn.net/Houtieyu/article/details/107608345