Spanning Tree [01] Introduction to Spanning Tree and explanation of STP principles

Source: Internet
Author: User

Spanning Tree [01] Introduction to Spanning Tree and explanation of STP principles
Why do we need to use the Spanning Tree Protocol? The Spanning Tree Protocol is a layer-2 link protocol. As shown in, vswitches play an important role in L2 Networks. If a switch fails, the use of the network may be affected. To avoid spof, in the actual L2 link, link redundancy is used, that is, multiple contact connections are used between switching devices, that is, multiple switches are connected, so that even if one switch fails, you can also use other vswitches. This is link redundancy. Although this method is good, it will produce a fatal problem. Each switch device has a link connection, and the route of data packets to the target host will increase, in this way, data packets are constantly forwarded between switches to form a loop. Multiple links form a critical issue of loop 1. Form a broadcast storm: A broadcast storm is formed when data packets are continuously broadcast and forwarded in the loop. 2. multi-frame replication: When the switch receives an uncertain unicast frame, it will perform a flood operation, which means that a unicast frame in the loop will be copied to multiple copies during transmission. 3. the MAC address table is unstable: If the switch receives the same frame on different ports, its MAC database will become unstable. In either of the above three cases, the L2 network link will crash. Solution Analysis: we know that all the reasons for this situation are that the L2 link forms a loop. Why does it form a loop? Data frames form a loop for mutual replication, forwarding, and transmission between the vswitches connected to the target host. If we can specify a shortest path for each data frame to reach the target host, the loop will not be formed because the data frame is transmitted along the given route. This solves the loop problem formed by the random transmission of data frames, solves the above problems, and achieves link redundancy. How can we specify the shortest path? You can add a Protocol to the link. This protocol is the Spanning Tree Protocol. Which IEEE associations of Spanning Tree Protocol have passed the 802.1d protocol, that is, the first generation Spanning Tree Protocol STP, which is the same as other protocols, they are constantly updated with the continuous development of networks. Up to now, there have been three generations of this Protocol; the first generation STP/RSTP, the second generation PVST/PVST + (Cisco has) third generation MTSTP/MSTP we only explain STP, RSTP and MSTP. The savior STP (802.1d) is also called the Spanning Tree Protocol. When such a loop is raging, STP like a savior came to us. The main function of STP is to solve the loop problem caused by backup connection through a series of operations. Note: The standard 802.1d STP protocol cannot achieve real redundancy and load balancing. Description of STP Operation Principle: by blocking redundant links, a loop-based bridge network is trimmed into a non-loop tree topology, that is, data frames can start from a source at a certain time point, there is only one path to any target in the network, and other paths are inactive (Forwarding is not allowed ), if a faulty link is found in the network, the switch with STP technology enabled in the network will open the inactive blocking port and restore the previously disconnected link, ensure network connectivity. As shown in: data frames that arrive at PC1 from PC0 pass through a loop consisting of three switches in the middle. The STP protocol selects a shortest path for data frames to arrive at pc1. If the STP protocol is computed and it is considered that the path 2-3 to PC1 is the shortest path, the path 1 will be in the inactive state, that is, the relevant ports on the first road will be blocked. If the switch S1 fails and the two and three routes cannot go, STP activates the one route to ensure that the data frame can reach the PC1.STP principle-Step 4 in sequence: 1. to select the root bridge (root switch) RB, You need to select a root switch RB in the network. To select the RB, You need to select the switch and communicate with the switch, this information is called BPDU (Bridge Protocol Data Unit), which is sent once every 2 seconds. BPDU contains a large amount of information, but RB only compares BID (Bridge ID ), the minimum BID is the root switch. BID = bridge priority + bridge MAC address. First compare the bridge priority, and then compare the bridge MAC address priority. Generally, the bridge priority is the same, all are 32768, so generally only compare the bridge MAC address, the minimum MAC address (that is, the minimum BID) serves as the RB. For example, SW1: Default priority 32768 MAC 0c0011111111 SW2: Default priority 32768 MAC 0c0022222222 is obvious. If the priority is equal, the MAC address SW2 is small, so SW2 is the root switch. 2. select the root port RP (select the port closest to the root bridge). For each non-root bridge, select a port to connect to the root bridge. Note that: the root port can only be selected on a non-root switch. When a non-root bridge has multiple ports that can be connected to the root bridge, you should select a port with better performance as the root port based on: first, compare overhead Q, second, compare the PID (port ID), as shown in: according to the selection of the root bridge, you can determine that SwitchZ is the root bridge, that is, the root switch. SwitchX and SwitchY are non-root bridges. If SwitchX is not a root bridge, you need to select a port (only one port can be selected) to connect to SwitchZ (root bridge). The first difference is the overhead Q:
Bandwidth: 802.1d (STP) 802.1w (RSTP) 10 Mb/s1002000000100Mb/s192000001000Mb/s420000
Connect to the root bridge through Port0, Q = 19. connect to the root bridge through Port1, Q = 100 + 19 = 119. obviously, the cost of connecting to the root bridge via Port0 is small, so SwitchX and SwitchY Port0 are selected as the root port. However, if Q is the same, you need to compare the PID. PID = port priority + port number. Generally, the port priority is the default value. Therefore, the port with a smaller port number will become the root port. Note: first compare the overhead and then compare the PID. 3. Select the specified port DP and select a port on the link between each vswitch as the specified port. Example: As shown in: there are 3 CIDR blocks, X-Y, Y-Z, X-Y, where the specified ports for the first two CIDR blocks are ports on SwitchZ (root bridge, because the root bridge does not have the root port, some just specify the port, and the X-Y (Red Line Segment) of the specified port needs to be selected, according to the following: X overhead for arriving at the root bridge Q = 19Y overhead for arriving at the root bridge Q = 19 because Q is the same, it is necessary to compare BID (specified port ID), and SwitchX has a small BID, therefore, the port1 located on SwitchX will become the specified port of the CIDR block. 4. the RP and DP sets the forwarding status. If other ports are set to the blocked RP and DP, the selected RP and DP are set to the forwarding status. Other ports that are neither the root port nor the specified port will be blocked! Through the above four steps, a non-loop network can be formed. There are three STPS: 1. Hello Time: the Time interval between BPDU sent by the root bridge. It is also the Time interval between each bridge sending its own BPDU during network initialization. 2. forwarding Time: the Time of the Listening and Learning ports. The default value is 15 s. This value can be configured to ensure that the BPDU is forwarded across the network, due to the limitation of Forwarding Time, it is recommended that the diameter of the network be less than 73. max Age: the maximum time for storing BPDU. If the port cannot accept BPDU after this time, corresponding measures are taken. The default time is 20 s. Note: After the topology is stable, the three time periods are issued by the root bridge, and the root bridge unifies the timer throughout the network, which is valid only when the root bridge is modified. STP port status overview when protocol information BPDU passes through a switching network. Propagation delay may occur, so the topology of the switching network may change. Each L2 lanport using STP has the following five statuses: 1. blocking: Port 10 s cannot be used for Frame Forwarding. listener (Listening): 15 s. This is the first transition status after the port is blocked. STP considers that the L2 lanport in this status should be involved in Frame Forwarding. 3. learning: 15 s in preparation for Frame Forwarding status 4. forward: the port can officially forward frames 5. disabled: the port does not participate in STP or frame forwarding. STP port topology change: When STP is enabled and the device is powered on, each port and network must experience a transitional state such as blocking, listening, and learning. As shown in. 1. congestion status port changes: before switching BPDU, network devices assume that they are the root, and the port is always in the blocking status during initialization. After the BPDU is switched, you can determine which device acts as the root bridge. The port in the blocking status executes the following tasks: discard the frames received from the network segment; discard the frames exchanged with other forwarding ports and do not add the destination position to the address database. Receives BPDU and transmits them directly to the system module. Do not transmit the BPDU received from the system module 2. listener status port changes: When STP determines that the L2 lanport should be involved in Frame Forwarding, it enters the listener status and the listener status port to execute the following tasks: discarded frames received from the CIDR block. Discarded frames exchanged with other forwarding ports do not add the endpoint to the address database. Receives BPDU and transmits them directly to the system module. Receive, process, and transmit the BPDU3. learning State received from the system module: From the listening state to the learning State: in the Learning state, the following tasks are executed: discard the frames received from the CIDR block. Discard the frames exchanged with other forwarding ports and add the ending point to the address database. Receives BPDU and transmits them directly to the system module. The BPDU4. forwarding status port received from the system module changes. The port in the forwarding status can be officially forwarded. A port in the listening status performs the following tasks: Forwarding frames received from the network segment; forwarding frames exchanged with other forwarding ports adds the destination position to the address database. Receives BPDU and transmits them directly to the system module. Process and transmit the BPDU5. disabled port changes received from the system module: the disabled port does not participate in Frame Forwarding or STP. Note: It is not recommended to disable the Layer 2 port because it is equivalent to a waste of listening ports for the following tasks: discard frames received from the network segment; discarded frames exchanged with other forwarding ports do not add the endpoint to the address database. Do not receive BPDU and pass them directly to the system module. This is the change of the switch topology port in the entire network until the final network is stable. Summary --- STP operation process arrangement assume that S1 is the root switch. When the network is stable, in this stable state, the root switch S1 sends the BPDU packet to the network at a frequency of 2 seconds, the non-root switch S2 accepts the BPDU through the root port, and then sends the BPDU packet to S3 through the specified port. In this way, BPDU packets can be smoothly transmitted to each vswitch of the network. However, when the network topology changes, the switch will send a tcn bpdu packet to the root switch. The changes here are as follows: (when the following situations occur, the switch will send tcn bpdu) 1. the port in the forwarding or listening status transitions to the blocking status, which is usually a link fault 2. a port in the inactive status enters the forwarding status, which usually adds a new link 3. the switch receives the TCNBPDU packet from the specified port. Assuming that S3 has one of the above conditions, the switch considers the network topology to have changed, s3 sends a tcn bpdu packet from the root port to the root switch (this is to S2). S2 accepts the tcn bpdu through the specified port and performs step 2, then, send S3 a single chloroform packet and perform step 3 to send the tcn bpdu packet to the root switch. S1 (root switch) receives the tcn bpdu packet and then performs step 4, send tc bpdu to S2. S2 receives tc bpdu and forwards it to S3. After receiving the tc bpdu packet, the switches S2 and S3 set their MAC Address Table aging time (survival time) to 15 s and start to learn new forwarding paths to Ensure network stability. In Port changes, it takes 10 seconds from blocking to listening, 15 seconds from listening to learning, and 15 seconds from learning to forwarding. This time is unacceptable in the fast-growing network, because it is too slow. Is there a Spanning Tree Protocol that can converge these times? The answer is yes, that is, RSTP-fast Spanning Tree Protocol. Let's discuss in the next article to see where RSTP is going soon.

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.