4.1stp configuration and routing rules


Principle overview

Stp is a protocol used to avoid loops in the data link layer. Devices that run the stp protocol exchange information to discover loops, and block ports to trim the network structure into a loop-free topology. When the network fails, switch to a link.

STP interacts with bpdu to elect the root switch. Root port, designated port.

STP principle:
In the domain, each switch elects the root switch by comparing the bridge id. The bridge id is composed of the switch priority and the mac address. The priority is first compared, and the smaller is the root, and the same is smaller than the mac.
The position of the root switch in the network is very important. If a poor switch is selected, the communication quality and data transmission of the entire network will be affected.

After the root bridge is elected, the root port is elected on each non-root bridge, and the root path cost of each port on the switch to the root bridge is first compared, which is the smallest. If they are the same, compare the uplink switch id on the link where each port is located. They are consistent and are smaller than the uplink port id on the link where they are located.

Election of designated ports on each network segment is similar to election of root ports


1. Experiment purpose and addressing

Understand the method of changing switch priority commodity overhead during the stp election process
| equipment | interface | ip | mask | gateway |

The company bought 4 switches to form a network. By default, 4 switches run stp to elect port roles based on the size of the switch's mac address, which brings uncertainty. Prone to hidden dangers.

The purpose of the experiment: s1 as the main switch, s2 backup.
s1e0/0/1 is the root commodity, s20/0/1 is the designated port, and pc1 and pc2 connected to s3 are configured as edge commodities.

2. Experimental topology

Insert picture description here

2. Experimental content

1. Basic configuration: Enable stp on the switch (Huawei switches enable mstp by default), and change the stp mode of the switch to ordinary spanning tree

s1-s4:
stp enable 
stp mode stp 

2. Root bridge election

After the configuration is completed, by default, you need to wait for 30s spanning tree recalculation (15s forwaring delay plus 15s learing). Use display stp to view the spanning tree status of s1. As long as the root bridge id is consistent with its own bridge id, it means that it is a root switch.
Now configure s1 as the primary root switch and s2 as the backup root switch. s1 priority is set to 0 s2 is changed to 4096

s1: stp priority 0
s2:  stp priority 4096 

=
s1: stp root primary 
s2: stp root secondary 

3. Understand the root port election

Insert picture description here
With the configuration of r4, this result can be obtained through the above principles. The default is 100M Ethernet links, and s2 has a higher priority.


Summary and reflection

Under what circumstances will the election of the root port and the designated port compare the port id?

When the root path cost is the same, the upstream switch ID is the same, and the upstream port is the same.

Guess you like

Origin blog.csdn.net/weixin_45821358/article/details/115257012