Understand and Configure STP on Catalyst Switches (2024)

    Introduction

    This document describes how to use Spanning Tree Protocol (STP) to ensure that you do not create loops when you have redundant paths in your network.

    Prerequisites

    Requirements

    There are no specific requirements for this document.

    Components Used

    The information in this document is based on these software and hardware versions:

    • Cisco Catalyst 5500/5000 Switches

    • Aconsole cablethat is suitable for the Supervisor Engine in the switch

    • Six Catalyst 5509 Switches

    The spanning tree principles that the document presents are applicable to almost all devices that support STP.

    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, ensure that you understand the potential impact of any command.

    Background Information

    Spanning Tree Protocol (STP) is a Layer 2 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.

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

    • STP and MST(Catalyst 6500/6000 Switches that run Cisco IOS®Software)

    • Configure STP and MST(Catalyst 4500/4000 Switches that run Cisco IOS Software)

    Network Diagram

    This document uses this network setup:

    Understand and Configure STP on Catalyst Switches (1)

    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. If two connected switches run different flavors of STP, they require different controlsto converge. When different flavors are used in the switches, it creates control issues between Blocking and Forwarding states. Therefore, it is recommended to use the same flavors of STP. Consider this network:

    Understand and Configure STP on Catalyst Switches (2)

    In this network, a redundant link is planned between Switch A and Switch B. However, 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:

    Understand and Configure STP on Catalyst Switches (3)

    This information applies to the scenario in theNetwork Diagram:

    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 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.

    Understand and Configure STP on Catalyst Switches (4)

    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 advertisem*nt of its root ID, and accepts the root ID of Switch A.

    Refer toOptional STP Featuresfor more information 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 thebridge 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 theset spantree portfastcommand, on a per-port basis. When you enable theportfastvariable on a port, the port immediately switches from blocking mode to forwarding mode. Enablement ofportfasthelps to prevent timeouts on clients who use Novell Netware or use DHCP in order to obtain an IP address. However, donotuse this command when you have switch-to-switch connection. In this case, the command can result in a loop. The 30- to 60-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.

    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.

    Understand and Configure STP on Catalyst Switches (5)

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

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

      Understand and Configure STP on Catalyst Switches (6)

      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.

    Understand and Configure STP on Catalyst Switches (7)

    Note: The addition or removal of VLANs when STP runs in per-VLAN spanning tree (PVST / PVST+) mode triggers spanning tree recalculation for that VLAN instance and the traffic is disrupted only for that VLAN. The other VLAN parts of a trunk link can forward traffic normally. The addition or removal of VLANs for a Multiple Spanning Tree (MST) instance that exists triggers spanning tree recalculation for that instance and traffic is disrupted for all the VLAN parts of that MST instance.

    Understand and Configure STP on Catalyst Switches (8)

    Note: By default, spanning tree runs on every port. The spanning tree feature cannot be turned off in switches on a per-port basis. Although it is not recommended, you can turn off STP on a per-VLAN basis, or globally on the switch. Extreme care must be taken whenever you disable spanning tree because this creates Layer 2 loops within the network.

    Step-by-Step Instructions

    Complete these steps:

    1. Issue theshow versioncommand in order to display the software version that the switch runs.

      Understand and Configure STP on Catalyst Switches (9)

      Note: All switches run the same software version.

      Switch-15> (enable)show versionWS-C5505 Software, Version McpSW: 4.2(1) NmpSW: 4.2(1)Copyright (c) 1995-1998 by Cisco SystemsNMP S/W compiled on Sep 8 1998, 10:30:21MCP S/W compiled on Sep 08 1998, 10:26:29System Bootstrap Version: 5.1(2)Hardware Version: 1.0 Model: WS-C5505 Serial #: 066509927Mod Port Model Serial # Versions--- ---- ---------- --------- ----------------------------------------1 0 WS-X5530 008676033 Hw : 2.3Fw : 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.

    2. Issue theset spantree root vlan_idcommand in order to set the priority of the switch to 8192 for the VLAN or VLANs that thevlan_id specifies.

      Understand and Configure STP on Catalyst Switches (10)

      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 1VLAN 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 200VLAN 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 201VLAN 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 202VLAN 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 203VLAN 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 204VLAN 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.Switch-15> (enable)

      Theset spantree prioritycommand provides a third method to specify the root switch:

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

      Understand and Configure STP on Catalyst Switches (11)

      Note: In this scenario, all the switches started with cleared configurations. Therefore, 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 theset spantree portfast mod_num/port_num enablecommand in order to configure the PortFast setting on Switches 12, 13, 14, 16, and 17.

      Understand and Configure STP on Catalyst Switches (12)

      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.

      • Port 2/1 connects to Switch 13.

      • Port 2/2 connects to Switch 15.

      • Port 2/3 connects to Switch 16.

      • Ports 3/1 through 3/24 connect to PCs.

      • Ports 4/1 through 4/24 connect to UNIX workstations.

      With this information as a basis, issue theset spantree portfastcommand on ports 3/1 through 3/24 and on ports 4/1 through 4/24:

      Switch-12> (enable)set spantree portfast 3/1-24 enableWarning: 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_idcommand 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. This is the sample command output:

      Switch-15> (enable)show spantree 1VLAN 1spanning-tree enabledspanning-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 8192Designated Root Cost 0Designated Root Port  1/0Root Max Age 20 sec Hello Time 2 sec Forward Delay 15 secBridge ID MAC ADDR 00-10-0d-b1-78-00Bridge ID Priority 8192Bridge 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 theDesignated Rootfor VLAN 1:

      Switch-12> (enable)show spantree 1VLAN 1spanning-tree enabledspanning-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 8192Designated Root Cost 19Designated Root Port 2/3Root Max Age 20 sec Hello Time 2 sec Forward Delay 15 secBridge ID MAC ADDR 00-10-0d-b2-8c-00Bridge ID Priority 32768Bridge Max Age 20 sec Hello Time 2 sec Forward Delay 15 sec

      Understand and Configure STP on Catalyst Switches (13)

      Note: The output of theshow spantree vlan_idcommand for the other switches and VLANs can 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.

    • 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 summary— Provides a summary of connected spanning tree ports by VLAN.

    Troubleshoot

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

    STP Path Cost Automatically Changes When a Port Speed/Duplex Is Changed

    STP calculates the path cost based on the media speed (bandwidth) of the links between switches and the port cost of each port forwarding frame. Spanning tree selects the root port based on the path cost. The port with the lowest path cost to the root bridge becomes the root port. The root port is always in the forwarding state.

    If the speed/duplex of the port is changed, spanning tree recalculates the path cost automatically. A change in the path cost can change the spanning tree topology.

    Refer to theCalculate and Assign Port Costssection ofConfigure Spanning Treefor more information on how to calculate the port cost.

    Troubleshoot Commands

    Understand and Configure STP on Catalyst Switches (14)

    Note: Refer toImportant Information on Debug Commandsbefore you usedebugcommands.

    • 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 summary—Provides a summary of connected spanning tree ports by VLAN.

    • show spantree statistics—Shows spanning tree statistical information.

    • show spantree backbonefast—Displays whether the spanning tree BackboneFast Convergence feature is enabled.

    • show spantree blockedports—Displays only the blocked ports.

    • show spantree portstate—Determines the current spanning tree state of a Token Ring port within a spanning tree.

    • show spantree portvlancost—Shows the path cost for the VLANs on a port.

    • show spantree uplinkfast—Shows the UplinkFast settings.

    Command Summary

    Syntax: show version
    As used in this document: show version
    Syntax: set spantree root [vlan_id]
    As used in this document: set spantree root 1
    set spantree root 1,200-204
    Syntax: set spantree priority [vlan_id]
    As used in this document: set spantree priority 8192 1
    Syntax: set spantree portfast 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

    Related Information

    • Spanning Tree Protocol Problems and Related Design Considerations
    • Switches Support
    Understand and Configure STP on Catalyst Switches (2024)

    FAQs

    What does STP do on a switch? ›

    Spanning Tree Protocol (STP) is a Layer 2 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.

    What is the default mode of STP running on a Cisco Catalyst switch? ›

    The switch supports three spanning-tree modes: PVST+, rapid PVST+, or MSTP. By default, the switch runs the rapid PVST+ protocol on all NNIs and ENIs on which spanning tree is enabled.

    Where should the STP root guard feature be enabled on a switch? ›

    You must enable root guard on all ports where the root bridge must not appear. In a way, you can configure a perimeter around the part of the network where the STP root is able to be located.

    Do unmanaged switches run STP? ›

    STP will help prevent you from getting loops that can be caused by creating more than one path between two devices (Layer 2). When using unmanaged switches (which is something you have) you would not be running STP and this could cause a problem.

    How does STP work step by step? ›

    The STP works in the following three steps: Selecting the root bridge. Selecting the root port. Selecting designated port and non-designated port.

    What is the main purpose of an STP? ›

    The Segmentation, Targeting and Positioning (STP) Model helps you position a product or service to target different groups of customers more efficiently.

    When should you use STP? ›

    STP® Oil Treatment products can be added at any time and are best added at every oil change. They should, however, only be used once per oil change.

    Should STP be enabled? ›

    Switches within the same network need to be enabled for STP before they run the spanning tree algorithm so they can accurately determine which switch should be elected the “root bridge.” This designated root bridge will be responsible for sending configuration bridge protocol data units (BPDUs) along with other ...

    Is STP required to be configured when there is only one switch? ›

    A: Yes. All ports on the Root bridge that are connected to other devices, whether they be other switches or any other network device will become designated ports, since all ports on the Root bridge are designated ports. It depends if you have configured it or not.

    Is STP required to be configured when there is only one switch involved? ›

    It works by forwarding frames toward the root bridge, thus preventing loops. If you connect each switch (bridge) to a separate layer-3 interface on your firewall/router, then you have no need for STP, but if you connect your switches together, then you need to use STP, and it will select a root bridge.

    Should STP be enabled on access point? ›

    1 Answer. In most deployments it is not necessary to configure STP on an access point. However, there are several deployment scenarios where it is advisable. One such scenario I encountered in production when it was biting the network in the proverbial posterior.

    Which switch should be root? ›

    If all switches in a single spanning tree have the same bridge priority, the switch with the lowest MAC address will become the root bridge. In this diagram, Switches D and B comprise the core of the network, Switch A and C are access layer switches.

    How do I enable or disable STP? ›

    Select the network location for which you want to enable or disable STP. Select Wired > Settings > Spanning Tree. Under Spanning Tree Mode, select Disable, STP, or RSTP. Tap Save.

    How do you optimize STP? ›

    Besides choosing the best STP variant, you can also optimize STP by configuring some of its features, such as the root bridge, port roles, and loop guard. For example, you can manually select the root bridge by assigning a lower priority value to the desired switch to improve network performance and stability.

    Does STP need to be enabled? ›

    Switches within the same network need to be enabled for STP before they run the spanning tree algorithm so they can accurately determine which switch should be elected the “root bridge.” This designated root bridge will be responsible for sending configuration bridge protocol data units (BPDUs) along with other ...

    Top Articles
    What does a 609 credit score mean?
    Innovative Narrative Structures in Mystery Writing - ZARA ALTAIR AUTHOR
    Tiny Tina Deadshot Build
    Artem The Gambler
    Hotels Near 625 Smith Avenue Nashville Tn 37203
    Zabor Funeral Home Inc
    Overzicht reviews voor 2Cheap.nl
    Minn Kota Paws
    Sport Clip Hours
    Craigslist Pets Southern Md
    MindWare : Customer Reviews : Hocus Pocus Magic Show Kit
    George The Animal Steele Gif
    R/Afkarena
    24 Hour Walmart Detroit Mi
    Elemental Showtimes Near Cinemark Flint West 14
    ARK: Survival Evolved Valguero Map Guide: Resource Locations, Bosses, & Dinos
    Ratchet & Clank Future: Tools of Destruction
    Jet Ski Rental Conneaut Lake Pa
    Understanding Genetics
    Poe Str Stacking
    Between Friends Comic Strip Today
    Mybiglots Net Associates
    4 Times Rihanna Showed Solidarity for Social Movements Around the World
    CVS Health’s MinuteClinic Introduces New Virtual Care Offering
    Evil Dead Rise Showtimes Near Sierra Vista Cinemas 16
    Bfsfcu Truecar
    Bridgestone Tire Dealer Near Me
    Plasma Donation Racine Wi
    Khatrimmaza
    Flixtor Nu Not Working
    Quality Tire Denver City Texas
    Joplin Pets Craigslist
    How does paysafecard work? The only guide you need
    The 38 Best Restaurants in Montreal
    R&J Travel And Tours Calendar
    Claim loopt uit op pr-drama voor Hohenzollern
    Armageddon Time Showtimes Near Cmx Daytona 12
    SF bay area cars & trucks "chevrolet 50" - craigslist
    Honkai Star Rail Aha Stuffed Toy
    The Horn Of Plenty Figgerits
    White County
    Kjccc Sports
    Large Pawn Shops Near Me
    Actress Zazie Crossword Clue
    Benjamin Franklin - Printer, Junto, Experiments on Electricity
    Haunted Mansion Showtimes Near Millstone 14
    Sams Gas Price San Angelo
    Fine Taladorian Cheese Platter
    FactoryEye | Enabling data-driven smart manufacturing
    Famous Dave's BBQ Catering, BBQ Catering Packages, Handcrafted Catering, Famous Dave's | Famous Dave's BBQ Restaurant
    La Fitness Oxford Valley Class Schedule
    Latest Posts
    Article information

    Author: Barbera Armstrong

    Last Updated:

    Views: 5877

    Rating: 4.9 / 5 (59 voted)

    Reviews: 90% of readers found this page helpful

    Author information

    Name: Barbera Armstrong

    Birthday: 1992-09-12

    Address: Suite 993 99852 Daugherty Causeway, Ritchiehaven, VT 49630

    Phone: +5026838435397

    Job: National Engineer

    Hobby: Listening to music, Board games, Photography, Ice skating, LARPing, Kite flying, Rugby

    Introduction: My name is Barbera Armstrong, I am a lovely, delightful, cooperative, funny, enchanting, vivacious, tender person who loves writing and wants to share my knowledge and understanding with you.