当前位置:网站首页>STP spanning tree protocol Foundation

STP spanning tree protocol Foundation

2022-06-24 22:34:00 Zhuge iron and steel cloud

1、 Spanning tree technology background


Switch single line uplink , There is a single point of failure , Neither uplink nor equipment has redundancy , Once the link or uplink equipment fails , Business will be interrupted . To make the network more robust 、 More redundancy , Modify the topology as shown in the following figure . The access layer switch is connected to two convergence devices through dual links , Constitute a layer-2 environment with physical link redundancy , It solves the problem of single link and single equipment failure .

But it also brings a big problem , There is a loop in the layer-2 physical environment .

The harm of the second floor loop is serious , It may lead to a broadcast storm 、 Multi frame copy 、MAC Address drift and so on . Even if the loop is not caused by building a redundant physical environment , The network may also have a fault caused by the layer-2 loop for various reasons , So is there any way to solve the loop problem ? Make trees (Spanning-tree) The protocol is used to solve this problem .

2、 Problems caused by the loop – Broadcast storm


• If there is a layer 2 loop in the network , Once the broadcast data frame appears , These data frames will be continuously flooded by the switch , So as to cause broadcast storm in the network .

• The broadcast storm is very harmful to the network , It will seriously consume equipment resources and network bandwidth , Eventually, the network will be paralyzed , It is a problem that needs special attention .

1.PC Send data frame to Server;

2.SW3 Of MAC There is no matching purpose in the address table MAC Table items of , So the data frame is flooded ;

3.SW1 And SW2 Will receive this data frame and learn the source MAC, At the same time, the data frame is further flooded ;SW1 And SW2 The data frame is received from another interface , therefore MAC The table has changed again , So back and forth . 

3、Spanning-tree Basic concepts of


• By deploying the spanning tree in the switched network (Spanning-tree) technology , It can prevent layer 2 loops in the network .STP After operation , If there is a loop in the network , that STP Through blocking (Block) Specific interfaces to break the loop , And when the network topology changes, it converges in time , To ensure the redundancy of the network .

4、Spanning-tree Basic concepts of ( When the network fails )


When the topology changes , The spanning tree protocol can detect these changes , And automatically adjust the interface status in time , So as to adapt to the changes of network topology , Achieve link redundancy .

5、 Spanning tree protocol
5.1 stp Election rules

1. Each switching network elects a root bridge (Root Bridge);

2. Select a root port on each non root bridge (Root Port);

3. Each segment elects a specified port (Designated Port);

4. Blocking non specified ports (NonDesignated Port).

5.2 BPDU message

•STP Your normal work depends on BPDU Message flooding (Bridge Protocol Data Unit, Bridge protocol data unit ) .

STP Network devices are required to exchange messages with each other to detect bridging loops , This message is called the bridge protocol data unit BPDU.STP The reason why it can work well and build a loopless network , It depends on BPDU Message flooding , And according to the calculation results of relevant fields in the message . To understand STP Working process of , It is very important to understand BPDU The meaning of each field in , Because these are STP The foundation of work .

5.3 To configure BPDU Important parameters in

Comparison order :Root Identifier > Root Path Cost> Bridge Identifier>Port Identifier

The smaller the value, the higher the priority

5.4 Bridge ID

• Bridge ID(Bridge ID) It's a switch STP Identifier , altogether 8 Bytes , from 2 Priority of bytes and 6 Bytes of MAC Address structure :

• The bridge priority defaults to 32768, It can be modified by hand .

•MAC The address is the backplane of the switch MAC.

• In the network Bridge ID The smallest switch will be the root bridge .

5.5 Path Cost

• The path cost is a port quantity , yes STP/RSTP The protocol is used to select the reference value of the link .

• The default value and value range of port path cost are determined by the selected path cost algorithm , The path overhead is inversely proportional to the bandwidth of the port .

• The path cost calculation standard supported by Huawei network devices :802.1d-1998、802.1t、legacy etc. .

5.6 Port ID

• port ID (2 byte )= Port priority (1 byte )+ Port number (1 byte )

• Default priority 128, Range 0-255, The smaller the better .

6. The election process
The following is an example to illustrate :

As you can see from the above figure , After running the spanning tree algorithm ,S4 Select block F0/0,S5 Select block F0/2, You should see the non root bridge forwarding BPDU The choice made after

6.1 Not forwarded by the root bridge BPDU:

In the traditional spanning tree, only the root bridge can generate configuration BPDU, The non root bridge is only generated by the forwarding root bridge BPDU. Imagine just forwarding the root bridge BPDU, incorrect BPDU Make any changes , Just like forwarding regular data frames . In this case S4 and S5 How to judge the blocked port , Why should I block my port . This leads to the key points —— Not forwarded by the root bridge BPDU.

It can be seen that the non root bridge forwards the root bridge BPDU The following changes have been made :

1. Root path overhead

2. Sender bridge ID

3. Port identification

Decompose in three steps S4 and S5 The process of blocking ports .

l First step :S2 and S3 What you see BPDU:

S2 and S3 After seeing the message , self-discovering MAC Address is inferior to others , He gave up running for the root bridge , I have to choose the root port , As long as no smaller BID, Then I will quickly determine the root port , The root path cost in the message determines S2 and S3 Root port of .

The second step :S4 What you see BPDU:

When S4 notice BPDU Later I found myself and genbashi ID Than , Not as good as others , Then I have to decide the root port ,S2 Tell me to S1 The cost of 19,S3 Tell me to S1 The cost is also 19, Of course, the choice is S2 That way ,S3 This road can only be blocked .

bridge ID To determine the S4 Root port of , The path cost determines the blocking port

The third step :S5 What you see BPDU:

When S5 See... In the picture BPDU After that, I didn't have any ideas ,MAC The address is much larger than that of Gen bridge , I have to choose the root port .S5 Of F0/3 and F0/2 received S4 It's from BPDU The only difference in the message is the port ID, Then there is only comparison port ID 了 , Which port receives the port ID Large blocks the port .

port ID To determine the S5 Root port of , The path cost determines the blocking port .

7、STP Port status of


8、 Fault handling
But the line is out of order , The disconnected port is activated , Resume communication , Play the role of backup line

The switch needs to wait for startup 30 Seconds to start forwarding data

When a link in use is broken , Blocked ports require 50 Seconds to start forwarding data

All right. , This is it. STP The basics of the agreement , As for deeper knowledge , After that, I'll feel it slowly ~

 
————————————————
Copyright notice : This paper is about CSDN Blogger 「 The spring river and the bright moon 」 The original article of , follow CC 4.0 BY-SA Copyright agreement , For reprint, please attach the original source link and this statement .
Link to the original text :https://blog.csdn.net/qq_18649781/article/details/85616517

Spanning tree foundation
https://www.cnblogs.com/yinzhengjie/p/6696676.html
https://blog.csdn.net/qq_18649781/article/details/85616517

原网站

版权声明
本文为[Zhuge iron and steel cloud]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202211233394889.html