Spanning Tree Commands

spanning-tree bpdu (Global)

To define Bridge Protocol Data Unit (BPDU) handling when the spanning tree is disabled globally or on a single interface, use the spanning-tree bpdu command in switch configuration mode. To restore the default configuration, use the no form of this command.

spanning-tree bpdu { filtering | flooding}

no spanning-tree bpdu

Syntax Description

filtering

Specifies that BPDU packets are filtered when the spanning tree is disabled on an interface.

flooding

Specifies that untagged BPDU packets are flooded unconditionally (without applying VLAN rules) to all ports where spanning tree is disabled and the BPDU handling mode is flooding. Tagged BPDU packets are filtered.

Command Default

The default setting is flooding.

Command Modes

Switch configuration (config-switch)

Command History

Release Modification
3.5.1

This command was introduced.

Usage Guidelines

The filtering and flooding modes are relevant when the spanning tree is disabled globally or on a single interface.

Examples

The following example sets the BPDU packet handling mode to flooding when the spanning tree is disabled on an interface:


nfvis(config-switch)# spanning-tree bpdu flooding
nfvis(config-switch)# commit
nfvis(config-switch)# end 

spanning-tree forward-time

To configure the spanning-tree bridge forward time, which is the amount of time a port remains in the listening and learning states before entering the forwarding state, use the spanning-tree forward-time command in switch configuration mode. To restore the default configuration, use the no form of this command.

spanning-tree forward-time seconds

no spanning-tree forward-time

Syntax Description

seconds

Specifies the spanning-tree forward time in seconds. Valid range is from 4 to 30.

Command Default

15 seconds

Command Modes

Switch configuration (config-switch)

Command History

Release Modification
3.5.1

This command was introduced.

Usage Guidelines

When configuring the forwarding time, the following relationship should be maintained:

2 * (Forward-Time - 1) >= Max-Age >= 2 * (Hello-Time + 1)

Examples

The following example configures the spanning tree bridge forwarding time to 25 seconds:


nfvis(config-switch)# spanning-tree forward-time 25 
nfvis(config-switch)# commit
nfvis(config-switch)# end

spanning-tree hello-time

To configure how often the device broadcasts Hello messages to other devices, use the spanning-tree hello-time command in switch configuration mode. To restore the default configuration, use the no form of this command

spanning-tree hello-time seconds

no spanning-tree hello-time

Syntax Description

seconds

Specifies the spanning-tree Hello time in seconds. Range is from 1 to 10.

Command Default

2 seconds

Command Modes

Switch configuration (config-switch)

Command History

Release Modification
3.5.1

This command was introduced.

Usage Guidelines

When configuring the Hello time, the following relationship should be maintained:

Max-Age >= 2*(Hello-Time + 1)

Examples

The following example configures the spanning-tree bridge hello time to 5 seconds:


nfvis(config-switch)# spanning-tree hello-time 5
nfvis(config-switch)# commit
nfvis(config-switch)# end

spanning-tree loopback-guard

To shut down an interface if it receives a loopback BPDU, use the spanning-tree loopback-guard command in switch configuration mode. To return to the default setting, use the no form of this command.

spanning-tree loopback-guard

no spanning-tree loopback-guard

Syntax Description

This command has no arguments.

Command Default

None

Command Modes

Switch configuration (config-switch)

Command History

Release Modification
3.5.1

This command was introduced.

Usage Guidelines

This enables shutting down all interfaces if a loopback BPDU is received on it.

Examples


nfvis(config-switch)# spanning-tree loopback-guard
nfvis(config-switch)# commit 
nfvis(config-switch)# end 

spanning-tree max-age

To configure the STP maximum age, use the spanning-tree max-age command in switch configuration mode. To restore the default configuration, use the no form of this command.

spanning-tree max-age seconds

no spanning-tree max-age

Syntax Description

seconds

Specifies the spanning-tree bridge maximum age in seconds. Valid range is from 6 to 40

Command Default

20 seconds.

Command Modes

Switch configuration (config-switch)

Command History

Release Modification
3.5.1

This command was introduced.

Usage Guidelines

When configuring the maximum age, the following relationships should be maintained:

2*(Forward-Time - 1) >= Max-Age

Max-Age >= 2*(Hello-Time + 1)

Examples

The following example sets the spanning-tree bridge maximum age to 10 seconds.


