what is spanning tree used for

what is spanning tree used for

Introduction

Spanning Tree Protocol (STP) is a Layer 2 protocol that runs on bridges and switches. The specification for STP is IEEE 802.1D. The primary goal of STP is to make sure that you don’t create loops when you’ve gotten redundant paths in your community. Loops are lethal to a community.

Conditions

Necessities

There aren’t any particular necessities for this doc.

You're reading: what is spanning tree used for

Elements Used

Though this doc makes use of Cisco Catalyst 5500/5000 Switches, the spanning tree ideas that the doc presents are relevant to nearly all gadgets that help STP.

For the examples, this doc used:

  • A console cable that’s appropriate for the Supervisor Engine within the change

  • Six Catalyst 5509 Switches

The knowledge on this doc was created from the gadgets in a particular lab atmosphere. All the gadgets used on this doc began with a cleared (default) configuration. In case your community is reside, just be sure you perceive the potential affect of any command.

Background Principle

The configurations on this doc apply to Catalyst 2926G, 2948G, 2980G, 4500/4000, 5500/5000, and 6500/6000 Switches that run Catalyst OS (CatOS). Refer to those paperwork for data on the configuration of STP on different change platforms:

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

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

Community Diagram

This doc makes use of this community setup:

5-a.gif

Ideas

STP runs on bridges and switches which are 802.1D-compliant. There are completely different flavors of STP, however 802.1D is the preferred and broadly carried out. You implement STP on bridges and switches with a view to forestall loops within the community. Use STP in conditions the place you need redundant hyperlinks, however not loops. Redundant hyperlinks are as necessary as backups within the case of a failover in a community. A failure of your main prompts the backup hyperlinks in order that customers can proceed to make use of the community. With out STP on the bridges and switches, such a failure may end up in a loop. If two linked switches run completely different flavors of STP, they require completely different timings to converge. When completely different flavors are used within the switches, it creates timing points between Blocking and Forwarding states. Subsequently, it’s endorsed to make use of the identical flavors of STP. Think about this community:

On this community, a redundant hyperlink is deliberate between Swap A and Swap B. Nevertheless, this setup creates the opportunity of a bridging loop. For instance, a broadcast or multicast packet that transmits from Station M and is destined for Station N merely continues to flow into between each switches.

Nevertheless, when STP runs on each switches, the community logically seems like this:

5-c.gif

This data applies to the situation within the Community Diagram:

  • Swap 15 is the spine change.

  • Switches 12, 13, 14, 16, and 17 are switches that connect to workstations and PCs.

  • The community defines these VLANs:

    • 1

    • 200

    • 201

    • 202

    • 203

    • 204

  • The VLAN Trunk Protocol (VTP) area title is STD-Doc.

With a view to present this desired path redundancy, in addition to to keep away from a loop situation, STP defines a tree that spans all of the switches in an prolonged community. STP forces sure redundant knowledge paths right into a standby (blocked) state and leaves different paths in a forwarding state. If a hyperlink within the forwarding state turns into unavailable, STP reconfigures the community and reroutes knowledge paths via the activation of the suitable standby path.

Description of the Expertise

With STP, the secret’s for all of the switches within the community to elect a root bridge that turns into the focus within the community. All different choices within the community, equivalent to which port to dam and which port to place in forwarding mode, are produced from the angle of this root bridge. A switched atmosphere, which is completely different from a bridge atmosphere, almost definitely offers with a number of VLANs. Whenever you implement a root bridge in a switching community, you normally check with the basis bridge as the basis change. Every VLAN should have its personal root bridge as a result of every VLAN is a separate broadcast area. The roots for the completely different VLANs can all reside in a single change or in varied switches.

Observe: The choice of the basis change for a selected VLAN is essential. You may select the basis change, or you possibly can let the switches resolve, which is dangerous. If you don’t management the basis choice course of, there might be suboptimal paths in your community.

All of the switches alternate data to be used within the root change choice and for subsequent configuration of the community. Bridge protocol knowledge items (BPDUs) carry this data. Every change compares the parameters within the BPDU that the change sends to a neighbor with the parameters within the BPDU that the change receives from the neighbor.

Within the STP root choice course of, much less is healthier. If Swap A advertises a root ID that may be a decrease quantity than the basis ID that Swap B advertises, the data from Swap A is healthier. Swap B stops the commercial of its root ID, and accepts the basis ID of Swap A.

Discuss with Optionally available STP Options for extra details about a number of the optionally available STP options, equivalent to:

STP Operation

Activity

Conditions

Earlier than you configure STP, choose a change to be the basis of the spanning tree. This change doesn’t should be probably the most highly effective change, however select probably the most centralized change on the community. All knowledge circulate throughout the community is from the angle of this change. Additionally, select the least disturbed change within the community. The spine switches typically function the spanning tree root as a result of these switches sometimes don’t join to finish stations. Additionally, strikes and modifications throughout the community are much less more likely to have an effect on these switches.

