The stp root command configures the switch as a root bridge or secondary root bridge of a spanning tree.
The undo stp root command cancels the configuration.
By default, the switch does not function as the root bridge or secondary root bridge of a spanning tree.
STP/RSTP/MSTP: stp [ instance instance-id ] root { primary | secondary }
STP/RSTP/MSTP: undo stp [ instance instance-id ] root
VBST: stp [ vlan { vlan-id1 [ to vlan-id2 ] } &<1-10> ] root { primary | secondary }
VBST: undo stp [ vlan { vlan-id1 [ to vlan-id2 ] } &<1-10> ] root
Parameter | Description | Value |
---|---|---|
instance instance-id | Specifies the ID of a spanning tree instance. If the parameter instance instance-id is not specified, the configuration takes effect on a CIST instance. |
The value is an integer ranging from 0 to 4094. Value
0 refers to CIST. NOTE:
instance-id ranges from 0 to 4094. Each process supports a maximum of 65 instances. |
primary | Indicates that the switch functions as the root bridge of a spanning tree. | - |
secondary | Indicates that the switch functions as the secondary root bridge of a spanning tree. | - |
vlan vlan-id1 [ to vlan-id2 ] | Specifies the VLAN to which the switch used as the
root bridge or secondary root bridge belongs.
In the stp root secondary command, you can specify a maximum of 10 VLAN ranges. NOTE:
VLANs can be specified only when VBST is running. |
The value is an integer that ranges from 1 to 4094. |
System view or MSTP process view
Usage Scenario
On a spanning tree protocol network, each spanning tree has only one root bridge, which is responsible for sending BPDUs. Owning to the importance of the root bridge, the switch with high performance and network hierarchy is generally chosen as a root bridge. The priority of such a device, however, may be not that high. Therefore, setting a high priority for the switch is necessary so that the switch can function as a root bridge.
To ensure nonstop traffic transmission, run the stp root command to configure the switch as the secondary root bridge. When the root bridge is faulty or is powered off, the secondary root bridge becomes the root bridge during spanning tree calculation.
After the stp root primary command is run to set the switch to be the primary root bridge, the priority value of the switch is 0 in the spanning tree and the priority cannot be modified.
The secondary root bridge specified using the stp root secondary command has the priority value of 4096 and the priority cannot be modified.
Precautions
A spanning tree has only one root bridge.
A switch in a spanning tree cannot function both as the primary root bridge and as the secondary root bridge.
If multiple secondary root bridges are set in a spanning tree, the one with the smallest MAC address functions as the secondary root bridge of the spanning tree.
When the device connects to a non-Huawei device, you are advised to run the stp vlan { vlan-id1 [ to vlan-id2 ] } &<1-10> priority priority command to set the device priority to ensure that the root bridge is selected correctly.
# Configure the switch as the root bridge of spanning tree instance 1 when MSTP is running.
<HUAWEI> system-view
[HUAWEI] stp instance 1 root primary
<HUAWEI> system-view
[HUAWEI] stp vlan 10 root primary
# Configure the switch as the secondary root bridge of spanning tree instance 4 when MSTP is running.
<HUAWEI> system-view
[HUAWEI] stp instance 4 root secondary
<HUAWEI> system-view
[HUAWEI] stp vlan 10 root secondary