How Spanning Tree Protocol (STP) Manages Network Changes

By Edward Tetz

What happens when you connect a new hub or switch to a Spanning Tree Protocol (STP) mapped network? For this example a hub was connected a hub to a port on both switch 11:99 and switch 77:22. A hub was used because it has no network intelligence.


The net effect is actually the same as directly connecting these two switches with a standard network cable; I have created a loop on the network through switches 11:99, 11:22, 55:22, and 77:22. The hub operates at Layer 1 and does not know anything about Layer 2 or STP, so the hub treats the links of both of the ports, which were just connected as active and will happily pass data back and forth through this connection.

The switches, on the other hand, do not treat this connection as active. Anytime an interface or port has its state changed to Up because either you connect a device or issue a no shutdown command on the interface, a switch follows a strict process, placing the port into one of the four STP port states.

STP Port States
State Description
Blocking If there is a loop after STP topology is learned and known, a
port is placed in Blocking state to prevent the loop from being
detrimental to the network.
Listening When a port’s state changes to Up, it is placed in a
Listening state, which allows it to process and forward BPDU data,
but it will drop all other data that it sees.
Learning After listening, if the switch decides that the connection did
not cause a loop, it learns what addresses are on the network
segment and adds them to its address database to prevent some of
the flooding that would otherwise take place on the switch.
Forwarding If no loops are caused by the interface, any data going to or
from that interface is forwarded as normal on a switch.

Here is what happens when a port’s state changes to Up:

  1. Each switch to which the hub has been connected (switches 11:99 and 77:22) notices that the link state of one of their ports has changed to Up.

    Each switch puts the newly linked port in Listening state, which means that it sees and forwards BPDU frames, but does not pass other traffic. At this time, each switch does not know if this new link will create a loop on the network.

  2. After a delay of 30 seconds, if the newly linked port does not see any BPDUs, or if the result of those BPDUs does not indicate a loop, the port goes into Learning state for 15 seconds and then transitions to Forwarding state.

    In this case, each switch 11:99 will have sent BPDUs on the port to which the hub is connected and switch 77:22 will have seen the BPDU frames, and vice-versa. Because of seeing each other’s BPDUs, these switches will know that they are connected to each other and are creating a loop.

    With this knowledge, they will start the process of calculating the path cost to the root bridge, which in this is a case of equal cost paths to Root Bridge; the path from each switch, through the hub will pass through two other switches.

    Because there are equal path costs, the tie is solved by designating the lowest priority switch as a Designated Port and blocking on the other port, as shown in the following figure. With the assignment of a new Root Port, Designated Port, or identification a new Root Bridge, a change has been made to the STP structure on the network.

    Any change to the STP structure on the network is called a topology change, and the layout of the STP structure is called the STP topology.


In the previous figure, an interface problem was created in switch 11:55. The problem was introduced by either typing the shutdown command in the interface or unplugging the cable; either way, the state of the port has changed to Down.

Suddenly, the other devices connected to switch 55:11 do not have a path to the rest of the network as they were using that inter-switch connection and the other inter-switch connection is in a Blocking state. The following process occurs:

  1. Switch 55:11 detects a change on an interface or notices that the BPDU data stops showing up.

    Because of this the switch will flood the change in its BPDU frames and send them out through all switch ports, including the Blocking Port that it knew had a connection to the rest of the network at one time.

  2. In the review of the topology, switch 55:11 actually announces via its BPDU frame that a topology change has occurred.

    The announcement is made by sending a Topology Change Notification (TCN) BPDU. This data goes directly to the Root Bridge, which sends BPDU updates to the rest of the network. Because of this topology change, a few things happen:

    1. Switch 55:11 takes the port on Segment A (see following figure) and places it in Forwarding state, after identifying this action as the way to correct the isolation it is undergoing.

    2. The Root Bridge receives notification of the change.

    3. Other switches on the network receive notification of the change.


This activation process happens quickly after a failure is noticed, but detecting the failure can take several seconds. The delay in detecting a failure is because the switch should not have received several of the expected BPDU frames over the link before transitioning the relevant ports from Blocking to Forwarding.

Even with this small delay, which may create a problem for some of your network-based applications, the corrective action taken by STP is much faster than your locating the interface at issue and establishing the links manually.