[Dry goods] Novices learn STP spanning tree technology and STP troubleshooting, learn STP, see this is enough!

[Warm reminder] Need information or need to enter the group to communicate to the bottom

  1. STP basic background

1.1. Introduction
Insert picture description here

1.2. Two-layer network design requirements and problems

●In order to improve reliability, the switches are connected through multiple links to avoid single points of failure

● But at the same time it will bring some catastrophic loop problems
Insert picture description here
Insert picture description here
Insert picture description here

1.3. The hazards of loops

● Loops will cause network broadcast storms

● The host in the network will receive repeated data frames
Insert picture description here

● Fluctuating MAC address table
Insert picture description here

  1. STP protocol

2.1. Introduction to STP

● Spanning Tree Protocol, Spanning Tree Protocol, provides two major functions

● Eliminate loops

Eliminate possible loops in the network by blocking redundant links

● Link backup

When the active path fails, activate the backup link to restore network connectivity in time
Insert picture description here

2.2. Principle of STP

   通过构造一棵树来消除交换网络中的环路

Insert picture description here

2.3. BPDU

2.3.1. BPDU message

● Bridge Protocol Data Unit Bridge Protocol Data

● Use multicast address 01-08-C2-00-00-00
Insert picture description here

2.4. Basic concepts of STP

2.4.1. Election parameters

Root ID: Root bridge

● Because it is a tree network, it must have a tree root

● In an STP/RSTP network, there is one and only one root bridge, which is the logical center of the entire network. But according to the change of the network topology, the root bridge can change the root path cost

● Root Path Cost

● The sum of all path costs on the path to the root bridge

● Determine the shortest path to the root bridge and generate an acyclic tree network
Insert picture description here

BID(Bridge ID):桥ID

● Used to uniquely identify a switch in STP, consisting of two parts

● Bridge priority: high 16bit

● Bridge MAC address: low 46bit
Insert picture description here

The priority range is 0-65535, and the default value is 32768. The smaller the better

PID (Port ID): Port ID

● Used to uniquely identify a port on a switch in STP, consisting of two parts

● Port priority: 8bit higher

● Port number: low 8bit

Insert picture description here

The priority range is 0-255, the default value is 128, the smaller the better

2.4.2. Port Role

Root port

● The port closest to the root bridge path

● The root port is responsible for forwarding data to the root bridge, and is also responsible for receiving BPDU packets from upstream devices and user forwarding traffic

●On a device running STP/RSTP, there is one and only one root port, but there is no root port on the bridge

Designated port

● The designated port is the port that forwards BPDU packets to the downstream switching device

● All ports on the root bridge are designated ports

● Each network segment will select a designated port

Backup port

● As a backup of the root port

2.4.3. Port status

Disable

Equivalent to the port is disabled

Blocking

Can receive BPDU messages, but cannot send BPDUs

No MAC address learning and no data forwarding

Listening

Can receive BPDU message, can send BPDU

No MAC address learning and no data forwarding

(The port role will be determined at this time)

Learning

Can receive BPDU message, can send BPDU

Perform MAC address learning, but cannot forward data

Forwding (forwarding)

Can receive BPDU message, can send BPDU

Forward data
Insert picture description here
Insert picture description here

2.4.4. STP timer
Insert picture description here
Insert picture description here

2.5. STP election process

2.5.1. Root bridge election

After each switch starts STP, it considers itself to be the root bridge

The smallest BID becomes the root bridge
Insert picture description here

2.5.2. Root port election

Election on non-root exchanges, there is only one

Respectively based on: RID, root path cost, BID, PID (local end and opposite end) sequentially compared

Insert picture description here

2.5.3. Election of designated ports

●Election on all STP switches, there can be multiple

● According to: RID, root path cost, BID, PID (local end and opposite end) sequentially compared

● The port that is neither the root port nor the designated port will automatically become a backup port and will be blocked
Insert picture description here

2.6. STP election case

2.6.1. Case One
Insert picture description here
Insert picture description here

2.6.2. Case Two

Insert picture description here
Insert picture description here

2.6.3. Case Three
Insert picture description here
Insert picture description here

2.6.4. Case Four
Insert picture description here
Insert picture description here
Insert picture description here

2.7. Experimental demonstration of STP

Insert picture description here
Insert picture description here

●As shown in the figure, it can be seen that according to the STP election rules, 0/0/2 of SW2 is blocked. If we want to block 0/0/2 of SW3, we can modify the priority of BID to change the election result
Insert picture description here

2.8. STP topology changes

2.8.1. Root bridge failure

● After the root bridge fails, the non-root bridge will start the re-election of the root bridge after the BPDU ages
Insert picture description here

2.8.2. Direct link failure

●After SWB detects the physical failure of the direct link, it will convert the standby port into the root port

●The standby port of SWB will return to the forwarding state after 30s

Insert picture description here

2.8.3. Indirect link failure

● After the failure of a non-direct link, it takes about 50s for the standby port of the SWC to recover to the forwarding state

Insert picture description here

2.8.4. Problems caused by topology changes

●MAC address table error
Insert picture description here

●Solution

Insert picture description here

  1. When the switch discovers that its direct link fails, C will generate a BPDU type—TCN (topology change notification)

  2. After switch B receives it, it will return a TCA to indicate that it has received it, and at the same time send the TCN to the upstream device (up to the root bridge) switch A

  3. After switch A receives it, it will return a TC (topology change) to notify the downstream router to change the aging time of the MAC address table from 300s to 15s for refreshing

  4. Switch B will refresh the MAC address table after receiving it

2.8.5. STP configuration
Insert picture description here

In order to better help you learn and understand network engineers, and other related content, I deliberately organize all the materials systematically, and share them here for free. Necessary materials for network workers, including:
Huawei Certification Mind Map (Superfine); Huawei Certification Essential Knowledge Documents (pdf); Collection of Essential Net Worker Knowledge Documents; Essential Toolkit for Net Workers; Essential Net Workers Prepare experiment package;
necessary video interview package for net workers. …… There is a lot of information, I won’t list all of them, so I’ll write here first. If you have any questions, please leave a message and discuss private messages~

Guess you like

Origin blog.csdn.net/ZYJY2020/article/details/112946033