0% found this document useful (0 votes)
11 views

Understanding and Configuring Spanning Tree Protocol (STP) On Catalyst Switches............................... 1

Uploaded by

Mangesh Nalawade
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Understanding and Configuring Spanning Tree Protocol (STP) On Catalyst Switches............................... 1

Uploaded by

Mangesh Nalawade
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Cisco − Understanding and Configuring Spanning Tree Protocol (STP) on Catalyst Switches

Table of Contents
Understanding and Configuring Spanning Tree Protocol (STP) on Catalyst Switches...............................1
Document ID: 5234..................................................................................................................................1
Introduction..........................................................................................................................................................1
Prerequisites.........................................................................................................................................................1
Requirements..........................................................................................................................................1
Components Used...................................................................................................................................1
Conventions............................................................................................................................................2
Background Theory................................................................................................................................2
Network Diagram....................................................................................................................................2
Concepts...............................................................................................................................................................2
Description of the Technology.............................................................................................................................3
STP Operation......................................................................................................................................................4
Task.........................................................................................................................................................4
Step−by−Step Instructions......................................................................................................................5
Verify...................................................................................................................................................................8
Troubleshoot........................................................................................................................................................8
Troubleshooting Commands...................................................................................................................9
Command Summary...............................................................................................................................9
NetPro Discussion Forums − Featured Conversations........................................................................................9
Related Information...........................................................................................................................................10

i
Understanding and Configuring Spanning Tree
Protocol (STP) on Catalyst Switches
Document ID: 5234

Introduction
Prerequisites
Requirements
Components Used
Conventions
Background Theory
Network Diagram
Concepts
Description of the Technology
STP Operation
Task
Step−by−Step Instructions
Verify
Troubleshoot
Troubleshooting Commands
Command Summary
NetPro Discussion Forums − Featured Conversations
Related Information

Introduction
Spanning Tree Protocol (STP) is a Layer 2 (L2) protocol that runs on bridges and switches. The specification
for STP is IEEE 802.1D. The main purpose of STP is to ensure that you do not create loops when you have
redundant paths in your network. Loops are deadly to a network.

Prerequisites
Requirements
There are no specific requirements for this document.

Components Used
Although this document uses Cisco Catalyst 5500/5000 switches, the spanning tree principles that the
document presents are applicable to almost all devices that support STP.

For the examples, this document used:

• A console cable that is suitable for the Supervisor Engine in the switch
• Six Catalyst 5509 switches

The information in this document was created from the devices in a specific lab environment. All of the
devices used in this document started with a cleared (default) configuration. If your network is live, make sure
that you understand the potential impact of any command.

Cisco − Understanding and Configuring Spanning Tree Protocol (STP) on Catalyst Switches
Conventions
For more information on document conventions, refer to the Cisco Technical Tips Conventions.

Background Theory
The configurations in this document apply to Catalyst 2926G, 2948G, 2980G, 4500/4000, 5500/5000, and
6500/6000 switches that run Catalyst OS (CatOS). For information on the configuration of STP on other
switch platforms, refer to these documents:

• Configuring STP and IEEE 802.1s MST on Catalyst 6500/6000 switches that run Cisco IOS®
Software
• Understanding and Configuring STP on Catalyst 4500/4000 switches that run Cisco IOS Software
• Configuring STP on Catalyst 2900 XL/3500 XL switches
• Configuring STP on Catalyst 3550 switches
• Configuring STP on Catalyst 2950 switches

Network Diagram
This document uses this network setup:

Concepts
STP runs on bridges and switches that are 802.1D−compliant. There are different flavors of STP, but 802.1D
is the most popular and widely implemented. You implement STP on bridges and switches in order to prevent
loops in the network. Use STP in situations where you want redundant links, but not loops. Redundant links
are as important as backups in the case of a failover in a network. A failure of your primary activates the
backup links so that users can continue to use the network. Without STP on the bridges and switches, such a
failure can result in a loop. Consider this network:

