In a complex network, loops are inevitable. In addition, due to the need for redundancy and backup, network designers tend to deploy multiple physical links between devices, one of which is the main link and the other links are backup. This will inevitably lead to loops. Loops will cause broadcast storms, which will eventually lead to the exhaustion of the entire network resources and the network paralysis and unavailability. Loops will also cause MAC address table oscillations, resulting in the destruction of MAC address table entries. In order to break the loop, the data link layer protocol STP is used. Let's take a look at how STP breaks it. How STP works The essence of STP is to logically block one of the ends to break the loop. So what mechanism does it use to select which port is blocked? The spanning tree algorithm can be summarized into the following three steps: 1. Select the root bridge Each switch has a unique bridge ID (BID), and the switch with the smallest BID value is the root switch. Because BID (8 bytes) = bridge priority (2 bytes) + bridge MAC (6 bytes), a switch can be made the root switch by adjusting the priority. 2. Select the root port After the root bridge is selected, other non-root bridges select a port closest to the root bridge as the root port. The root port is selected based on the following:
Link Speed and Path Cost 3. Select the specified port Each network segment selects a designated port, and all ports of the root bridge are designated ports. The basis for selecting a non-root bridge designated port is as follows:
After the above three steps, the root bridge, root port and designated port are all selected. The remaining ones are non-designated ports, which are also the ports that will be logically blocked by the STP protocol. The following is a simple case to give a deeper understanding of the working process of STP. The topology shown in the figure above consists of three Huawei S5700s, with the default priority of 32768 and the same bandwidth of 1000Mbps. Huawei switches have STP enabled by default. Based on the knowledge points above, it is quickly determined that SW1 is the root switch. Since the priorities are the same, SW1 has the smallest MAC address, so it is called the root port. Verify this by executing the following command on the switch:
What are the root ports? The port closest to switch SW2 and switch SW1 is selected as the root port. As can be seen from the topology above, under the same bandwidth, GE0/0/1 port of SW2 is closest to SW1, so it is the root port. Similarly, GE0/0/2 port of SW3 is the root port. You can verify it on the switch with the following command
What are the designated ports? The cost from GE0/0/3 of SW2 and SW3 to the root port is the same. The SW3 switch port with a smaller BID is selected as the designated port. Therefore, GE0/0/3 of SW3 is the designated port, and GE0/0/3 of SW2 is the blocked port. With the above knowledge, we can achieve the desired effect by controlling some variable values. For example, to make SW3 the root switch, we can lower the priority of SW3 (it must be a multiple of 4096). Execute the following command
We can also modify the port priority, link cost and other parameters to achieve the desired effect. The specific commands are as follows:
|
>>: Understand in one article: website, URL, domain name, IP address, DNS, domain name resolution
Aeraki can help you manage any Layer 7 protocol i...
There are many ways to read data from http.Reques...
RackNerd has also released several Double 11 prom...
As China's major cities gradually enter the e...
[51CTO.com original article] As soon as I walked ...
In recent years, as the demand for connectivity c...
First, let's review the basic concept of rout...
CloudCone started its 6th anniversary promotion i...
When you use WiFi at home to surf the Internet, i...
In order to comprehensively display the developme...
[[268732]] There have been many debates recently ...
RackNerd has a certain position among low-cost VP...
For the development of the Internet of Things, &q...
HostingViet has launched a Black Friday promotion...
Wi-Fi networks can be slow due to the use of olde...