Configuring STP: Understanding Basic STP Features
Configuring STP: Understanding Basic STP Features
Configuring STP: Understanding Basic STP Features
Configuring STP
This chapter describes how to configure the Spanning Tree Protocol (STP) on your switch.
Note For complete syntax and usage information for the commands used in this chapter, refer to the
Catalyst 2950 Desktop Switch Command Reference for this release.
For information about advanced STP features, see the “Understanding Advanced STP Features” section
on page 9-9 and the “Configuring Advanced STP Features” section on page 9-30.
Caution Switches that are not running STP still forward Bridge Protocol Data Units (BPDUs) that they receive
so that the other switches on the VLAN that have a running spanning-tree instance can break loops.
Therefore, STP must be running on enough switches to break all the loops in the network; for example,
at least one switch on each loop in the VLAN must be running STP. It is not absolutely necessary to run
STP on all switches in the VLAN; however, if you are running STP only on a minimal set of switches,
an incautious change to the network that introduces another loop into the VLAN can result in a broadcast
storm.
Note If you have already used all available spanning-tree instances on your switch, adding another VLAN
anywhere in the VTP domain creates a VLAN that is not running STP on that switch. If you have the
default allowed list on the trunk ports of that switch, the new VLAN is carried on all trunk ports.
Depending on the topology of the network, this could create a loop in the new VLAN that will not be
broken, particularly if there are several adjacent switches that have all run out of spanning-tree instances.
You can prevent this possibility by setting allowed lists on the trunk ports of switches that have used up
their allocation of spanning-tree instances. Setting up allowed lists is not necessary in many cases and
can make it more labor-intensive to add another VLAN to the network.
Spanning-tree commands determine the configuration of VLAN spanning-tree instances. You create a
spanning-tree instance when you assign an interface to a VLAN. The spanning-tree instance is removed
when the last interface is moved to another VLAN. You can configure switch and port parameters before
an spanning-tree instance is created; these parameters are applied when the spanning-tree instance is
created.
STP Overview
STP is a link management protocol that provides path redundancy while preventing undesirable loops in
the network. For an Ethernet network to function properly, only one active path can exist between any
two stations. STP operation is transparent to end stations, which cannot detect whether they are
connected to a single LAN segment or a switched LAN of multiple segments.
When you create fault-tolerant internetworks, you must have a loop-free path between all nodes in a
network. The spanning-tree algorithm calculates the best loop-free path throughout a switched network.
Switches send and receive STP frames at regular intervals. The switches do not forward these frames,
but use the frames to construct a loop-free path.
Multiple active paths between end stations cause loops in the network. If a loop exists in the network,
end stations might receive duplicate messages. Switches might also learn end-station MAC addresses on
multiple interfaces. These conditions result in an unstable network.
STP defines a tree with a root switch and a loop-free path from the root to all switches in the network.
STP forces redundant data paths into a standby (blocked) state. If a network segment in the spanning tree
fails and a redundant path exists, the spanning-tree algorithm recalculates the spanning-tree topology
and activates the standby path.
When two interfaces on a switch are part of a loop, the STP port priority and path cost settings determine
which interface is put in the forwarding state and which is put in the blocking state. The STP port priority
value represents the location of an interface in the network topology and how well it is located to pass
traffic. The STP path cost value represents media speed.
• Message age
• The identifier of the transmitting interface
• Values for the hello, forward delay, and max-age protocol timers
When a switch transmits a BPDU frame, all switches connected to the LAN on which the frame is
transmitted receive the BPDU. When a switch receives a BPDU, it does not forward the frame but instead
uses the information in the frame to calculate a BPDU, and, if the topology changes, initiates a BPDU
transmission.
A BPDU exchange results in these actions:
• One switch is elected as the root switch.
• The shortest distance to the root switch is calculated for each switch based on the path cost.
• A designated switch for each LAN segment is selected. The designated switch is the one closest to
the root switch through which frames are forwarded to the root.
• A root port is selected. This port provides the best path from the switch to the root switch.
• Interfaces included in the spanning-tree instance are selected.
• All interfaces not included in the spanning tree are blocked.
STP Timers
Table 9-1 describes the STP timers that affect the entire spanning-tree performance.
Variable Description
Hello timer Determines how often the switch broadcasts hello messages to other switches.
Forward-delay timer Determines how long each of the listening and learning states last before the interface begins
forwarding.
Maximum-age timer Determines the amount of time the switch stores protocol information received on an interface.
DP
DP DP
A D
DP RP DP DP
RP RP DP
43568
B C
RP = Root Port
DP = Designated Port
When the spanning-tree topology is calculated based on default parameters, the path between source and
destination end stations in a switched network might not be ideal. For instance, connecting higher-speed
links to an interface that has a higher number than the current root port can cause a root-port change.
The goal is to make the fastest link the root port.
For example, assume that one port on Switch B is a Gigabit Ethernet link and that another port on
Switch B (a 10/100 link) is the root port. Network traffic might be more efficient over the Gigabit
Ethernet link. By changing the STP port priority on the Gigabit Ethernet interface to a higher priority
(lower numerical value) than the root port, the Gigabit Ethernet interface becomes the new root port.
Power-on
initialization
Blocking
state
Listening Disabled
state state
Learning
state
Forwarding
43569
state
When you power up the switch, STP is enabled by default, and every interface in the switch, VLAN, or
network goes through the blocking state and the transitory states of listening and learning. Spanning tree
stabilizes each interface at the forwarding or blocking state.
When the spanning-tree algorithm places an interface in the forwarding state, this process occurs:
1. The interface is put in the listening state while spanning tree waits for protocol information to
transition the interface to the blocking state.
2. While spanning tree waits for the forward-delay timer to expire, it moves the interface to the
learning state and resets the forward-delay timer.
3. In the learning state, the interface continues to block frame forwarding as the switch learns
end-station location information for the forwarding database.
4. When the forward-delay timer expires spanning tree moves the interface to the forwarding state,
where both learning and frame forwarding are enabled.
Blocking State
An interface in the blocking state does not participate in frame forwarding. After initialization, a BPDU
is sent to each interface in the switch. A switch initially functions as the root until it exchanges BPDUs
with other switches. This exchange establishes which switch in the network is the root or root switch. If
there is only one switch in the network, no exchange occurs, the forward-delay timer expires, and the
interfaces move to the listening state. An interface always enters the blocking state following switch
initialization.
An interface in the blocking state performs as follows:
• Discards frames received on the port
• Discards frames switched from another interface for forwarding
• Does not learn addresses
• Receives BPDUs
Listening State
The listening state is the first state an interface enters after the blocking state. The interface enters this
state when STP determines that the interface should participate in frame forwarding.
An interface in the listening state performs as follows:
• Discards frames received on the port
• Discards frames switched from another interface for forwarding
• Does not learn addresses
• Receives BPDUs
Learning State
An interface in the learning state prepares to participate in frame forwarding. The interface enters the
learning state from the listening state.
An interface in the learning state performs as follows:
• Discards frames received on the port
• Discards frames switched from another interface for forwarding
• Learns addresses
• Receives BPDUs
Forwarding State
An interface in the forwarding state forwards frames. The interface enters the forwarding state from the
learning state.
An interface in the forwarding state performs as follows:
• Receives and forwards frames received on the port
• Forwards frames switched from another port
• Learns addresses
• Receives BPDUs
Disabled State
An interface in the disabled state does not participate in frame forwarding or STP. An interface in the
disabled state is nonoperational.
A disabled interface performs as follows:
• Discards frames received on the port
• Discards frames switched from another interface for forwarding
• Does not learn addresses
• Does not receive BPDUs
Switch A
Catalyst 2950
switch
Switch C
Catalyst 2950
Catalyst 2950 switch
switch
Switch B
Active link
Blocked link
65024
Workstations
You can also create redundant links between switches by using EtherChannel groups. For more
information, see the Chapter 10, “Configuring the Switch Ports.”
Note Because the purpose of Port Fast is to minimize the time access ports must wait for STP to converge, it
is effective only when used on access ports. If you enable Port Fast on a port connecting to another
switch, you risk creating a spanning-tree loop.
Catalyst 3550
series switch
Catalyst 2950-T
switch
Catalyst 2950 Server
switch
Port
Port Fast-enabled port
Fast-enabled
ports
60997
Workstations Workstations
Note When enabled on the switch, STP applies the BPDU guard feature to all Port Fast-enabled interfaces.
Understanding UplinkFast
Switches in hierarchical networks can be grouped into backbone switches, distribution switches, and
access switches. Figure 9-5 shows a complex network where distribution switches and access switches
each have at least one redundant link that STP blocks to prevent loops.
Backbone switches
Root bridge
3550 3550
Distribution switches
60998
Active link Access switches
Blocked link
If a switch looses connectivity, it begins using the alternate paths as soon as STP selects a new root port.
When STP reconfigures the new root port, other interfaces flood the network with multicast packets, one
for each address that was learned on the interface.
By using STP UplinkFast, you can accelerate the choice of a new root port when a link or switch fails
or when STP reconfigures itself. The root port transitions to the forwarding state immediately without
going through the listening and learning states, as it would with normal STP procedures. UplinkFast also
limits the burst of multicast traffic by reducing the max-update-rate parameter (the default for this
parameter is 150 packets per second). However, if you enter zero, station-learning frames are not
generated, so the STP topology converges more slowly after a loss of connectivity.
Note UplinkFast is most useful in wiring-closet switches at the access or edge of the network. It is not
appropriate for backbone devices. This feature might not be useful for other types of applications.
UplinkFast provides fast convergence after a direct link failure and achieves load balancing between
redundant links using uplink groups. An uplink group is a set of interfaces (per VLAN), only one of
which is forwarding at any given time. Specifically, an uplink group consists of the root port (which is
forwarding) and a set of blocked ports, except for self-looping ports. The uplink group provides an
alternate path in case the currently forwarding link fails.
Figure 9-6 shows an example topology with no link failures. Switch A, the root switch, is connected
directly to Switch B over link L1 and to Switch C over link L2. The interface on Switch C that is
connected directly to Switch B is in a blocking state.
Switch A
(Root) Switch B
L1
L2 L3
Blocked port
43575
Switch C
If Switch C detects a link failure on the currently active link L2 on the root port (a direct link failure),
UplinkFast unblocks the blocked port on Switch C and transitions it to the forwarding state without
going through the listening and learning states, as shown in Figure 9-7. This change takes
approximately 1 to 5 seconds.
Switch A
(Root) Switch B
L1
L2 L3
Link failure
UplinkFast transitions port
directly to forwarding state.
43576
Switch C
Backbone
Spanning-
tree root
Forward
Forward
Forward
Multidrop backbone
(GigaStack GBIC connections)
CSUF implements the Stack Membership Discovery Protocol and the Fast Uplink Transition Protocol.
Using the Stack Membership Discovery Protocol, all stack switches build a neighbor list of stack
members through the receipt of discovery hello packets. When certain link loss or STP events occur
(described in “Events that Cause Fast Convergence” section on page 9-14), the Fast Uplink Transition
Protocol uses the neighbor list to send fast-transition requests on the stack port to stack members.
The switch sending the fast-transition request needs to do a fast transition to the forwarding state of a
port that it has chosen as the root port, and it must obtain an acknowledgement from each stack switch
before performing the fast transition.
Each switch in the stack determines if the sending switch is a better choice than itself to be the stack root
of this spanning-tree instance by comparing STP root, cost, and bridge ID. If the sending switch is the
best choice as the stack root, each switch in the stack returns an acknowledgement; otherwise, it does
not respond to the sending switch (drops the packet). The sending switch then has not received
acknowledgements from all stack switches.
When acknowledgements are received from all stack switches, the Fast Uplink Transition Protocol on
the sending switch immediately transitions its alternate stack-root port to the forwarding state. If
acknowledgements from all stack switches are not obtained by the sending switch, the normal STP
transitions (blocking, listening, learning, and forwarding) take place, and the spanning-tree topology
converges at its normal rate (2 * forward-delay time + max-age time).
The Fast Uplink Transition Protocol is implemented on a per-VLAN basis and affects only one STP
instance at a time.
Note The fast transition might not occur if multiple events occur simultaneously. For example, if a stack
member switch is powered off, and at the same time, the link connecting the stack root to the STP root
comes back up, the normal STP convergence occurs.
Limitations
These limitations apply to CSUF:
• CSUF uses the GigaStack GBIC and runs on Catalyst 3550 switches, all Catalyst 3500 XL switches,
Catalyst 2950 switches with GBIC module slots, and on modular Catalyst 2900 XL switches.
• Up to nine stack switches can be connected through their stack ports to the multidrop backbone.
Only one stack port per switch is supported.
• Each stack switch can be connected to the STP backbone through one uplink.
• If the stack consists of a mixture of Catalyst 2900 XL, Catalyst 3500 XL, Catalyst 2950 and Catalyst
3550 switches, up to 64 VLANs with STP enabled are supported. If the stack consists of
Catalyst 3550 switches, up to 128 VLANs with STP enabled are supported.
STATUS
UTIL
MODE DUPLX
1 1 1 1 1 1 1 1 1 1 SYSTEM
SPEED
RPS
STATUS
1 2 MODE
UTIL
DUPLX
1 1 1 1 1 1 1 1 1 1
SPEED
1 2
Catalyst 3508G XL
Catalyst 3500 XL Catalyst 2950G-24
1 2 3 4 5 6 7 8
SYST RPS
MODE
2X 12X 14X 16X
1 2
1 1
2
SYSTEM
SYST RPS RPS
STATUS
1 2
UTIL
STAT UTIL DUPLXSPEED
DUPLX
2X 2X
12X 2X
12X 1
MODE
2X 12X 14X 16X
1 2 MODE
SPEED
Catalyst 2950G-12
1 2 3 4 5 6 7 8 9 10 11 12
Catalyst 2950
1X 11X
1 2
SYST RPS
MODE
2X 12X
1 2
Catalyst 2950G-12
1 2 3 4 5 6 7 8 9 10 11 12 Catalyst 2950
1X 11X
1 2
SYST RPS
MODE
2X 12X
1 2
Catalyst 2950G-24
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 Catalyst 2950
1X 11X 13X 15X
1 2
SYST RPS
MODE
2X 12X 14X 16X
1 2 1 2
Catalyst 2950G-48
Catalyst 2950
65276
1 2 3 4 5 6 7 8 9 10 9 10 9 10 9 10 1 2 3 4 5 6 7 8 9 10 9 10 9 10 9 10 1 2 3 4 5 6 7 8 9 10 9 10 9 10 9 10
1X 1X
11X 1X
11X
1
SYSTEM
RPS
STATUS
1 2
UTIL
DUPLX
2X 2X
12X 2X
12X 1
SPEED
MODE
Understanding BackboneFast
BackboneFast is initiated when a root port or blocked port on a switch receives inferior BPDUs from its
designated bridge. An inferior BPDU identifies one switch as both the root bridge and the designated
bridge. When a switch receives an inferior BPDU, it means that a link to which the switch is not directly
connected (an indirect link) has failed (that is, the designated bridge has lost its connection to the root
switch). Under STP rules, the switch ignores inferior BPDUs for the configured maximum aging time
specified by the spanning-tree max-age global configuration command.
The switch tries to determine if it has an alternate path to the root switch. If the inferior BPDU arrives
on a blocked port, the root port and other blocked ports on the switch become alternate paths to the root
switch. (Self-looped ports are not considered alternate paths to the root switch.) If the inferior BPDU
arrives on the root port, all blocked ports become alternate paths to the root switch. If the inferior BPDU
arrives on the root port and there are no blocked ports, the switch assumes that it has lost connectivity
to the root switch, causes the maximum aging time on the root to expire, and becomes the root switch
according to normal STP rules.
If the switch has alternate paths to the root switch, it uses these alternate paths to transmit a new kind of
Protocol Data Unit (PDU) called the Root Link Query PDU. The switch sends the Root Link Query PDU
on all alternate paths to the root switch. If the switch determines that it still has an alternate path to the
root, it causes the maximum aging time on the ports on which it received the inferior BPDU to expire.
If all the alternate paths to the root switch indicate that the switch has lost connectivity to the root switch,
the switch causes the maximum aging times on the ports on which it received an inferior BPDU to expire.
If one or more alternate paths can still connect to the root switch, the switch makes all ports on which it
received an inferior BPDU its designated ports and moves them out of the blocking state (if they were
in the blocking state), through the listening and learning states, and into the forwarding state.
Figure 9-10 shows an example topology with no link failures. Switch A, the root switch, connects
directly to Switch B over link L1 and to Switch C over link L2. The interface on Switch C that connects
directly to Switch B is in the blocking state.
Switch A
(Root) Switch B
L1
L2 L3
Blocked port
44963
Switch C
If link L1 fails, Switch C cannot detect this failure because it is not connected directly to link L1.
However, because Switch B is directly connected to the root switch over L1, it detects the failure, elects
itself the root, and begins sending BPDUs to Switch C, identifying itself as the root. When Switch C
receives the inferior BPDUs from Switch B, Switch C assumes that an indirect failure has occurred. At
that point, BackboneFast allows the blocked port on Switch C to move immediately to the listening state
without waiting for the maximum aging time for the port to expire. BackboneFast then transitions the
interface on Switch C to the forwarding state, providing a path from Switch B to Switch A. This
switchover takes approximately 30 seconds, twice the Forward Delay time if the default Forward Delay
time of 15 seconds is set. Figure 9-11 shows how BackboneFast reconfigures the topology to account for
the failure of link L1.
Switch A
(Root) Switch B
L1
Link failure
L2 L3
44964
Switch C
If a new switch is introduced into a shared-medium topology as shown in Figure 9-12, BackboneFast is
not activated because the inferior BPDUs did not come from the recognized designated bridge
(Switch B). The new switch begins sending inferior BPDUs that say it is the root switch. However, the
other switches ignore these inferior BPDUs, and the new switch learns that Switch B is the designated
bridge to Switch A, the root switch.
Switch A
(Root)
Switch C Switch B
(Designated bridge)
Blocked port
Added switch
44965
Potential
spanning-tree root without
root guard enabled
Desired
root switch
Disabling STP
STP is enabled by default on VLAN 1 and on all newly created VLANs up to the spanning-tree limit
specified in Table 9-2. Disable STP only if you are sure there are no loops in the network topology.
Caution When STP is disabled and loops are present in the topology, excessive traffic and indefinite packet
duplication can drastically reduce network performance.
Beginning in privileged EXEC mode, follow these steps to disable STP on a per-VLAN basis:
Command Purpose
Step 1 configure terminal Enter global configuration mode.
Step 2 no spanning-tree vlan vlan-id Disable STP on a per-VLAN basis.
For vlan-id, the range is 1 to 1005. Do not enter leading zeroes.
Step 3 end Return to privileged EXEC mode.
Step 4 show spanning-tree vlan vlan-id Verify your entries.
Step 5 copy running-config startup-config (Optional) Save your entries in the configuration file.
To re-enable STP, use the spanning-tree vlan vlan-id global configuration command.
To configure a switch to become the root, the switch priority can be modified from the default
value (32768) to a significantly lower value so that the switch becomes the root switch for the specified
VLAN. Use the spanning-tree vlan vlan-id root global configuration command to alter the switch
priority. When you enter this command on a switch, it checks the switch priority of the current root
switch for each VLAN and sets its own switch priority for the specified VLAN to 8192 if this value
causes this switch to become the root for the specified VLAN. If any root switch for the specified VLAN
has a switch priority lower than 8192, the switch sets its own priority for the specified VLAN to 1 less
than the lowest switch priority.
For example, if all switches in the network have the switch priority for VLAN 100 set to the default value
of 32768, entering the spanning-tree vlan 100 root primary global configuration command on a switch
sets the switch priority for VLAN 100 to 8192, causing the switch to become the root switch for
VLAN 100.
Note The root switch for each instance of STP should be a backbone or distribution switch. Do not configure
an access switch as the spanning-tree primary root.
Use the diameter keyword to specify the network diameter (that is, the maximum number of switch hops
between any two end stations in the network). When you specify the network diameter, the switch
automatically sets an optimal hello time, forward-delay time, and maximum-age time for a network of
that diameter, which can significantly reduce the convergence time. You can use the hello keyword to
override the automatically calculated hello time.
Note We recommend that you avoid manually configuring the hello time, forward-delay time, and
maximum-age time after configuring the switch as the root switch.
Beginning in privileged EXEC mode, follow these steps to configure a switch as the root switch:
Command Purpose
Step 1 configure terminal Enter global configuration mode.
Step 2 spanning-tree vlan vlan-id root primary Configure a switch as the root switch.
[diameter net-diameter [hello-time seconds]] For vlan-id, the range is 1 to 1005. Do not enter leading zeroes.
(Optional) For diameter net-diameter, specify the maximum
number of switches between any two end stations. The range
is 2 to 7.
(Optional) For hello-time seconds, specify the interval in
seconds between the generation of configuration messages by
the root switch. The range is 1 to 10 seconds; the default is 2
seconds for STP.
Step 3 end Return to privileged EXEC mode.
Step 4 show spanning-tree Verify your entries.
Step 5 copy running-config startup-config (Optional) Save your entries in the configuration file.
To return the switch to its default setting, use the no spanning-tree vlan vlan-id root global
configuration command.
Command Purpose
Step 1 configure terminal Enter global configuration mode.
Step 2 spanning-tree vlan vlan-id root secondary Configure a switch as the secondary root switch.
[diameter net-diameter [hello-time For vlan-id, the range is 1 to 1005. Do not enter leading zeroes.
seconds]]
(Optional) For diameter net-diameter, specify the maximum number
of switches between any two end stations. The range is 2 to 7.
(Optional) For hello-time seconds, specify the interval in seconds
between the generation of configuration messages by the root switch.
The range is 1 to 10 seconds; the default is 2 seconds for STP.
Use the same network diameter and hello-time values that you used
when configuring the primary root switch.
Step 3 end Return to privileged EXEC mode.
Step 4 show spanning-tree Verify your entries.
Step 5 copy running-config startup-config (Optional) Save your entries in the configuration file.
To return the switch to its default setting, use the no spanning-tree vlan vlan-id root global
configuration command.
Command Purpose
Step 1 configure terminal Enter global configuration mode.
Step 2 interface interface-id Enter interface configuration mode, and specify an
interface to configure.
Valid interfaces include physical interfaces and
port-channel logical interfaces (port-channel
port-channel-number).
Step 3 spanning-tree port-priority priority Configure the port priority for an interface that is an access
port.
For priority, the range is 0 to 255; the default is 128. The
lower the number, the higher the priority.
Step 4 spanning-tree vlan vlan-id port-priority priority Configure the VLAN port priority for an interface that is a
trunk port.
For vlan-id, the range is 1 to 1005. Do not enter leading
zeroes.
For priority, the range is 0 to 255; the default is 128. The
lower the number, the higher the priority.
Step 5 end Return to privileged EXEC mode.
Step 6 show spanning-tree interface interface-id Verify your entries.
or
show spanning-tree vlan vlan-id
Step 7 copy running-config startup-config (Optional) Save your entries in the configuration file.
Note The show spanning-tree interface interface-id interface configuration command only displays
information if the port is in a link-up operative state and is configured for Dynamic Trunking Protocol
(DTP). Otherwise, you can use the show running-config interface interface configuration command to
confirm the configuration.
To return the interface to its default setting, use the no spanning-tree vlan vlan-id port-priority
interface configuration command.
For information on how to configure load sharing on trunk ports by using STP port priorities, see the
“Load Sharing Using STP” section on page 8-24.
Command Purpose
Step 1 configure terminal Enter global configuration mode.
Step 2 interface interface-id Enter interface configuration mode, and specify an interface to
configure. Valid interfaces include physical interfaces and
port-channel logical interfaces (port-channel
port-channel-number).
Step 3 spanning-tree cost cost Configure the cost for an interface that is an access port.
In the event of a loop, STP considers the path cost when selecting
an interface to place into the forwarding state. A lower path cost
represents higher-speed transmission.
For cost, the range is 1 to 200000000; the default value is derived
from the media speed of the interface.
Step 4 spanning-tree vlan vlan-id cost cost Configure the VLAN cost for an interface that is a trunk port.
In the event of a loop, STP considers the path cost when selecting
an interface to place into the forwarding state. A lower path cost
represents higher-speed transmission.
For vlan-id, the range is 1 to 1005. Do not enter leading zeroes.
For cost, the range is 1 to 65535; the default value is derived from
the media speed of the interface.
Step 5 end Return to privileged EXEC mode.
Step 6 show spanning-tree interface interface-id Verify your entries.
or
show spanning-tree vlan vlan-id
Step 7 copy running-config startup-config (Optional) Save your entries in the configuration file.
Note The show spanning-tree interface interface-id interface configuration command only displays
information for ports that are in a link-up operative state and are configured for DTP. Otherwise, you can
use the show running-config privileged EXEC command to confirm the configuration.
To return the interface to its default setting, use the no spanning-tree cost interface configuration or the
no spanning-tree vlan vlan-id cost interface configuration command.
For information on how to configure load sharing on trunk ports using STP path costs, see the “Load
Sharing Using STP” section on page 8-24.
Note Exercise care when using this command. For most situations, we recommend that you use the
spanning-tree vlan vlan-id root primary and the spanning-tree vlan vlan-id root secondary global
configuration commands to modify the switch priority.
Beginning in privileged EXEC mode, follow these steps to configure the STP switch priority of a VLAN:
Command Purpose
Step 1 configure terminal Enter global configuration mode.
Step 2 spanning-tree vlan vlan-id priority priority Configure the switch priority of a VLAN.
The lower the number, the more likely the switch will be
chosen as the root switch.
For vlan-id, the range is 1 to 1005. Do not enter leading
zeroes.
For priority, the range is 0 to 65535; the default is 32768.
Step 3 end Return to privileged EXEC mode.
Step 4 show spanning-tree vlan vlan-id bridge [brief] Verify your entries.
Step 5 copy running-config startup-config (Optional) Save your entries in the configuration file.
To return the switch to its default setting, use the no spanning-tree vlan vlan-id priority global
configuration command.
Note Exercise care when using this command. For most situations, we recommend that you use the
spanning-tree vlan vlan-id root primary and the spanning-tree vlan vlan-id root secondary global
configuration commands to modify the hello time.
Beginning in privileged EXEC mode, follow these steps to configure the STP hello time of a VLAN:
Command Purpose
Step 1 configure terminal Enter global configuration mode.
Step 2 spanning-tree vlan vlan-id hello-time seconds Configure the hello time of a VLAN.
The hello time is the interval between the generation of
configuration messages by the root switch. These messages
mean that the switch is alive.
For vlan-id, the range is 1 to 1005. Do not enter leading zeroes.
For seconds, the range is 1 to 10 seconds; the default is 2
seconds.
Step 3 end Return to privileged EXEC mode.
Step 4 show spanning-tree vlan vlan-id bridge [brief] Verify your entries.
Step 5 copy running-config startup-config (Optional) Save your entries in the configuration file.
To return the switch to its default setting, use the no spanning-tree vlan vlan-id hello-time global
configuration command.
Command Purpose
Step 1 configure terminal Enter global configuration mode.
Step 2 spanning-tree vlan vlan-id forward-time Configure the forward time of a VLAN.
seconds The forward delay is the number of seconds a port waits before
changing from its STP learning and listening states to the
forwarding state.
For vlan-id, the range is 1 to 1005. Do not enter leading zeroes.
For seconds, the range is 4 to 30 seconds; the default is 15
seconds.
Step 3 end Return to privileged EXEC mode.
Command Purpose
Step 4 show spanning-tree vlan vlan-id bridge [brief] Verify your entries.
Step 5 copy running-config startup-config (Optional) Save your entries in the configuration file.
To return the switch to its default setting, use the no spanning-tree vlan vlan-id forward-time global
configuration command.
Command Purpose
Step 1 configure terminal Enter global configuration mode.
Step 2 spanning-tree vlan vlan-id max-age seconds Configure the maximum-aging time of a VLAN.
The maximum-aging time is the number of seconds a switch
waits without receiving STP configuration messages before
attempting a reconfiguration.
For vlan-id, the range is 1 to 1005. Do not enter leading zeroes.
For seconds, the range is 6 to 40 seconds; the default is 20
seconds.
Step 3 end Return to privileged EXEC mode.
Step 4 show spanning-tree vlan vlan-id bridge [brief] Verify your entries.
Step 5 copy running-config startup-config (Optional) Save your entries in the configuration file.
To return the switch to its default setting, use the no spanning-tree vlan vlan-id max-age global
configuration command.
Table 9-3 Default and Acceptable STP Parameter Settings (in seconds)
STP Parameter STP Default Acceptable for Option 1 Acceptable for Option 2 Acceptable for Option 3
Hello Time 2 1 1 1
Max Age 20 6 10 6
Forwarding Delay 15 4 7 4
Cisco 7000
Catalyst 3550 Catalyst 2950 router
series switch switches
60999
Option 1: Option 2: Option 3:
standalone cascaded cascaded
cascaded cluster connected to cluster connected to
cluster a Layer 2 backbone a Layer 3 backbone
Command Purpose
show spanning-tree active Displays STP information on active interfaces only.
show spanning-tree brief Displays a summary of interface information.
show spanning-tree interface interface-id Displays information for the specified interface.
show spanning-tree summary [totals] Displays a summary of port states or displays the total lines of the STP state
section.
For information about other keywords for the show spanning-tree command, refer to the
Catalyst 2950 Desktop Switch Command Reference for this release.
Caution Use Port Fast only when connecting a single end station to an access port. Enabling this feature on an
interface connected to a switch or hub could prevent STP from detecting and disabling loops in your
network, which could cause broadcast storms and address-learning problems.
Beginning in privileged EXEC mode, follow these steps to enable Port Fast on an access port:
Command Purpose
Step 1 configure terminal Enter global configuration mode.
Step 2 interface interface-id Enter interface configuration mode, and specify an interface to
configure. Valid interfaces include physical interfaces and
port-channel logical interfaces (port-channel
port-channel-number).
Step 3 spanning-tree portfast Enable Port Fast on an access port connected to a single
workstation or server.
By default, Port Fast is disabled on all interfaces.
Step 4 end Return to privileged EXEC mode.
Step 5 show running interface interface-id Verify your entries.
Step 6 copy running-config startup-config (Optional) Save your entries in the configuration file.
To disable the Port Fast feature, use the no spanning-tree portfast interface configuration command.
Caution The BPDU guard feature works on Port Fast-enable interfaces. Configure Port Fast only on interfaces
that connect to end stations; otherwise, an accidental topology loop could cause a data packet loop and
disrupt switch and network operation.
Beginning in privileged EXEC mode, follow these steps to enable the BPDU guard feature on the switch:
Command Purpose
Step 1 configure terminal Enter global configuration mode.
Step 2 spanning-tree portfast bpduguard Enable BPDU guard on the switch.
By default, BPDU guard is disabled on the switch.
Step 3 end Return to privileged EXEC mode.
Step 4 show spanning-tree summary total Verify your entries.
Step 5 copy running-config startup-config (Optional) Save your entries in the configuration file.
In a valid configuration, Port Fast-enabled interfaces do not receive BPDUs. Receiving a BPDU on a
Port Fast-enabled interface means an invalid configuration, such as the connection of an unauthorized
device. If a BPDU is received on Port Fast-enabled interface, the BPDU guard feature places the
interface into the ErrDisable state. The BPDU guard feature provides a secure response to invalid
configurations because you must manually put the interface back in service.
To disable BPDU guard, use the no spanning-tree portfast bpduguard global configuration command.
Note When you enable UplinkFast, it affects all VLANs on the switch. You cannot configure UplinkFast on
an individual VLAN.
Command Purpose
Step 1 configure terminal Enter global configuration mode.
Step 2 spanning-tree uplinkfast [max-update-rate Enable UplinkFast on the switch.
pkts-per-second] For pkts-per-second, the range is 0 to 65535 packets per second; the
default is 150.
If you set the rate to 0, station-learning frames are not generated,
and the STP topology converges more slowly after a loss of
connectivity.
Step 3 end Return to privileged EXEC mode.
Step 4 show spanning-tree Verify your entries.
Step 5 copy running-config startup-config (Optional) Save your entries in the configuration file.
When UplinkFast is enabled, the switch priority of all VLANs is set to 49152, and the path cost of all
interfaces and VLAN trunks is increased by 3000 if you did not modify the path cost from its default
setting. This change reduces the chance that the switch will become the root port. When UplinkFast is
disabled, the switch priorities of all VLANs and path costs of all interfaces are set to default values if
you did not modify them from their defaults.
To return the update packet rate to the default setting, use the no spanning-tree uplinkfast
max-update-rate global configuration command. To disable UplinkFast, use the no spanning-tree
uplinkfast command.
Command Purpose
Step 1 configure terminal Enter global configuration mode.
Step 2 spanning-tree uplinkfast [max-update-rate Enable UplinkFast on the switch.
pkts-per-second] (Optional) For max-update-rate pkts-per-second, specify the
number of packets per second at which update packets are sent. The
range is 0 to 65535; the default is 150 packets per second.
Step 1 interface interface-id Enter interface configuration mode, and specify the GBIC interface
on which to enable CSUF.
Step 2 spanning-tree stack-port Enable CSUF on only one stack-port GBIC interface.
The stack port connects to the GigaStack GBIC multidrop
backbone. If you try to enable CSUF on a Fast Ethernet or a
copper-based Gigabit Ethernet port, you receive an error message.
If CSUF is already enabled on an interface and you try to enable it
on another interface, you receive an error message. You must
disable CSUF on the first interface before enabling it on a new
interface.
Use this command only on access switches.
Step 3 end Return to privileged EXEC mode.
Step 4 show spanning-tree Verify your entries.
Step 5 copy running-config startup-config (Optional) Save your entries in the configuration file.
Configuring BackboneFast
You can enable BackboneFast to detect indirect link failures and to start the spanning-tree
reconfiguration sooner.
Note If you use BackboneFast, you must enable it on all switches in the network. BackboneFast is not
supported on Token Ring VLANs. This feature is supported for use with third-party switches.
Command Purpose
Step 1 configure terminal Enter global configuration mode.
Step 2 spanning-tree backbonefast Enable BackboneFast on the switch.
Step 3 end Return to privileged EXEC mode.
Step 4 show spanning-tree vlan vlan-id Verify your entries.
Step 5 copy running-config startup-config (Optional) Save your entries in the configuration file.
To disable the BackboneFast feature, use the no spanning-tree backbonefast global configuration
command.
Command Purpose
Step 1 configure terminal Enter global configuration mode.
Step 2 interface interface-id Enter interface configuration mode, and specify an interface to
configure. Valid interfaces include physical interfaces and
port-channel logical interfaces (port-channel port-channel-number).
Step 3 spanning-tree guard root Enable root guard on the interface.
By default, root guard is disabled on all interfaces.
Step 4 end Return to privileged EXEC mode.
Step 5 show running-config Verify your entries.
Step 6 copy running-config startup-config (Optional) Save your entries in the configuration file.
To disable the root guard feature, use the no spanning-tree guard or the spanning-tree guard none
interface configuration commands.