Spanning Tree Principle

Source: Internet
Author: User

Today we see the principles of the Spanning Tree. I looked up the CIM article and found that the Chinese translation was good. Add to favorites

Understanding of the Spanning Tree

1. Redundant bridge connections.
Use a bridge (or a switch, called a second-layer device) to connect two (simplified here, only discussed)
Two. Multiple equal) CIDR blocks can be divided into multiple collision segments to improve media usage. At the same time, we
We hope to use two or more bridges to connect two CIDR blocks so that when a bridge fails.
If the network connection is not interrupted, use the following method:
  
..|-----------Port 1--Bridge1--Port 2-------------| 
A.|Segment1---Port 1--Bridge2--Port 2-------------|B.Segment2 
  
Host a belongs to segment1 and host B belongs to segment2.
The bridge bridge1 and bridge2 are connected.
  
2. Problems Caused by redundant bridges.
If both bridge1 and bridge2 work, this problem will occur.
Assume that the ARP table of all devices is empty.
1) A sends data to B and sends an ARP request.
2) The port1 of bridge1 receives this ARP request. It is null to check the ARP list,
Therefore, a is recorded in segment1 and the packet is forwarded to segment2.
3) Suppose bridge2 receives the arp request from a slowly.
Null, so record a in segment1 and forward the packet to segment2.
4) The data packet forwarded by bridge1 to segment2 is seen by port2 of bridge2,
Because the source MAC on the data packet is a and is found on segment2
In contrast to the old ARP list (a written above is on segment1), bridge2 considers that,
A has been transferred to segment2, so the ARP table is updated, marking a in segment2
And forward the packet to port1, that is, segment1.
5) Later, the data packet forwarded by bridge2 to segment2 in step 1 is
The port2 of bridge1 has been received, and it also makes a judgment such as step 2 of bridge2,
Therefore, bridge1 also records the MAC of A to segment2 and sends the packet to port1.
.
6) Well, the data packet is sent to segment1, and the same motion is performed, and the data packet is returned to segment2,
So the two bridges do nothing, they only forward this packet, and constantly update their own
ARP table, network breakdown.
  
3. solution.
Redundant bridges require redundant backup. It seems that simply multiplication by second is not acceptable. Broadcast just now
The main cause of the storm is the bridge's ARP update mechanism, but this is the foundation of the bridge,
It cannot be changed. Therefore, we hope that only one of the two bridges is active ),
The backup bridge does not participate in packet forwarding, which can avoid loops.
Introduction of Spanning Tree
  
4. Spanning Tree is a mathematical concept. It indicates that any two points have only one path connection.
It is like a tree, from the root, to the stem, to the branches, to the leaves, any two leaves have only one path.
In the Spanning Tree Protocol, the concept of root is first introduced,
Like the root of a tree, it is the starting point of the entire network topology (L2 topology.
  
5. The idea of Spanning Tree.
If bridge2 in Figure 1 can be automatically set as a hot backup and does not participate in packet forwarding
It monitors the working status of bridge1 and can automatically replace it when bridge1 fails,
Then we can achieve our initial goal.
  
How Spanning Tree works
7. The network topology is as follows:
  
|---B3----|---B1---|---B5---| 
|---B4----|---B2---|---B6---| 
Seg2----Seg1------Seg3-----Seg4 
  
Use B1, B2 to connect seg1 and seg3, and use B3, B4 to connect seg1 and seg2,
Use B5 and B6 to connect seg3 and seg4. the left port of each B is port1,
Port2 is on the right.
  
8. design.
Generally, the Administrator designs the strongest bridge as the root and places it on the network.
The center is like B1. Strong backup as the root, parallel to the root
For example, B2. The segment connection to be backed up uses two or more bridges.
Connection, then one of them will become the designated bridge, that is
Works on the bridge, while others do not forward data packets.
  
9. Root election.
The election of the spanning tree root was initially conducted by the network.
Generally, the Administrator increases the priority of the root bridge to make it
Naturally, it becomes the root. When the bridge starts to elect the root, every bridge starts
Broadcast BPDU (Bridge Protocol Data Unit) with a bridge on it
Your MAC address and priority. When the bridge receives the BPDU of another bridge,
When its priority is higher than its own, it will not send its own information, but
This information is forwarded to the other ports. In this way, after a certain period of time,
The entire network knows who is connected. (B1 in the figure ).
  
10. Election of the designated bridge.
After the root is selected, the root starts to send a new BPDU, which contains the cost of each port.
The cost of each port in the root is 0, and the cost of other bridges must be high
0. After each bridge receives the BPDU from the root, it will know which of its own
Direction. For example, B3 knows that the root is on its right.
The port is called the root port. BPDU will not forward data to the root port.
Forward. Assume that the cost of port1 (left port) of B3 is 20, while
If port1 cost of B4 is 30, then the cost of BPDU forwarded by B3 to segment2 is
It is the cost (0) received by the root port on the right and the port on the left.
And the cost forwarded by B4 to segment2 is 0 + 30 = 30.
I don't know. I was a little scared. After B4's por1 received B3's cost information,
The port1 is in the block State and no data packets are forwarded. Similarly
Cost is higher than B5, so B5 will become the designated bridge, and B6
In the resting state. Let alone B2. Both port1 and port2 are root ports,
So it blocks both ends and knows that it is the backup root.
Okay. After a while, the network will have the designated connected to each network segment.
Bridge, spanning tree is generated.
  
11. Fault Monitoring and Data updating.
Taking B6 as an example, although port2 is block, it has been monitoring the network status. Root duration
Send BPDU, and each designated bridge sends a segment to a non-root port.
Forward to indicate that your work status is normal. If B5 fails
In the time (like two seconds), port2 of B6 does not receive the BPDU sent by B5, and
It is considered that B5 is faulty and data packets are sent through the root port (this is the only
Port .) After each bridge receives the information packet
Port forwarding (if there are other bridges between B6 and root) until it is sent
Root. After receiving the message, the root user immediately sends the BPDU so that the Network Bridge stops working,
(Because the network topology is wrong at this time), and then send the cost to let the bridge calculate
The cost of the port to generate a new tree. BPDU is uploaded to segment3, B5 is broken and cannot be forwarded
Cost and B6 forward cost = 30 to segment4. No one has any opinions.
After the daughter-in-law became a woman-in-law, she finally turned over and became the master. It was not easy. Network recovery
Normal. Similarly, if B2 does not hear the root voice at the time, it will know that he is an old man.
After the break, a BPDU will be sent, and a command will be issued. The heroes will start from the beginning, from the Central Plains to the new
Press root to repeat Step 1.
  
12. Five statuses of the bridge Port:
1) disabled. Disabled by the Administrator.
2) block. Rest, not involved in packet forwarding.
3) listening. Listen.
4) learning. Learn ARP information and prepare to change to the working status.
5) forwarding. Works properly and forwards data packets.
13. The entire spanning tree is set to 12 seconds.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.