Cisco − Understanding and Configuring Spanning Tree Protocol (STP) on Catalyst Switches
In this network, a redundant link is planned between Switch A and Switch B. But this setup creates the
possibility of a bridging loop. For example, a broadcast or multicast packet that transmits from Station M and
is destined for Station N simply continues to circulate between both switches.

However, when STP runs on both switches, the network logically looks like this:

This information applies to the scenario in the Network Diagram:

• Switch 15 is the backbone switch.


• Switches 12, 13, 14, 16, and 17 are switches that attach to workstations and PCs.
• The network defines these VLANs:

♦1
♦ 200
♦ 201
♦ 202
♦ 203
♦ 204
• The VLAN Trunk Protocol (VTP) domain name is STD−Doc.

In order to provide this desired path redundancy, as well as to avoid a loop condition, STP defines a tree that
spans all the switches in an extended network. STP forces certain redundant data paths into a standby
(blocked) state and leaves other paths in a forwarding state. If a link in the forwarding state becomes
unavailable, STP reconfigures the network and reroutes data paths through the activation of the appropriate
standby path.

Description of the Technology


With STP, the key is for all the switches in the network to elect a root bridge that becomes the focal point in
the network. All other decisions in the network, such as which port to block and which port to put in
forwarding mode, are made from the perspective of this root bridge. A switched environment, which is
different from a bridge environment, most likely deals with multiple VLANs. When you implement a root

Cisco − Understanding and Configuring Spanning Tree Protocol (STP) on Catalyst Switches
bridge in a switching network, you usually refer to the root bridge as the root switch. Each VLAN must have
its own root bridge because each VLAN is a separate broadcast domain. The roots for the different VLANs
can all reside in a single switch or in various switches.

Note: The selection of the root switch for a particular VLAN is very important. You can choose the root
switch, or you can let the switches decide, which is risky. If you do not control the root selection process,
there can be suboptimal paths in your network.

All the switches exchange information for use in the root switch selection and for subsequent configuration of
the network. Bridge protocol data units (BPDUs) carry this information. Each switch compares the parameters
in the BPDU that the switch sends to a neighbor with the parameters in the BPDU that the switch receives
from the neighbor.

In the STP root selection process, less is better. If Switch A advertises a root ID that is a lower number than
the root ID that Switch B advertises, the information from Switch A is better. Switch B stops the
advertisement of its root ID, and accepts the root ID of Switch A.

Refer to Configuring Optional STP Features for details about some of the optional STP features, such as:

• PortFast
• Root guard
• Loop guard
• BPDU guard

STP Operation
Task
Prerequisites: Before you configure STP, select a switch to be the root of the spanning tree. This switch does
not need to be the most powerful switch. But choose the most centralized switch on the network. All data flow
across the network is from the perspective of this switch. Also, choose the least disturbed switch in the
network. The backbone switches often serve as the spanning tree root because these switches typically do not
connect to end stations. Also, moves and changes within the network are less likely to affect these switches.

After you decide on the root switch, set the appropriate variables to designate the switch as the root switch.
The only variable that you must set is the bridge priority. If the switch has a bridge priority that is lower than
all the other switches, the other switches automatically select the switch as the root switch.

Clients (end stations) on switch ports: You can also issue the set spantree portfast command, on a
per−port basis. When you enable the portfast variable on a port, the port immediately switches from blocking
mode to forwarding mode. Enablement of portfast helps to prevent timeouts on clients who use Novell
Netware or use Dynamic Host Configuration Protocol (DHCP) in order to obtain an IP address. However, do
not use this command when you have switch−to−switch connection. In this case, the command can result in a
loop. The 300 second delay that occurs during the transition from blocking to forwarding mode prevents a
temporal loop condition in the network when you connect two switches.

Leave most other STP variables at their default values.

Rules of Operation: This section lists rules for how STP works. When the switches first come up, they start
the root switch selection process. Each switch transmits a BPDU to the directly connected switch on a
per−VLAN basis.

Cisco − Understanding and Configuring Spanning Tree Protocol (STP) on Catalyst Switches
As the BPDU goes out through the network, each switch compares the BPDU that the switch sends to the
BPDU that the switch receives from the neighbors. The switches then agree on which switch is the root
switch. The switch with the lowest bridge ID in the network wins this election process.

