+91 90691 39140 | +1 253 214 3115 | info@hub4tech.com | hub4tech

Spanning Tree Protocol (STP)

Command for STP

Switch # config terminal

Switch (config) # spanning-tree vlan 1 root primary

Loop avoidance

If multiple connections between switches are created for redundancy purposes, network loops can occur. Spanning Tree Protocol (STP) is used to stop network loops while still permitting redundancy.

Spanning Tree Terms

    Root Bridge

    Theroot bridgeis the bridge with the best bridge ID. With STP, the key is forall 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 is to be blocked and which portis to be put in forwarding mode—are made from the perspective of this root bridge.


    All the switches exchange information to use in the selection of the root switch as well as in subsequent configuration of the network. Each switch compares the parameters in the Bridge Protocol Data Unit (BPDU) that it sends to one neighbor with the one that it receives from another neighbor.

    Bridge ID

    The bridge ID is how STP keeps track of all the switches in the network. It is determined by a combination of the bridge priority (32,768 by default on all Cisco switches) and the base MAC address. The bridge with the lowest bridge ID becomes the root bridge in the network.

    Nonroot bridges

    These are all bridges that are not the root bridge. Nonroot bridges exchange BPDUs with all bridges and update the STP topology database on all switches, preventing loops and providing a measure of defense against link failures.

    Port cost

    Port cost determines the best path when multiple links are used between two switches and none of the links is a root port. The cost of a link is determined by the bandwidth of a link.

    Root port

    The root port is always the link directly connected to the root bridge, or the shortest path to the root bridge. If more than one link connects to the root bridge, then a port cost is determined by checking the bandwidth of each link. The lowest-cost port becomes the root port.If multiple links have the same cost, the bridge with the lower advertising bridge ID is used. Since multiple links can be from the same device, the lowest port number will be used.

    Designated port

    A designated port is one that has been determined as having the best(lowest) cost. A designated port will be marked as a forwarding port.

    Non-designated port

    A non-designated port is one with a higher cost than the designated port. Non-designated ports are put in blocking mode they are not forwarding ports.

    Forwarding port

    A forwarding port forwards frames.

    Blocked port

    A blocked port is the port that, in order to prevent loops, will not forward frames. However, a blocked port will always listen to frames.

Spanning Tree Operations

    Selecting the Root Bridge

    The bridge ID is used to elect the root bridge in the STP domain and to determine the root port for each of the remaining devices in the STP domain. This ID is 8 bytes long and includes both the priority and the MAC address of the device. The default priority on all devices running the IEEE STP version is 32,768.To determine the root bridge, you combine the priority of each bridge with its MAC address. If two switches or bridges happen to have the same priority value, the MAC address becomes the tiebreaker for figuring out which one has the lowest (best) ID.

Spanning-Tree Port States

The ports on a bridge or switch running STP can transition through five different states:

    A blocked port won’t forward frames; it just listens to BPDUs. The purpose of the blocking state is to prevent the use of looped paths. All ports are in blocking state by default when the switch is powered up.


    The port listens to BPDUs to make sure no loops occur on the network before passing data frames. A port in listening state prepares to forward data frames without populating the MAC address table.


    The switch port listens to BPDUs and learns all the paths in the switched network.A port in learning state populates the MAC address table but doesn’t forward data frames. Forward delay means the time it takes to transition a port from listening to learning mode,which is set to 15 seconds by default and can be seen in the show spanning-tree output.


    The port sends and receives all data frames on the bridged port. If the port is stilla designated or root port at the end of the learning state, it enters the forwarding state.


    A port in the disabled state (administratively) does not participate in the frame forwarding or STP. A port in the disabled state is virtually nonoperational.

    Switches populate the MAC address table in learning and forwardingmodes only.Switch ports are most often in either the blocking or forwarding state. A forwarding portis one that has been determined to have the lowest (best) cost to the root bridge. But when andif the network experiences a topology change (because of a failed link or because someoneadds in a new switch), you’ll find the ports on a switch in listening and learning states. Blocking ports is a strategy for preventing network loops. Once a switchdetermines the best path to the root bridge, all other redundant ports will be in blocking mode.

    Blocked ports can still receive BPDUs—they just don’t send out any frames.


    Convergence occurs when all ports on bridges and switches have transitioned to either forwarding or blocking modes. No data will be forwarded until convergence is complete. And before data can begin being forwarded again, all devices must be updated. Convergence is truly important because it ensures that all devices have the same database. It usually takes 50 seconds to go from blocking to forwarding mode

Is it Helpful?
Copyright ©2015 Hub4Tech.com, All Rights Reserved. Hub4Tech™ is registered trademark of Hub4tech Portal Services Pvt. Ltd.
All trademarks and logos appearing on this website are the property of their respective owners.