After you resolve on the basis change, set the suitable variables to designate the change as the basis change. The one variable that you should set is the bridge precedence. If the change has a bridge precedence that’s decrease than all the opposite switches, the opposite switches robotically choose the change as the basis change.

Purchasers (finish stations) on Swap Ports

You may as well challenge the set spantree portfast command, on a per-port foundation. Whenever you allow the portfast variable on a port, the port instantly switches from blocking mode to forwarding mode. Enablement of portfast helps to stop timeouts on shoppers who use Novell Netware or use DHCP with a view to acquire an IP deal with. Nevertheless, do not use this command when you’ve gotten switch-to-switch connection. On this case, the command may end up in a loop. The 30- to 60-second delay that happens through the transition from blocking to forwarding mode prevents a temporal loop situation within the community if you join two switches.

Depart most different STP variables at their default values.

Guidelines of Operation

This part lists guidelines for the way STP works. When the switches first come up, they begin the basis change choice course of. Every change transmits a BPDU to the straight linked change on a per-VLAN foundation.

Because the BPDU goes out via the community, every change compares the BPDU that the change sends to the BPDU that the change receives from the neighbors. The switches then agree on which change is the basis change. The change with the bottom bridge ID within the community wins this election course of.

Observe: Do not forget that one root change is recognized per-VLAN. After the basis change identification, the switches adhere to those guidelines:

  • STP Rule 1—All ports of the basis change have to be in forwarding mode.

    Observe: In some nook circumstances, which contain self-looped ports, there’s an exception to this rule.

    Subsequent, every change determines the very best path to get to the basis. The switches decide this path by a comparability of the data in all of the BPDUs that the switches obtain on all ports. The change makes use of the port with the least quantity of knowledge within the BPDU with a view to get to the basis change; the port with the least quantity of knowledge within the BPDU is the basis port. After a change determines the basis port, the change proceeds to rule 2.

  • STP Rule 2—The basis port have to be set to forwarding mode.

    As well as, the switches on every LAN phase talk with one another to find out which change is greatest to make use of with a view to transfer knowledge from that phase to the basis bridge. This change known as the designated change.

  • STP Rule 3—In a single LAN phase, the port of the designated change that connects to that LAN phase have to be positioned in forwarding mode.

  • STP Rule 4—All the opposite ports in all of the switches (VLAN-specific) have to be positioned in blocking mode. The rule solely applies to ports that connect with different bridges or switches. STP doesn’t have an effect on ports that connect with workstations or PCs. These ports stay forwarded.

    Observe: The addition or elimination of VLANs when STP runs in per-VLAN spanning tree (PVST / PVST+) mode triggers spanning tree recalculation for that VLAN occasion and the site visitors is disrupted just for that VLAN. The opposite VLAN components of a trunk hyperlink can ahead site visitors usually. The addition or elimination of VLANs for a A number of Spanning Tree (MST) occasion that exists triggers spanning tree recalculation for that occasion and site visitors is disrupted for all of the VLAN components of that MST occasion.

Observe: By default, spanning tree runs on each port. The spanning tree function can’t be turned off in switches on a per-port foundation. Though it’s not beneficial, you possibly can flip off STP on a per-VLAN foundation, or globally on the change. Excessive care ought to be taken everytime you disable spanning tree as a result of this creates Layer 2 loops throughout the community.

Step-by-Step Directions