Note: Remember that one root switch is identified per VLAN. After the root switch identification, the
switches follow these rules:

• STP Rule 1: All ports of the root switch must be in forwarding mode.

Note: In some corner cases, which involve self−looped ports, there is an exception to this rule.

Next, each switch determines the best path to get to the root. The switches determine this path by a
comparison of the information in all the BPDUs that the switches receive on all ports. The switch uses
the port with the least amount of information in the BPDU in order to get to the root switch; the port
with the least amount of information in the BPDU is the root port. After a switch determines the root
port, the switch proceeds to Rule 2.
• STP Rule 2: The root port must be set to forwarding mode.

In addition, the switches on each LAN segment communicate with each other to determine which
switch is best to use in order to move data from that segment to the root bridge. This switch is called
the designated switch.
• STP Rule 3: In a single LAN segment, the port of the designated switch that connects to that LAN
segment must be placed in forwarding mode.
• STP Rule 4: All the other ports in all the switches (VLAN−specific) must be placed in blocking
mode. The rule only applies to ports that connect to other bridges or switches. STP does not affect
ports that connect to workstations or PCs; these ports remain forwarded.

Step−by−Step Instructions
Complete these steps:

1. Issue the show version command in order to display the software version that the switch runs.

Note: All switches run the same software version.

Switch−15> (enable) show version


WS−C5505 Software, Version McpSW: 4.2(1) NmpSW: 4.2(1)
Copyright (c) 1995−1998 by Cisco Systems
NMP S/W compiled on Sep 8 1998, 10:30:21
MCP S/W compiled on Sep 08 1998, 10:26:29

System Bootstrap Version: 5.1(2)

Hardware Version: 1.0 Model: WS−C5505 Serial #: 066509927

Mod Port Model Serial # Versions


−−− −−−− −−−−−−−−−− −−−−−−−−− −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1 0 WS−X5530 008676033 Hw : 2.3
Fw : 5.1(2)
Fw1: 4.4(1)
Sw : 4.2(1)

In this scenario, Switch 15 is the best choice for the root switch of the network for all the VLANs
because Switch 15 is the backbone switch.

Cisco − Understanding and Configuring Spanning Tree Protocol (STP) on Catalyst Switches
Issue the set spantree root vlan_id command in order to set the priority of the switch to 8192 for the
VLAN or VLANs that the vlan_id specifies.

Note: The default priority for switches is 32768. When you set the priority with this command, you
force the selection of Switch 15 as the root switch because Switch 15 has the lowest priority.

Switch−15> (enable) set spantree root 1


VLAN 1 bridge priority set to 8192.
VLAN 1 bridge max aging time set to 20.
VLAN 1 bridge hello time set to 2.
VLAN 1 bridge forward delay set to 15.
Switch is now the root switch for active VLAN 1.
Switch−15> (enable)

Switch−15> (enable) set spantree root 200


VLAN 200 bridge priority set to 8192.
VLAN 200 bridge max aging time set to 20.
VLAN 200 bridge hello time set to 2.
VLAN 200 bridge forward delay set to 15.
Switch is now the root switch for active VLAN 200.
Switch−15> (enable)

Switch−15> (enable) set spantree root 201


VLAN 201 bridge priority set to 8192.
VLAN 201 bridge max aging time set to 20.
VLAN 201 bridge hello time set to 2.
VLAN 201 bridge forward delay set to 15.
Switch is now the root switch for active VLAN 201.
Switch−15> (enable)

Switch−15> (enable) set spantree root 202


VLAN 202 bridge priority set to 8192.
VLAN 202 bridge max aging time set to 20.
VLAN 202 bridge hello time set to 2.
VLAN 202 bridge forward delay set to 15.
Switch is now the root switch for active VLAN 202.
Switch−15>

Switch−15> (enable) set spantree root 203


VLAN 203 bridge priority set to 8192.
VLAN 203 bridge max aging time set to 20.
VLAN 203 bridge hello time set to 2.
VLAN 203 bridge forward delay set to 15.
Switch is now the root switch for active VLAN 203.
Switch−15>