nfvis(config-switch)# spanning-tree max-age 10
nfvis(config-switch)# commit
nfvis(config-switch)# end

spanning-tree mode

To select which Spanning Tree Protocol (STP) protocol to run, use the spanning-tree mode command in switch configuration mode. To restore the default configuration, use the no form of this command.

spanning-tree mode { stp | rstp| mst}

no spanning-tree mode

Syntax Description

stp

Specifies that STP is enabled.

rstp

Specifies that the Rapid STP is enabled.

mst

Specifies that the Multiple STP is enabled.

Command Default

The default is rstp .

Command Modes

Switch configuration (config-switch)

Command History

Release Modification
3.5.1

This command was introduced.

Usage Guidelines

In RSTP mode, the device uses STP when the neighbor device uses STP.

In MSTP mode, the device uses RSTP when the neighbor device uses RSTP, and uses STP when the neighbor device uses STP.

Examples

The following example enables STP:


nfvis(config-switch)# spanning-tree mode stp
nfvis(config-switch)# commit
nfvis(config-switch)# end

Examples

The following example enables MST:


nfvis(config-switch)# spanning-tree mode mst
nfvis(config-switch)# commit
nfvis(config-switch)# end

spanning-tree mst configuration

Use the spanning-tree mst configuration command to enable configuring an MST region by entering the MST mode.

spanning-tree mst configuration

Command Modes

Switch configuration (config-switch)

Command History

Release Modification
3.8.1

This command was introduced.

Usage Guidelines

For two or more switches to be in the same MST region, they must contain the same VLAN mapping, the same configuration revision number, and the same name.

Examples

The following example configures an MST region.


nfvis(config-switch)# spanning-tree mst configuration
nfvis(config-switch-mst)# instance 1 vlan 15
nfvis(config-switch-mst)# name mst_test 
nfvis(config-switch-mst)# revision 2
nfvis(config-switch-mst)# commit 
 

spanning-tree mst max-hops

Use the spanning-tree mst max-hops command to configure the number of hops in an MST region before the BDPU is discarded and the port information is aged out. Use the no form of this command to restore the default configuration.

spanning-tree mst max-hops hop-count

no spanning-tree mst max-hops

Syntax Description

hop-count

Specifies the number of hops in an MST region before the BDPU is discarded. Valid range is from 1 to 40.

Command Default

The default number of hops is 20.

Command Modes

Switch configuration (config-switch)

Command History

Release Modification
3.8.1

This command was introduced.

Examples

The following example configures the maximum number of hops that a packet travels in an MST region before it is discarded to 10.


nfvis(config-switch)# spanning-tree mst max-hops 10
nfvis(config-switch)# commit 
 

spanning-tree mst port-priority

Use the spanning-tree mst port-priority command to configure the priority of a port. Use the no form of this command to restore the default configuration.

spanning-tree mst instance-id port-priority priority

no spanning-tree mst instance-id port-priority

Syntax Description

instance-id

Specifies the spanning tree instance ID. Valid range is from 1 to 15.

priority

Specifies the port priority. Valid range is from 0 to 240 in multiples of 16.

Command Default

The default port priority is 128.

Command Modes

Switch configuration (config-switch)

Command History

Release Modification
3.8.1

This command was introduced.

Usage Guidelines

The priority value must be a multiple of 16.

Examples

The following example configures the port priority:


nfvis(config-switch)# interface gigabitEthernet 1/1
nfvis(config-switch-if)# spanning-tree mst 1 port-priority 96
nfvis(config-switch-if)# spanning-tree mst 1 cost 2 
nfvis(config-switch-if)# commit 
 

spanning-tree pathcost method

To set the default path cost method, use the spanning-tree pathcost method in switch configuration mode. To return to the default configuration, use the no form of this command.

spanning-tree pathcost method { long | short}

no spanning-tree pathcost method

Syntax Description

long

Use 32-bit based values for default port path costs.

short

Use 16-bit based values for default port path costs.

Command Default

Long path cost method.

Command Modes

Switch configuration (config-switch)

Command History

Release Modification
3.5.1

This command was introduced.

Usage Guidelines

This command applies to all the spanning tree instances on the switch.

  • If the short method is selected, the switch calculates the default cost as 100.

  • If the long method is selected, the switch calculates the default cost as 20000.

Examples

The following example sets the default path cost method to Long.


