Cisco CCNA Spanning Tree Protocol (STP)


Spanning Tree Protocols (STP’s) main task is to stop network loops from occurring on your layer-2 network (bridges or switches).

It vigilantly monitors the network to find all links, making sure that no loops occur by blocking any redundant ones.

STP uses the spanning-tree algorithm (STA) to first create a topology database, then search out and destroy redundant links.

With STP running, frames will only be forwarded on the premium, STP-picked links.  All other links will be blocked.


Cisco CCNA Redundant Topology


Some of the problems that can occur with redundant links in a switched / bridge network are as follows:

Broadcast storms: Without some type of loop avoidance, each switch would endlessly flood broadcasts, known as a broadcast storm.

Multiple frame transmissions: Multiple copies of unicast frames may be delivered to a destination host.  This can cause problems if the higher layer protocol is expecting only one copy and cannot handle multiple copies.

MAC database instability: Instability of the MAC table causes copies of the same frame to be delivered to multiple ports.  Data forwarding can be impaired when this happens as the switch is consuming resources.  Remember, MAC address tables are built by examining the source MAC address on a packet received.  The source MAC address is tied to the interface it was received on.  If a loop occurs then the same source MAC address could be seen on multiple interfaces causing instability.

Cisco CCNA Solution: Spanning-Tree Protocol


STP’s main task is to stop network loops from occurring on your layer-2 network (bridges or switches). It vigilantly monitors the network to find all links, making sure that no loops occur by shutting down any redundant links.

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.

Cisco CCNA Spanning-Tree Operations


STP’s job is to find all links in the network and shut down any redundant ones, thereby preventing network loops from occurring.  STP performs this in three steps:

  • •First a root bridge is elected that will preside over network topology decisions.
  • •Root ports are selected on nonroot bridges.
  • •Designated ports are selected on each segment.

Only the best path to the root bridge remains active.  All other paths are blocked, as depicted in the figure where SW Y has it’s 10baseT port blocked as the better path to the root bridge is through the 100baseT port.

Cisco CCNA STP Root Bridge Selection


To determine the root bridge, the priorities of the bridge and the MAC address are combined.  If two switches or bridges happen to have the same priority value, then the MAC address becomes the tie breaker for figuring out which one has the lowest (best) ID.

In the example on the slide above, Switch A has the lowest bridge ID as 0c0011111111 which is lower than Switch B’s bridge ID of 0c0022222222, hence Switch A will become the root bridge.

The following is used to elect a root bridge in a STP topology:

üBridge priority

üBridge ID (combination of priority and Mac address of the bridge)

Note: Since the lowest Bridge ID wins in the case of the bridge priority being the same on multiple switches, you can potentially have your oldest / slowest switch become the root bridge.  This is because the first portion of the MAC address is the organizational unique identifier (OID) and the second portion is essentially a serial number.  Since in a single vendor environment the older serial number typically equates to a older box, then a lower MAC would typically equate to an older / slower box.

A good rule of thumb is to chose a device to be the root bridge and another to be the backup and set the priority on those respective boxes accordingly and not leave things to chance.

Cisco CCNA STP Port States


Five port states of STP protocol:

  • Blocking – A blocked port won’t forward frames; it just listens to Bridge Protocol Data Units (BPDUs).  All ports are in blocking state by default when the switch is powered up.  The purpose of the blocking state is to prevent the use of looped paths.
  • Listening – 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.
  • Learning – 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.
  • Forwarding – The port sends and receives all data frames on the bridged port.
  • Disabled – Port not participating in STP algorithm.

Note: Rapid STP has different states.

Cisco CCNA Spanning-Tree



Root Bridge: Switch C due to being the lowest MAC since all switch priorities are the same

Designated Ports: Port 0 on Switch C and port 1 on Switch A

Nondesignated Ports: Port 1 on Switch B

Root Ports: Port 0 on Switches A and B

Forwarding Ports: All ports on Switch C, ports 0 and 1 on Switch A and port 0 on Switch B

Blocking Ports: Port 1 on Switch B

It is a good idea to set the spanning tree priority of a device.  Otherwise the lowest MAC will become root bridge.  As described on the previous slide, most of the time this turns out to be the oldest piece of equipment on the network.  Sometimes it is unstable, and in this instance can cause instability on the network if ports are in blocking state.

As a best practice, setup the priorities in order that a primary and secondary are chosen based on priority, and no ports are actively blocking.  This way, if the state changes, the port does not have to go through the blocking, listening, learning and forwarding states for each fail-over.  This can still offer sufficient loop protection while significantly reducing the convergence times of the network if designed carefully.

Cisco CCNA Spanning-Tree



Lower priority # à will become the root


Root Bridge: Switch B due to having the lowest priority

Designated Ports: Ports 0 and 1 on Switch B and port 0 on Switch A

Nondesignated Ports: Port 0 on Switch C

Root Ports: Port 1 on switch A, Port 1 on Switch C

Forwarding Ports: All ports on Switch B, ports 0 and 1 on Switch A and port 1 on Switch C

Blocking Port: Port 0 on Switch C