The stp enable command enables STP/RSTP/MSTP/VBST on a switching device or an interface.
The undo stp enable command disables STP/RSTP/MSTP/VBST on a switching device or an interface.
The stp disable command disables STP/RSTP/MSTP/VBST on a switching device or an interface.
The undo stp disable command enables STP/RSTP/MSTP/VBST on a switching device or an interface.
By default, STP/RSTP/MSTP/VBST is enabled globally and on an interface.
System view, MSTP process view, Ethernet interface view, GE interface view, XGE interface view, MultiGE interface view, 40GE interface view, 100GE interface view, Eth-Trunk interface view, port group view, 25GE interface view
Usage Scenario
On a complex Layer 2 network, to prevent loops or break loops, STP/RSTP/MSTP/VBST can be configured on switching devices.
Running the stp enable command enables STP/RSTP/MSTP/VBST. The devices running STP/RSTP/MSTP/VBST discover loops on the network by exchanging information with each other and trim the ring topology into a loop-free tree topology by blocking a certain interface. In this manner, replication and circular propagation of packets are prevented on the network. In addition, the processing performance of devices is prevented from deteriorating.
Enabling STP/RSTP/MSTP/VBST consumes system resources so that you can run the stp disable command to disable STP/RSTP/MSTP/VBST on devices or interfaces that do not participate in the spanning tree calculation.
To prevent the CPU from being affected and faults such as network flapping from occurring, the following lists the recommended maximum number of STP-enabled ports in Up state for different models:
S2720-EI, S5720-LI, S5735-L, S5735S-L, S5735S-L-M, S5720S-LI, S5730-SI, S5730S-EI, S6720-LI, S6720S-LI, S6720-SI, S6720S-SI, S5720I-SI, S5720-SI, S5735-S, S5735S-S, S5735-S-I, and S5720S-SI: 128
S5720-EI: 200
S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720-HI, S6720S-EI, S6730-H, S6730S-H, S6730-S, and S6730S-S: 256
Pre-configuration Tasks
Run the stp mode { mstp | rstp | stp } command to set the working mode of the switching device.
Run the stp [ instance instance-id ] priority priority command to set the priority of the switching device in the spanning tree.
Run the stp [ process process-id ] [ instance instance-id ] port priority priority command to set the priority of the interface in the spanning tree instance.
Run the stp [ instance instance-id ] root primary command to set the switching device as the primary root bridge of the spanning tree.
Run the stp [ instance instance-id ] root secondary command to set the switching device as the secondary root bridge of the spanning tree.
Run the stp [ process process-id ] [ instance instance-id ] cost cost command to set the path cost of the interface in the spanning tree instance.
If the spanning tree protocol is MSTP, run the region-name name, instance instance-id vlan { vlan-id [ to vlan-id ] } &<1-10>, vlan-mapping modulo, and revision-level level commands to configure the MST region.
Run the stp mode vbst command to set the working mode of the switch.
Run the stp vlan { vlan-id1 [ to vlan-id2 ] } &<1-10> priority priority command to set the priority of the switch in the spanning tree.
Run the stp vlan { vlan-id1 [ to vlan-id2 ] } &<1-10> port priority priority command to set the priority of the port in the spanning tree instance.
Run the stp vlan { vlan-id1 [ to vlan-id2 ] } &<1-10> root primary command to set the switch as the root bridge of the spanning tree instance.
Run the stp vlan { vlan-id1 [ to vlan-id2 ] } &<1-10> root secondary command to set the switch as the secondary root bridge of the spanning tree.
Run the stp vlan { vlan-id1 [ to vlan-id2 ] } &<1-10> costcost command to set the path cost of the port in the spanning tree instance.
Run the instance instance-id vlan vlan-id command to configure 1:1 mapping between MSTIs and VLANs.
Other configurations are needed based on real-world situations.
Precautions
If STP/RSTP/MSTP/VBST is enabled on an interface, the interface participates in the spanning tree calculation and determine whether it is in the forwarding state according to the calculation result.
If STP/RSTP/MSTP/VBST is disabled on an interface, the interface does not participate in the spanning tree calculation and it is always in the forwarding state.
STP/RSTP/MSTP/VBST must be enabled on all interfaces that participate in the spanning tree calculation. Otherwise, a loop may occur.
Spanning tree calculation may result in network flapping. Before network convergence, packets cannot be correctly forwarded. In this case, if the DHCP server is configured on a VLANIF interface, DHCP clients obtain IP addresses slowly. To solve the problem, disable STP or configure the device interface connected to a terminal as the edge interface.
If the undo stp enable or stp disable command is run in the system view, the global STP function is disabled, which may cause a loop.
If the undo stp enable or stp disable command is run in the MSTP process view, the STP function in the MSTP process is disabled, which may cause a loop in the MSTP process.
Follow-up Procedure
After STP is enabled globally and on an interface, run the stp vlan enable command to enable STP in a VLAN so that VBST can take effect.