nfvis(config-switch)# spanning-tree pathcost method long
nfvis(config-switch)# commit
nfvis(config-switch)# end

spanning-tree priority

To configure the device STP priority, which is used to determine which bridge is selected as the root bridge, use the spanning-tree priority command in switch configuration mode. To restore the default device spanning-tree priority, use the no form of this command

spanning-tree priority priority

no spanning-tree priority

Syntax Description

priority

Specifies the bridge priority. Valid range is from 0 to 61440.

Command Default

The default priority is 32768.

Command Modes

Switch configuration (config-switch)

Command History

Release Modification
3.5.1

This command was introduced.

Usage Guidelines

The priority value must be a multiple of 4096.

The switch with the lowest priority is the root of the spanning tree. When more than one switch has the lowest priority, the switch with the lowest MAC address is selected as the root.

Examples

The following example configures the spanning-tree priority to 12288:


nfvis(config-switch)# spanning-tree priority 12288
nfvis(config-switch)# commit
nfvis(config-switch)# end

spanning-tree enable

To enable the spanning-tree functionality, use the spanning-tree enable command in switch configuration mode. To disable the spanning-tree functionality, use the no form of this command.

spanning-tree enable

no spanning-tree enable

Syntax Description

This command has no arguments.

Command Default

Spanning-tree is enabled.

Command Modes

Switch configuration (config-switch)

Command History

Release Modification
3.5.1

This command was introduced.

Examples

The following example enables the spanning-tree functionality:


nfvis(config-switch)# spanning-tree enable
nfvis(config-switch)# commit 
nfvis(config-switch)# end  

spanning-tree bpdu (Interface)

To define Bridge Protocol Data Unit (BPDU) handling when the spanning tree is disabled on a single interface, use the spanning-tree bpdu command in interface switch configuration mode. To restore the default configuration, use the no form of this command.

spanning-tree bpdu { filtering | flooding}

no spanning-tree bpdu

Syntax Description

filtering

Specifies that BPDU packets are filtered when the spanning tree is disabled on an interface.

flooding

Specifies that untagged BPDU packets are flooded unconditionally (without applying VLAN rules) to all ports with the spanning tree disabled and the BPDU handling mode of flooding. Tagged BPDU packets are filtered.

Command Default

The spanning-tree bpdu (Global) command determines the default configuration.

Command Modes

Interface (Gigabit Ethernet, Port Channel) switch configuration (config-switch-if)

Command History

Release Modification
3.5.1

This command was introduced.

Usage Guidelines

The filtering and flooding modes are relevant when the spanning tree is disabled globally or on a single interface.

Examples

The following example defines the BPDU packet as flooding when the spanning tree is disabled on Gigabit Ethernet interface 1/1:


nfvis(config-switch)# interface gigabitEthernet 1/1
nfvis(config-switch-if)# spanning-tree bpdu flooding
nfvis(config-switch-if)# commit
nfvis(config-switch-if)# end 

spanning-tree bpduguard

To shut down an interface when it receives a Bridge Protocol Data Unit (BPDU), use the spanning-tree bpduguard command in interface switch configuration mode. To restore the default configuration, use the no form of this command.

spanning-tree bpduguard { enable | disable}

no spanning-tree bpduguard

Syntax Description

enable

Enables BPDU Guard.

disable

Disables BPDU Guard.

Command Default

BPDU Guard is disabled.

Command Modes

Interface (Gigabit Ethernet, Port Channel) switch configuration (config-switch-if)

Command History

Release Modification
3.5.1

This command was introduced.

Usage Guidelines

BPDU guard can be enabled when the spanning tree is enabled (useful when the port is in the PortFast mode) or disabled.

Examples

The following example shuts down the Gigabit Ethernet interface 1/1 when it receives a BPDU.


nfvis(config-switch)# interface gigabitEthernet 1/1
nfvis(config-switch-if)# spanning-tree bpduguard enable 
nfvis(config-switch-if)# commit
nfvis(config-switch-if)# end

spanning-tree cost

To configure the spanning-tree path cost for a port, use the spanning-tree cost command in interface switch configuration mode. To restore the default configuration, use the no form of this command.

spanning-tree cost cost

no spanning-tree cost

Syntax Description

cost

Specifies the port path cost. Valid range is from 1 to 200000000.

Command Default

Default path cost is determined by port speed and path cost method (long or short).

