Use this command to enable the Spanning Tree Protocol globally for the switch.
Use the no form to disable it.
Syntax
spanning-tree no spanning-tree
Default Setting
Spanning Tree is enabled.
Command Mode
Global Configuration
Command Usage
The Spanning Tree Protocol can be used to detect and disable network loops,
and to provide backup links between switches, bridges or routers. This allows
the switch to interact with other bridging devices (that is, an STP-compliant
switch, bridge or router) in your network to ensure that only one route exists
between any two stations on the network, and provide backup links which automatically
take over when a primary link goes down.
Example
The following example shows how to enable the Spanning Tree Protocol for
the switch:
Use this command to select the Spanning Tree mode for the switch. Use the no
form to restore the default.
Syntax
spanning-tree mode {stp | rstp} no spanning-tree mode
stp - Spanning Tree Protocol (IEEE 802.1D)
rstp - Rapid Spanning Tree (IEEE 802.1w)
Default Setting
rstp
Command Mode
Global Configuration
Command Usage
Spanning Tree Protocol
STP creates one Spanning Tree instance for the entire network. If multiple
VLANs are implemented on a network, the path between specific VLAN members
may be inadvertently disabled to prevent network loops, thus isolating group
members.
Rapid Spanning Tree Protocol
RSTP supports connections to either STP or RSTP nodes by monitoring the incoming
protocol messages and dynamically adjusting the type of protocol messages
the RSTP node transmits, as described below:
STP Mode - If the switch receives an 802.1D BPDU after a ports
migration delay timer expires, the switch assumes it is connected to an
802.1D bridge and starts using only 802.1D BPDUs.
RSTP Mode - If RSTP is using 802.1D BPDUs on a port and receives an
RSTP BPDU after the migration delay expires, RSTP restarts the migration
delay timer and begins using RSTP BPDUs on that port.
Example
The following example configures the switch to use Rapid Spanning Tree.
Use this command to configure the Spanning Tree bridge forward time globally
for the switch. Use the no form to restore the default.
Syntax
spanning-treeforward-timeseconds no spanning-treeforward-time
seconds - Time in seconds. (Range: 4 - 30 seconds)
The minimum value is the higher of 4 or [(max-age / 2) + 1].
Default Setting
15 seconds
Command Mode
Global Configuration
Command Usage
This command sets the maximum time (in seconds) the root device will wait
before changing states (i.e., listening to learning to forwarding). This delay
is required because every device must receive information about topology changes
before it starts to forward frames. In addition, each port needs time to listen
for conflicting information that would make it return to a discarding state;
otherwise, temporary data loops might result.
Use this command to configure the Spanning Ttree bridge maximum age globally
for the switch. Use the no form to restore the default.
Syntax
spanning-tree max-ageseconds no spanning-treemax-age
seconds - Time in seconds. (Range: 6-40 seconds)
The minimum value is the higher of 6 or [2 x (hello-time + 1)].
The maximum value is the lower of 40 or [2 x (forward-time - 1)].
Default Setting
20 seconds
Command Mode
Global Configuration
Command Usage
This command sets the maximum time (in seconds) a device can wait without
receiving a configuration message before attempting to reconfigure. All device
ports (except for designated ports) should receive configuration messages
at regular intervals. Any port that ages out STP information (provided in
the last configuration message) becomes the designated port for the attached
LAN. If it is a root port, a new root port is selected from among the device
ports attached to the network.
Use this command to configure the spanning tree priority globally for this
switch. Use the no form to restore the default.
Syntax
spanning-treeprioritypriority no spanning-treepriority
priority - Priority of the bridge.
(Range 0-61440, in steps of 4096; Options: 0, 4096, 8192, 12288,
16384, 20480, 24576, 28672, 32768, 36864, 40960, 45056, 49152, 53248, 57344,
61440)
Default Setting
32768
Command Mode
Global Configuration
Command Usage
Bridge priority is used in selecting the root device, root port, and designated
port. The device with the highest priority becomes the STP root device. However,
if all devices have the same priority, the device with the lowest MAC address
will then become the root device.
Use this command to configure the path cost method used for the Rapid Spanning
Tree. Use the no form to restore the default.
Syntax
spanning-tree pathcost method {long | short} no spanning-tree pathcost method
long - Specifies 32-bit based values that range from 1-200,000,000.
short - Specifies 16-bit based values that range from 1-65535.
Default Setting
short method
Command Mode
Global Configuration
Command Usage
The path cost method is used to determine the best path between devices.
Therefore, lower values should be assigned to ports attached to faster media,
and higher values assigned to ports with slower media. Note that path cost
takes precedence over port priority.
Example
Console(config)#spanning-tree
pathcost method long Console(config)#
Use this command to configure the spanning tree path cost for the specified
interface. Use the no form to restore the default.
Syntax
spanning-tree costcost no spanning-tree cost
cost - The path cost for the interface.
(Range - 1-200,000,000)
The recommended range is -
Ethernet: 200,000-20,000,000
Fast Ethernet: 20,000-2,000,000
Gigabit Ethernet: 2,000-200,000
Default Setting
Ethernet - half duplex: 2,000,000; full duplex: 1,000,000; trunk: 500,000
Fast Ethernet - half duplex: 200,000; full duplex: 100,000; trunk: 50,000
Gigabit Ethernet - full duplex: 10,000; trunk: 5,000
Command Mode
Interface Configuration (Ethernet, Port Channel)
Command Usage
This command is used by the Spanning-Tree Protocol to determine the best
path between devices. Therefore, lower values should be assigned to interfaces
attached to faster media, and higher values assigned to interfaces with slower
media.
Path cost takes precedence over interface priority.
When the Spanning-Tree pathcost method is set to short, the maximum
value for path cost is 65,535.
Use this command to configure the priority for the specified interface. Use
the no form to restore the default.
Syntax
spanning-tree port-prioritypriority no spanning-tree port-priority
priority - The priority for an interface. (Range: 0-240, in steps
of 16)
Default Setting
128
Command Mode
Interface Configuration (Ethernet, Port Channel)
Command Usage
This command defines the priority for the use of an interface in the Spanning-Tree.
If the path cost for all interfaces on a switch are the same, the interface
with the highest priority (that is, lowest value) will be configured as an
active link in the Spanning Tree.
Where more than one interface is assigned the highest priority, the interface
with lowest numeric identifier will be enabled.
Use this command to set an interface to fast forwarding. Use the no form to
disable fast forwarding.
Syntax
spanning-treeportfast no spanning-treeportfast
Default Setting
Disabled
Command Mode
Interface Configuration (Ethernet, Port Channel)
Command Usage
This command is used to enable/disable the fast Spanning-Tree mode for
the selected interface. In this mode, interfaces skip the Learning state and
proceed straight to Forwarding.
Since end-nodes cannot cause forwarding loops, they can be passed through
the Spanning Tree state changes more quickly than allowed by standard convergence
time. Fast forwarding can achieve quicker convergence for end-node workstations
and servers, and also overcome other STP related timeout problems. (Remember
that fast forwarding should only be enabled for interfaces connected to an
end-node device.)
This command has the same effect as the spanning-tree edge-port command.
Use this command to specify an interface as an edge port. Use the no
form to restore the default.
Syntax
spanning-treeedge-port no spanning-treeedge-port
Default Setting
Disabled
Command Mode
Interface Configuration (Ethernet, Port Channel)
Command Usage
You can enable this option if an interface is attached to a LAN segment
that is at the end of bridged LAN or to an end node. Since end nodes cannot
cause forwarding loops, they can pass directly through to the Spanning Tree
forwarding state. Specifying Edge Ports provides quicker convergence for devices
such as workstations or servers, retains the current forwarding database to
reduce the amount of frame flooding required to rebuild address tables during
reconfiguration events, does not cause the Spanning Tree to initiate reconfiguration
when the interface changes state, and also overcomes other STP-related timeout
problems. However, remember that Edge Port should only be enabled for ports
connected to an end-node device.
This command has the same effect as the spanning-tree portfast command.
Use this command to configure the link type for the Rapid Spanning Tree. Use
the no form to restore the default.
Syntax
spanning-tree link-type {auto | point-to-point | shared} no spanning-tree link-type
auto - Automatically derived from the duplex mode setting.
point-to-point - Point-to-point link.
shared - Shared medium.
Default Setting
auto
Command Mode
Interface Configuration (Ethernet, Port Channel)
Command Usage
Specify a point-to-point link if the interface can only be connected to
exactly one other bridge, or a shared link if it can be connected to two or
more bridges.
When automatic detection is selected, the switch derives the link type from
the duplex mode. A full-duplex interface is considered a point-to-point link,
while a half-duplex interface is assumed to be on a shared link.
RSTP only works on point-to-point links between two bridges. If you designate
a port as a shared link, RSTP is forbidden.
Use this command to re-check the appropriate BPDU format to send on the selected
interface.
Syntax
spanning-tree protocol-migrationinterface
interface
ethernetunit/port-number
unit - This is device 1.
port-number
port-channelchannel-id (Range: 1-6)
Command Mode
Privileged Exec
Command Usage
If at any time the switch detects STP BPDUs, including Configuration or
Topology Change Notification BPDUs, it will automatically set the selected
interface to forced STP-compatible mode. However, you can also use the spanning-tree
protocol-migration command at any time to manually re-check the appropriate
BPDU format to send on the selected interfaces (i.e., RSTP or STP-compatible).
Use this command to show the Spanning Tree configuration.
Syntax
show spanning-tree [interface]
interface
ethernetunit/port-number
unit - This is device 1.
port-number - Port number.
port-channelchannel-id (Range: 1-6)
Default Setting
None
Command Mode
Privileged Exec
Command Usage
Use the show spanning-tree command with no parameters to display
the configuration for the Spanning Tree and for every interface in the tree.
Use the show spanning-treeinterface command to display the
Spanning Tree configuration for an interface within the Spanning Tree.
Example
Console#show spanning-tree
Spanning-tree information
---------------------------------------------------------------
Spanning tree mode :RSTP
Spanning tree enable/disable :enable
Priority :32768
Bridge Hello Time (sec.) :2
Bridge Max Age (sec.) :20
Bridge Forward Delay (sec.) :15
Root Hello Time (sec.) :2
Root Max Age (sec.) :20
Root Forward Delay (sec.) :15
Designated Root :32768.000011112222
Current root port :0
Current root cost :0
Number of topology changes :1
Last topology changes time (sec.):25067
Transmission limit :3
Path Cost Method :long
---------------------------------------------------------------
Eth 1/ 1 information
---------------------------------------------------------------
Admin status :
enable
Role :
disable
State :
discarding
Path cost :
10000
Priority :
128
Designated cost : 0
Designated port : 128.1
Designated root : 32768.000011112222
Designated bridge : 32768.000011112222
Fast forwarding : disable
Forward transitions : 0
Admin edge port : disable
Oper edge port : disable
Admin Link type : auto
Oper Link type : point-to-point
.
.
.
Console#