Full these steps:

  1. Concern the present model command with a view to show the software program model that the change runs.

    Observe: All switches run the identical software program model.

    present model

    On this situation, Swap 15 is your best option for the basis change of the community for all of the VLANs as a result of Swap 15 is the spine change.

  2. Concern the set spantree root vlan_id command with a view to set the precedence of the change to 8192 for the VLAN or VLANs that the vlan_id specifies.

    Observe: The default precedence for switches is 32768. Whenever you set the precedence with this command, you pressure the choice of Swap 15 as the basis change as a result of Swap 15 has the bottom precedence.

    set spantree root 1set spantree root 200set spantree root 201set spantree root 202set spantree root 203set spantree root 204

    The shorter model of the command has the identical impact, as this instance reveals:

    set spantree root 1,200-204

    The set spantree precedence command supplies a 3rd methodology to specify the basis change:

    set spantree precedence 8192 1

    Read more: what is mogra called in english

    Observe: On this situation, all of the switches began with cleared configurations. Subsequently, all of the switches began with a bridge precedence of 32768. In case you are not sure that each one the switches in your community have a precedence that’s better than 8192, set the precedence of your required root bridge to 1.

  3. Concern the set spantree portfast mod_num/port_num allow command with a view to configure the PortFast setting on Switches 12, 13, 14, 16, and 17.

    Observe: Solely configure this setting on ports that connect with workstations or PCs. Don’t allow PortFast on any port that connects to a different change.

    This instance solely configures Swap 12. You may configure different switches in the identical method. Swap 12 has these port connections:

    • Port 2/1 connects to Swap 13.

    • Port 2/2 connects to Swap 15.

    • Port 2/3 connects to Swap 16.

    • Ports 3/1 via 3/24 connect with PCs.

    • Ports 4/1 via 4/24 connect with UNIX workstations.

    With this data as a foundation, challenge the set spantree portfast command on ports 3/1 via 3/24 and on ports 4/1 via 4/24:

    set spantree portfast 3/1-24 allowset spantree portfast 4/1-24 allow

  4. Concern the present spantree vlan_id command with a view to confirm that Swap 15 is the basis of all the suitable VLANs.

    From the output from this command, examine the MAC deal with of the change that’s the root change to the MAC deal with of the change from which you issued the command. If the addresses match, the change that you’re in is the basis change of the VLAN. A root port that’s 1/0 additionally signifies that you’re on the root change. That is the pattern command output:

    present spantree 1Designated Root 00-10-0d-b1-78-00 !- That is the MAC deal with of the basis change for VLAN 1. Designated Root Precedence 8192 1/0Bridge ID MAC ADDR 00-10-0d-b1-78-00 Bridge ID Precedence 8192

    This output reveals that Swap 15 is the designated root on the spanning tree for VLAN 1. The MAC deal with of the designated root change, 00-10-0d-b1-78-00, is similar because the bridge ID MAC deal with of Swap 15, 00-10-0d-b1-78-00. One other indicator that this change is the designated root is that the designated root port is 1/0.

    On this output from Swap 12, the change acknowledges Swap 15 because the Designated Root for VLAN 1:

    present spantree 1IEEEDesignated Root !- That is the MAC deal with of the basis change for VLAN 1. Designated Root Precedence 8192Bridge ID MAC ADDR 00-10-0d-b2-8c-00 Bridge ID Precedence 32768

    Observe: The output of the present spantree vlan_id command for the opposite switches and VLANs also can point out that Swap 15 is the designated root for all VLANs.

Confirm

This part supplies data you need to use to verify that your configuration works correctly.

  • present spantree vlan_id —Reveals the present state of the spanning tree for this VLAN ID, from the angle of the change on which you challenge the command.

  • present spantree abstract —Offers a abstract of linked spanning tree ports by VLAN.

Troubleshoot

This part supplies data you need to use to troubleshoot your configuration.

STP Path Price Mechanically Modifications When a Port Pace/Duplex Is Modified

STP calculates the trail price primarily based on the media pace (bandwidth) of the hyperlinks between switches and the port price of every port forwarding body. Spanning tree selects the basis port primarily based on the trail price. The port with the bottom path price to the basis bridge turns into the basis port. The basis port is at all times within the forwarding state.

If the pace/duplex of the port is modified, spanning tree recalculates the trail price robotically. A change within the path price can change the spanning tree topology.

Discuss with the Calculating and Assigning Port Prices part of Configuring Spanning Tree for extra data on tips on how to calculate the port price.

Troubleshoot Instructions

Observe: Discuss with Essential Info on Debug Instructions earlier than you utilize debug instructions.

  • present spantree vlan_id —Reveals the present state of the spanning tree for this VLAN ID, from the angle of the change on which you challenge the command.

  • present spantree abstract —Offers a abstract of linked spanning tree ports by VLAN.

  • present spantree statistics —Reveals spanning tree statistical data.

  • present spantree backbonefast —Shows whether or not the spanning tree BackboneFast Convergence function is enabled.

  • present spantree blockedports —Shows solely the blocked ports.

  • present spantree portstate —Determines the present spanning tree state of a Token Ring port inside a spanning tree.

  • present spantree portvlancost —Reveals the trail price for the VLANs on a port.

  • present spantree uplinkfast —Reveals the UplinkFast settings.

Command Abstract

Syntax: present model As used on this doc: present model Syntax: set spantree root [vlan_id] As used on this doc: set spantree root 1 set spantree root 1,200-204 Syntax: set spantree precedence [vlan_id] As used on this doc: set spantree precedence 8192 1 Syntax: set spantree portfast mod_num/port_num disable As used on this doc: set spantree portfast 3/1-24 allow Syntax: present spantree [vlan_id] As used on this doc: present spantree 1

Read: what is the difference between smooth er and rough er

Associated Info

  • Spanning Tree Protocol Issues and Associated Design Issues
  • Understanding Spanning-Tree Protocol Topology Modifications
  • Switches Help
  • Technical Help & Documentation – Cisco Programs