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
Today’s workflows are increasingly digital, and v...
DogYun (狗云) released this year's Double 11 pr...
What is Fiber Optic? Fiber optics is a type of ne...
At the theme forum "Future Network Technolog...
As the domestic prevention and control situation ...
[51CTO.com original article] As a worker, have &q...
In the digital age, acquiring website traffic dep...
BGPTO is promoting a dedicated server in Tokyo, J...
While total cost of ownership (TCO) can be a usef...
[[432405]] PV (Visit Volume): Page View, which is...
Nearly 800 million of these LTE subscriptions wer...
[[421049]] This article is reprinted from the WeC...
Hello everyone, I am the front-end developer. Tod...
The emergence of 5G technology has the potential ...
In the article "Understanding OAuth2 through...