Talking about those things in STP

write at the beginning

The following STP content is the author's own experience record, and there will inevitably be omissions and mistakes. It is for reference only, of course, I will come to correct the deficiencies when I have more experience in the future.

What is STP?

STP is a data link layer protocol run by switches to solve loop problems in switch networks.

Why is there a loop?

My understanding is that in a Layer 2 network, there are multiple paths on a switch to reach the root bridge (for the time being, it is understood as the destination address that needs to be forwarded). At this time, something we don't want to see will happen.

1: address flipping

We all know that the MAC address table in the Layer 2 switch records the mapping between the source MAC address and the port entering a certain port, which is performed on demand, and the Layer 2 operations of flooding, forwarding, and discarding.

Then, when a switch has a loop, if the broadcast frame is sent, then the source MAC has at least two or more forwarding paths (assuming port1 and port2 respectively) assuming that the computer is PC1 and the MAC is MAC1,

Then there is a record in the MAC table of one path is MAC1-port1, and then another one enters from port2, then the MAC address table will be refreshed as: MAC1-port2

Multiple paths are continuously forwarded clockwise and counterclockwise, and the MAC address table is constantly flipping and oscillating. The address flipping will consume a lot of processing resources of the switch and cause the switch to be paralyzed.

2: Broadcast Storm

Because the frame of PC1 rotates clockwise and counterclockwise at a high speed, each switch in the LAN continuously receives a copy of the frame of PC1, and floods continuously, resulting in a broadcast storm. After the computer receives the broadcast frame, it will be sent to the network layer for processing. A large number of broadcast frames will cause the computer to be paralyzed

3: Multi-frame copy

Due to the existence of multiple forwarding paths, and the data frame is based on the MAC address table, multi-point forwarding may occur, that is, the data frame sent by the source address may be forwarded by multiple switches, causing the destination computer to receive multiple PC1 frames, which is called Multiple frame duplication.

Advantages and Disadvantages of Loops

The existence of loops will lead to the above three problems, address flapping, broadcast storm, and multi-frame duplication. These problems are fatal to switches or network resources. However, the loop can improve the connection reliability of the network.

Due to the existence of loops, even if the link between two switches is broken due to a fault, the entire network will still maintain connectivity, which cannot be achieved in a loop-free network.

 

Some technical terms in spanning tree

Bridge: Due to the performance of early switches, there may be only two forwarding ports. The switches at that time were called "bridges", and this term is still used today.

Bridge MAC: A switch (bridge) has multiple forwarding ports, usually the MAC of the port with the smallest number is used as the MAC of the entire switch.

Bridge ID (BID): 2 bytes priority + 6 bytes (switch MAC address), you can set the value manually, the default is 32768.

Port ID (PID): Different manufacturers have different definitions, and the composition structure is: port priority + port number.

Can a LAN need no spanning tree?

Of course, many people say that our company's network architecture itself is a loop-free network architecture, so there is no need to worry about loops.

In fact, it is not the case. Any simple small switch loop will cause your entire LAN to vibrate. This is absolutely not allowed in the enterprise. Maybe someone inserts the loop unintentionally, but it will bring a lot of inconvenience to the network administrator. Therefore, from the perspective of compliance and security, it is necessary to configure the spanning tree.

The working process of spanning tree

The first thing we need to know is why there is a spanning tree, and what is the final result?

Roughly, the Layer 2 interface of the switch, by sending BPDU (Bridge Protocol Data Unit) messages, according to the priority, finally calculates an acyclic network spanning tree

, and blocked some ports for backup. When there is a faulty link, another link can quickly enter the forwarding state, enhancing network stability.

work process

1: Elect the root bridge

2: Election root port

3: Election of designated ports

4: Block remaining ports

Note: During the election, it is actually the election of different ports of different switches or different ports of the same switch. Some human intervention or natural elections will be used to perfectly generate idle ports, that is, the remaining ports will be selected, and the Spanning Tree Protocol It will block the remaining port system, thus forming a loop-free network.

A command that is often used to ensure network stability

 

 

 

Guess you like

Origin blog.csdn.net/NeverGUM/article/details/106087544
Recommended