stp enable

Syntax

In system view:

stp [ vlan vlan-list ] enable

undo stp [ vlan vlan-list ] enable

In Ethernet interface, Layer 2 aggregate interface, or port group view:

stp enable

undo stp enable

View

System view, Ethernet interface view, port group view, Layer 2 aggregate interface view

Default level

2: System level

Parameters

vlan vlan-list: Enables or disables the spanning tree feature for a VLAN list, which is specified in the format of vlan-list = { vlan-id [ to vlan-id ] }&<1-10>, where the vlan-id argument represents the VLAN ID, in the range of 1 to 4094, and &<1-10> indicates that you can specify up to 10 VLAN IDs or VLAN ID ranges. If you do not specify the vlan vlan-list option, the command enables or disables the spanning tree feature globally rather than for any VLAN.

Description

Use stp enable to enable the spanning tree feature globally.

Use undo stp enable to disable the spanning tree feature.

By default, the spanning tree feature is disabled globally, enabled on all VLANs, and enabled on all ports.

Configured in system view, the setting takes effect globally.

Configured in Ethernet interface view, the setting takes effect only on the interface.

Configured in port group view, the setting takes effect on all ports in the port group.

Configured in Layer 2 aggregate interface view, the setting takes effect only on the aggregate interface.

Configured on a member port in an aggregation group, the setting takes effect only after the port leaves the aggregation group.

When you enable the spanning tree feature, the device operates in STP, RSTP, MSTP, or PVST mode, depending on the spanning tree mode setting.

When you enable MSTP, the switch dynamically maintains the spanning tree status of VLANs, based on received configuration BPDUs.

When you disable MSTP, the switch stops maintaining the spanning tree status.

Related commands: stp mode.

Examples

# In MSTP mode, enable the spanning tree feature globally.

<Sysname> system-view
[Sysname] stp enable

# In PVST mode, enable the spanning tree feature globally and in VLAN 2.

<Sysname> system-view
[Sysname] stp mode pvst
[Sysname] stp enable
[Sysname] stp vlan 2 enable

# In MSTP mode, disable the spanning tree feature on port Ethernet 1/0/1.

<Sysname> system-view
[Sysname] interface ethernet 1/0/1
[Sysname-Ethernet1/0/1] undo stp enable