Table 1.

Interface

Long

Short

Port-channel

20,000

4

Gigabit Ethernet (1000 Mbps)

20,000

4

Ethernet (10 Mbps)

2,000,000

100

Command Modes

Interface (Gigabit Ethernet, Port Channel) switch configuration (config-switch-if)

Command History

Release Modification
3.5.1

This command was introduced.

Examples

The following example configures the spanning-tree cost on Gigabit Ethernet interface 1/1 to 35000.


nfvis(config-switch)# interface gigabitEthernet 1/1
nfvis(config-switch-if)# spanning-tree cost 35000
nfvis(config-switch-if)# commit
nfvis(config-switch-if)# end

spanning-tree guard root

To enable root guard on all spanning-tree instances on an interface, use the spanning-tree guard root command in interface switch configuration mode. Root guard prevents the interface from becoming the root port of the device. Use the no form of this command to disable the root guard on the interface.

spanning-tree guard root

no spanning-tree guard root

Syntax Description

This command has no arguments.

Command Default

Root guard is disabled.

Command Modes

Interface (Gigabit Ethernet, Port Channel) switch configuration (config-switch-if)

Command History

Release Modification
3.5.1

This command was introduced.

Usage Guidelines

Root guard can be enabled when the device operates in any mode (STP, RSTP, and MSTP).

When root guard is enabled, the port changes to the alternate state if the spanning-tree calculations select the port as the root port.

Examples

The following example prevents Gigabit Ethernet interface 1/1 from being the root port of the device.


nfvis(config-switch)# interface gigabitEthernet 1/1
nfvis(config-switch-if)# spanning-tree guard root
nfvis(config-switch-if)# commit
nfvis(config-switch-if)# end 

spanning-tree link-type

To override the default link-type setting determined by the port duplex mode, and enable RSTP transitions to the Forwarding state, use the spanning-tree link-type command in interface switch configuration mode. To restore the default configuration, use the no form of this command.

spanning-tree link-type { point-to-point | shared}

no spanning-tree link-type

Syntax Description

point-to-point

Specifies that the port link type is point-to-point.

shared

Specifies that the port link type is shared.

Command Default

The device derives the port link type from the duplex mode. A full-duplex port is considered a point-to-point link and a half-duplex port is considered a shared link.

Command Modes

Interface (Gigabit Ethernet, Port Channel) switch configuration (config-switch-if)

Command History

Release Modification
3.5.1

This command was introduced.

Examples

The following example enables shared spanning-tree on Gigabit Ethernet interface 1/1.


nfvis(config-switch)# interface gigabitEthernet 1/1
nfvis(config-switch-if)# spanning-tree link-type shared
nfvis(config-switch-if)# commit
nfvis(config-switch-if)# end  

spanning-tree port-priority

To configure the port priority, use the spanning-tree port-priority command in interface switch configuration mode. To restore the default configuration, use the no form of this command.

spanning-tree port-priority priority

no spanning-tree port-priority

Syntax Description

priority

Specifies the port priority. Valid range is from 0 to 240.

Command Default

The default port priority is 128.

Command Modes

Interface (Gigabit Ethernet, Port Channel) switch configuration (config-switch-if)

Command History

Release Modification
3.5.1

This command was introduced.

Usage Guidelines

The priority value must be a multiple of 16.

Examples

The following example configures the spanning priority on Gigabit Ethernet interface 1/1 to 96.


nfvis(config-switch)# interface gigabitEthernet 1/1
nfvis(config-switch-if)# spanning-tree port-priority 96
nfvis(config-switch-if)# commit
nfvis(config-switch-if)# end

spanning-tree portfast

To enable the PortFast mode, use the spanning-tree portfast command in interface switch configuration mode. In PortFast mode, the interface is immediately put into the forwarding state upon linkup, without waiting for the standard forward time delay. To disable the PortFast mode, use the no form of this command.

spanning-tree portfast { auto | enable}

no spanning-tree portfast

Syntax Description

auto

Specifies that the software waits for 3 seconds (with no BPDUs received on the interface) before putting the interface into the PortFast mode.

enable

Enables an interface to move directly to forwarding on linkup.

Command Default

PortFast mode is disabled.

Command Modes

Interface (Gigabit Ethernet, Port Channel) switch configuration (config-switch-if)

Command History