Switch−15> (enable) set spantree root 204


VLAN 204 bridge priority set to 8192.
VLAN 204 bridge max aging time set to 20.
VLAN 204 bridge hello time set to 2.
VLAN 204 bridge forward delay set to 15.
Switch is now the root switch for active VLAN 204.
Switch−15> (enable)

The shorter version of the command has the same effect, as this example shows:

Switch−15> (enable) set spantree root 1,200−204


VLANs 1,200−204 bridge priority set to 8189.
VLANs 1,200−204 bridge max aging time set to 20.
VLANs 1,200−204 bridge hello time set to 2.
VLANs 1,200−204 bridge forward delay set to 15.
Switch is now the root switch for active VLANs 1,200−204.

Cisco − Understanding and Configuring Spanning Tree Protocol (STP) on Catalyst Switches
2. Switch−15> (enable)

The set spantree priority command gives you a third way to specify the root switch:

Switch−15> (enable) set spantree priority 8192 1


Spantree 1 bridge priority set to 8192.
Switch−15> (enable)

Note: In this scenario, all the switches started with cleared configurations. So all the switches started
with a bridge priority of 32768. If you are not certain that all the switches in your network have a
priority that is greater than 8192, set the priority of your desired root bridge to 1.
3. Issue the set spantree portfast mod_num/port_num enable command in order to configure the
PortFast setting on Switches 12, 13, 14, 16, and 17.

Note: Only configure this setting on ports that connect to workstations or PCs. Do not enable PortFast
on any port that connects to another switch.

This example only configures Switch 12. You can configure other switches in the same way. Switch
12 has these port connections:

♦ Port 2/1 connects to Switch 13.


♦ Port 2/2 connects to Switch 15.
♦ Port 2/3 connects to Switch 16.
♦ Port 3/1 through 3/24 connects to PCs.
♦ Port 4/1 through 4/24 connects to UNIX workstations.
With this information as a basis, issue the set spantree portfast command on ports 3/1›/24 and on
ports 4/1œ/24:

Switch−12> (enable) set spantree portfast 3/1−24 enable

Warning: Spantree port fast start should only be enabled on ports connected
to a single host. Connecting hubs, concentrators, switches, bridges, etc. to
a fast start port can cause temporary spanning−tree loops. Use with caution.

Spantree ports 3/1−24 fast start enabled.


Switch−12> (enable)

Switch−12> (enable) set spantree portfast 4/1−24 enable

Warning: Spantree port fast start should only be enabled on ports connected
to a single host. Connecting hubs, concentrators, switches, bridges, etc. to
a fast start port can cause temporary spanning−tree loops. Use with caution.

Spantree ports 4/1−24 fast start enabled.


Switch−12> (enable)
4. Issue the show spantree vlan_id command in order to verify that Switch 15 is the root of all the
appropriate VLANs.

From the output from this command, compare the MAC address of the switch that is the root switch
to the MAC address of the switch from which you issued the command. If the addresses match, the
switch that you are in is the root switch of the VLAN. A root port that is 1/0 also indicates that you
are at the root switch. Here is the sample command output:

Switch−15> (enable) show spantree 1


VLAN 1
spanning−tree enabled
spanning−tree type ieee

Cisco − Understanding and Configuring Spanning Tree Protocol (STP) on Catalyst Switches
Designated Root 00−10−0d−b1−78−00

!−−− This is the MAC address of the root switch for VLAN 1.

Designated Root Priority 8192


Designated Root Cost 0
Designated Root Port 1/0
Root Max Age 20 sec Hello Time 2 sec Forward Delay 15 sec

Bridge ID MAC ADDR 00−10−0d−b1−78−00


Bridge ID Priority 8192
Bridge Max Age 20 sec Hello Time 2 sec Forward Delay 15 sec

This output shows that Switch 15 is the designated root on the spanning tree for VLAN 1. The MAC
address of the designated root switch (00−10−0d−b1−78−00) is the same as the bridge ID MAC
address of Switch 15 (00−10−0d−b1−78−00). Another indicator that this switch is the designated
root is that the designated root port is 1/0.

