Hello everyone,
Today I will share with you the basic configuration of STP.
The basic configuration steps of STP are as follows:
Configuring the STP Mode
The device supports three spanning tree working modes: STP, RSTP, and MSTP. In a ring network that only runs STP, the switching device can choose the STP mode; in a ring network that only runs RSTP, the switching device can choose the RSTP mode. It works in MSTP mode by default.
stp mode {stp | rstp}
Configure the priority
Manually configure the device as the root bridge or backup root bridge of the specified spanning tree. When the root bridge fails or is shut down, the backup root bridge can replace the root bridge and become the root bridge of the specified spanning-tree
stp root primary
stp root secondary
At the same time, you can configure the root bridge by configuring the device priority. When configuring the priority value of a switching device: the smaller the value, the higher the priority of the switching device, and the greater the possibility of becoming the root bridge; the larger the value, the lower the priority of the switching device, and the more likely it is to become the root bridge small.
stp priority priority
Note: If the purpose of configuring the system priority for the current device is to configure the current device as a root bridge device, you can directly choose to execute the command stp root primary, and the device priority value is automatically 0 after configuration.
Run the stp root secondary command to configure the current device as a backup root bridge device. After configuration, the priority value of the device is automatically 4096.
The same device cannot be used as both the root bridge and the backup root bridge.
If you have specified the current device as the root bridge device or backup root bridge device by executing the command stp root primary or stp root secondary, and you need to change the priority of the current device, you need to execute undo stp root to enable the root device or backup root device function. Then execute the command stp priority priority to configure the new priority value.
Configure the path cost
The value range of the port path cost value is determined by the path cost calculation method. After determining the path cost calculation method, if the rate of the link on which the port is located is higher, it is recommended to set the port path cost value to a smaller value within the specified range.
In a network environment with loops, for a port with a relatively small link rate value, it is recommended to configure its path cost value to be relatively large, so that it can be elected as a blocking port in the spanning tree algorithm and block the link where it is located.
stp pathcost-standard {dot1d-1998 | dot1t | legacy}
By default, the IEEE 802.1t (dot1t) standard method is used to calculate the path cost.
interface interface-type interface-number
stp cost cost
When the port path cost calculation method is configured as legacy, the parameter cost ranges from 1 to 200000.
When the port path cost calculation method is configured as dot1d-1998, the parameter cost ranges from 1 to 65535.
When the port path cost calculation method is configured as dot1t, the parameter cost ranges from 1 to 200000000.
At the same time, you can also determine whether the port becomes a blocked port by configuring the port priority.
interface interface-type interface-number
stp port priority priority
By default, the port priority value of a switching device is 128.
Enable STP
Enable STP on the switch.
stp enable
That is all I want to share with you! Thank you!