Release Modification
3.5.1

This command was introduced.

Examples

The following example enables the PortFast mode on Gigabit Ethernet interface 1/1:


nfvis(config-switch)# interface gigabitEthernet 1/1
nfvis(config-switch-if)# spanning-tree portfast enable
nfvis(config-switch-if)# commit
nfvis(config-switch-if)# end

show spanning-tree

To display the spanning-tree configuration, use the show switch spanning-tree command in privileged EXEC mode.

show switch spanning-tree mstp configuration { global | instance-list }

show switch spanning-tree mstp summary { instance-global-info | instance-interface-info 2 }

Syntax Description

mstp configuration

Displays the MST configuration identifier.

summary

Displays the spanning-tree summary.

Command Default

None

Command Modes

Privileged EXEC (#)

Command History

Release Modification
3.8.1

This command was introduced.

Usage Guidelines

This command only works when MST is enabled.

Examples

The following is a sample output of the show switch spanning-tree mstp configuration global command:


nfvis# show switch spanning-tree mstp configuration global 
spanning-tree mstp configuration global name transit-net
spanning-tree mstp configuration global revision 2
spanning-tree mstp configuration global max-hops 20

The following is a sample output of the show switch spanning-tree mstp configuration instance-list command:


nfvis# show switch spanning-tree mstp configuration instance-list 
INSTANCE  VLANS MAPPED      STATE    
-------------------------------------
0         1,2350-2353,2363  enabled  
1         15                enabled

show switch spanning-tree

To display the spanning-tree configuration, use the show switch spanning-tree command in privileged EXEC mode.

switch show spanning-tree [ bridge | interface { gigabitEthernet | port-channel} interface-id | root | summary]

Syntax Description

bridge

Displays the bridge information.

interface

Specifies the interface type.

gigabitEthernet

Specifies Gigabit Ethernet as the interface type.

port-channel

Specifies port channel as the interface type.

interface-id

Specifies the interface ID.

root

Displays the bridge information.

summary

Displays the spanning-tree summary.

Command Default

None

Command Modes

Privileged EXEC (#)

Command History

Release Modification
3.5.1

This command was introduced.

Usage Guidelines

None

Examples

The following is a sample output of the show switch spanning-tree command


nfvis# show switch spanning-tree
spanning-tree summary admin-status enabled
spanning-tree summary Operation-mode RSTP
spanning-tree summary Port-Cost-Method long
spanning-tree summary Loopback-guard disabled
spanning-tree root Priority 32768
spanning-tree root Address 00:a6:ca:d6:38:50
spanning-tree root Cost 0
spanning-tree root Port 0
spanning-tree root Hello-Time 2
spanning-tree root Max-Age 20
spanning-tree root Forward-Delay 15
spanning-tree bridge Priority 32768
spanning-tree bridge Address 00:a6:ca:d6:38:50
spanning-tree bridge Hello-Time 2
spanning-tree bridge Max-Age 20
spanning-tree bridge Forward-Delay 15
       ADMIN    PRIO.           PORT               PORT        GUARD
PORT   STATE    NBR    COST     STATE     ROLE     FAST  TYPE  ROOT
-------------------------------------------------------------------------
gi1/0  enabled  128.1  2000000  disabled  Disable  No    --    disabled
gi1/1  enabled  128.2  2000000  disabled  Disable  No    --    disabled
gi1/2  enabled  128.3  2000000  disabled  Disable  No    --    disabled
gi1/3  enabled  128.4  2000000  disabled  Disable  No    --    disabled
gi1/4  enabled  128.5  2000000  disabled  Disable  No    --    disabled
gi1/5  enabled  128.6  2000000  disabled  Disable  No    --    disabled
gi1/6  enabled  128.7  2000000  disabled  Disable  No    --    disabled
gi1/7  enabled  128.8  2000000  disabled  Disable  No    --    disabled

      ADMIN    PRIO.            PORT               PORT        GUARD
PORT  STATE    NBR       COST   STATE     ROLE     FAST  TYPE  ROOT
-------------------------------------------------------------------------
1     enabled  128.1000  20000  disabled  Disable  No    --    disabled
2     enabled  128.1001  20000  disabled  Disable  No    --    disabled
3     enabled  128.1002  20000  disabled  Disable  No    --    disabled
4     enabled  128.1003  20000  disabled  Disable  No    --    disabled