In this output from Switch 12, the switch recognizes Switch 15 as the Designated Root for
VLAN 1:

Switch−12> (enable) show spantree 1


VLAN 1
spanning−tree enabled
spanning−tree type IEEEDesignated Root 00−10−0d−b1−78−00

!−−− This is the MAC address of the root switch for VLAN 1.

Designated Root Priority 8192


Designated Root Cost 19
Designated Root Port 2/3
Root Max Age 20 sec Hello Time 2 sec Forward Delay 15 sec

Bridge ID MAC ADDR 00−10−0d−b2−8c−00


Bridge ID Priority 32768
Bridge Max Age 20 sec Hello Time 2 sec Forward Delay 15 sec

Note: The output of the show spantree vlan_id command for the other switches and VLANs would
also indicate that Switch 15 is the designated root for all VLANs.

Verify
This section provides information you can use to confirm that your configuration works properly.

Certain show commands are supported by the Output Interpreter Tool ( registered customers only) , which allows
you to view an analysis of show command output.

• show spantree vlan_id Shows the current state of the spanning tree for this VLAN ID, from the
perspective of the switch on which you issue the command.
• show spantree summaryProvides a summary of connected spanning tree ports by VLAN.

Troubleshoot
This section provides information you can use to troubleshoot your configuration.

Cisco − Understanding and Configuring Spanning Tree Protocol (STP) on Catalyst Switches
Troubleshooting Commands
Certain show commands are supported by the Output Interpreter Tool ( registered customers only) , which allows
you to view an analysis of show command output.

• show spantree vlan_id Shows the current state of the spanning tree for this VLAN ID, from the
perspective of the switch on which you issue the command.
• show spantree summaryProvides a summary of connected spanning tree ports by VLAN.
• show spantree statisticsShows spanning tree statistical information.
• show spantree backbonefastDisplays whether the spanning tree BackboneFast Convergence
feature is enabled.
• show spantree blockedportsDisplays only the blocked ports.
• show spantree portstateDetermines the current spanning tree state of a Token Ring port within a
spanning tree.
• show spantree portvlancostShows the path cost for the VLANs on a port.
• show spantree uplinkfastShows the UplinkFast settings.

Command Summary

Syntax:
show version
As used in this document:
show version
Syntax:
set spantree root [vlan_id]
set spantree root 1
As used in this document:
set spantree root 1,200−204
Syntax:
set spantree priority [vlan_id]
As used in this document:
set spantree priority 8192 1
set spantree portfast
Syntax:
mod_num/port_num {enable |
disable}
As used in this document: set spantree portfast 3/1−24
enable
Syntax:
show spantree [vlan_id]
As used in this document:
show spantree 1

NetPro Discussion Forums − Featured Conversations


Networking Professionals Connection is a forum for networking professionals to share questions, suggestions,
and information about networking solutions, products, and technologies. The featured links are some of the
most recent conversations available in this technology.

NetPro Discussion Forums − Featured Conversations for LAN


Network Infrastructure: LAN Routing and Switching
Network Infrastructure: Getting Started with LANs

Cisco − Understanding and Configuring Spanning Tree Protocol (STP) on Catalyst Switches
Related Information
• Spanning Tree Protocol Problems and Related Design Considerations
• Understanding Spanning−Tree Protocol Topology Changes
• Configuring Spanning Tree for Catalyst 4500/4000 Switches
• Configuring Spanning Tree for Catalyst 5500/5000 Switches
• Configuring Spanning Tree for Catalyst 6500/6000 Switches
• LAN Product Support Pages
• LAN Switching Support Page
• Technical Support & Documentation − Cisco Systems

All contents are Copyright © 1992−2005 Cisco Systems, Inc. All rights reserved. Important Notices and Privacy Statement.

Updated: Jul 12, 2005 Document ID: 5234

Cisco − Understanding and Configuring Spanning Tree Protocol (STP) on Catalyst Switches

You might also like