Detailed description of Spanning Tree Protocol STP/RSTP

Source: Internet
Author: User

The Spanning Tree Protocol (Spanning Tree) is a layer-2 management protocol that selectively blocks redundant network links to eliminate L2 loops. It also supports link backup.
 
Like other protocols, the Spanning Tree Protocol is constantly updated with the continuous development of the network. The Spanning Tree Protocol is a broad concept. It does not refer to the STP protocol defined in IEEE 802.1D, but includes STP and various improved Spanning Tree Protocols Based on STP.
 
STP/RSTP
 
In the early stages of network development, transparent bridges were used. It is much smarter than a hub that only scales up and broadcasts signals. Its learning capability is to record the source MAC address and port number of the data frame sent to it. The next packet that hits this destination MAC address will only be sent from the port number in the record, unless the target MAC address is not recorded or the target MAC address itself is a multicast address, it will be sent to all ports. Using transparent bridges, different LAN networks can be interconnected, and the network's operational range can be expanded. Moreover, because transparent bridges have the MAC address learning function, they will not cause a flood of Network reports like the Hub.
 
A transparent bridge also has its own defect. Its defect lies in its transparent transmission. The transparent bridge does not know how many times the packets can be forwarded as the router does. Once the network has a loop, the packets are continuously circulating and growing in the loop, resulting in a broadcast storm.
 
To solve this problem, the Spanning Tree Protocol was proposed later.
 
The STP protocol defines RootBridge, RootPort, DesignatedPort, and PathCost, the goal is to crop redundant loops by constructing a natural tree, and at the same time achieve link backup and path optimization. The algorithm used to construct this tree is called the Spanning Tree Algorithm SPA (Spanning TreeAlgorithm ).
 
To implement these functions, the bridge must exchange some information, which is called the configuration message BPDU (BridgeProtocol Data Unit ). Stp bpdu is a layer-2 packet. The destination MAC address is the multicast address 01-80-C2-00-00-00. All bridges supporting the STP protocol will receive and process the received BPDU packets. The data area contains all the useful information used to generate tree computing.
 
The workflow of the Spanning Tree Protocol:
 
First, conduct the root bridge election. The election is based on the Bridge ID (Bridge ID) composed of the Bridge priority and the Bridge MAC address. The Bridge with the smallest Bridge ID will become the root Bridge in the network. When the bridge priority is the same (the default priority is 32768), the bridge with the smallest MAC address becomes the root bridge.
 
Next, determine the root port, and set the port with the least overhead of the root path to the root port, the path overhead is equal to '200' except for 'transmission medium rate'. Assume that the link between SW1 and the bridge is a gigabit GE link, the link between the bridge and SW3 is a mb fe link, and the default value of SW3's path overhead from Port 1 to the root bridge is 19, the overhead of the path from Port 2 through SW1 to the root bridge is 4 + 4 = 8, so Port 2 becomes the root port and enters the forwarding status.
 
After the root bridge and the root port are determined, the redundant loop is cropped. This is achieved by blocking the corresponding ports on non-root bridges.
 
After the build tree is stable for a period of time (the default value is about 30 seconds), all ports either enter the forwarding status or enter the blocking status. STPBPDU are still regularly sent from the specified ports of each bridge to maintain the link status. If the network topology changes, the Spanning Tree is re-computed and the port status changes accordingly.
 
Of course, the Spanning Tree Protocol also has a lot of content. Other improved Spanning Tree Protocols are based on this, and their basic ideas and concepts are similar.
 
The STP protocol brings new life to the transparent bridge. However, it still has shortcomings. The defects of the STP protocol are mainly manifested in the convergence speed.
 
When the topology changes, the new configuration message must pass through a certain Delay before it can be transmitted to the entire network. This Delay is called Forward Delay. The default Protocol value is 15 seconds. Before all bridges receive the changed message, if the forwarding port in the old topology does not find itself in the new topology to stop forwarding, a temporary loop may exist. To solve the problem of temporary loop, the Spanning Tree uses a timer policy, that is, adding an intermediate state that only learns MAC addresses but does not participate in forwarding between the ports from the blocked status to the forwarding status, the duration of the two State switches is Forward Delay, which ensures that no temporary loop is generated when the topology changes. However, what this seemingly good solution actually brings is at least two times the convergence time of Forward Delay!
 
In order to solve this defect of STP protocol, IEEE introduced the 802.1w standard at the beginning of the century as a supplement to the 802.1D standard. The RSTP (Rapid Spanning Tree Protocol) Protocol is defined in the IEEE 802.1w standard ). The RSTP protocol has made three important improvements based on the STP protocol, making convergence much faster (less than 1 second ).
 
The first improvement is that you have set the replace Port (Alternate Port) and Backup Port (Backup Port) roles for the root Port and the specified Port, if the root port or specified port fails, the replacement port or backup port enters the forwarding state without delay.
 
Second, improvement: In a point-to-point link that only connects two exchange ports, a designated port can enter the forwarding state without delay by performing a handshake with the downstream bridge. If it is a shared link connected to more than three bridges, the downstream bridges do not respond to the handshake request sent by the specified upstream port. They can only wait twice for the Forward time to enter the forwarding status.
 
The third improvement: directly connect to the terminal instead of defining the ports connected by other bridges as Edge ports ). Edge ports can directly enter the forwarding status without any delay. Because the bridge cannot know whether the port is directly connected to the terminal, manual configuration is required.
 
It can be seen that the RSTP protocol has indeed improved a lot compared with the STP protocol. To support these improvements, the BPDU format has been modified, but the RSTP protocol is still backward compatible with the STP protocol and can be used for hybrid networking. Even so, RSTP and STP are the same as the SingleSpanning Tree, which has many defects, mainly in three aspects.
 
First defect: because the entire switching network only has one spanning tree, a long convergence time may occur when the network size is large, and the impact of topology changes is also large.
 
Secondary defect: in the case of symmetric network structure, the single-generation tree does not have a major problem. However, when the network structure is asymmetrical, a single spanning tree will affect the network connectivity.
 
Third defect: when the link is blocked, it will not carry any traffic, resulting in a great waste of bandwidth, which is obvious in the case of loose man.
 
These defects are insurmountable by the single Spanning Tree SST, so the multi-Spanning Tree Protocol Supporting VLAN appears.

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.