Spanning-Tree-Protocol-STP-Overview
Spanning-Tree-Protocol-STP-Overview
When switches are first turned on, they will send configuration BPDUs containing their BIDs, with each
switch initially believing themselves to be the root bridge. However, when a switch receives a BPDU with a
superior (lower value) BID, that switch will stop originating configuration BPDUs and will instead relay these
superior BPDUs to its neighboring switches.
Once a root bridge has finally been announced, a second election process begins to determine the "root
port" selection process (the port on a switch that will forward frames to the root bridge). This process will
follow the steps below until a root port is elected:
1. A switch port receives superior BPDUs from another switch and identifies that switch as the root bridge.
2. The port with the lowest root path is selected as the root port, if possible.
3. If the path cost is the same, the switch will select the port with the lowest sender BID as the selected
root port.
4. If the sender BID is the same (usually the same switch), the port with the lowest physical port number
on the sending switch will be selected as the root bridge (as the final tie-breaker).
Single Switches
1. A switch port receiving superior BPDUs. Port 1 and 2 receive the same superior BPDU from Switch
1, therefore, further steps are needed to determine the root port. Port 3 on Switch 2 does not qualify
because it's receiving BPDUs from Switch 3.
2. The port with the lowest root path cost. We can see Port 1 and 2 have equal path costs, so we still
have a tie.
3. The port with the lowest sender BID. Again, Port 1 and 2 have the same BID (that of Switch 1), and
therefore the final step will be used to determine the root port.
4. The lowest port number of the sending switch. Port 1 of Switch 2 is connected to the lowest port
number on Switch 1 (Port 1) and is therefore elected the root port for Switch 2.
The outcome of the STP Election Process can be a little different when utilizing Stacking Technology. Let's
follow the process for Switch 2 again below, but with the following in consideration:
1. A switch port receiving superior BPDUs. Port 1 and 2 receive the same superior BPDU from Switch
1, therefore, further steps are needed to determine the root port.
2. The port with the lowest root path cost. We can see Port 1 and 2 have equal path costs, so we still
have a tie.
3. The port with the lowest sender BID. Again, Port 1 and 2 have the same BID (that of Switch 1), and
therefore the final step will be used to determine the root port.
4. The lowest port number of the sending switch. Port 1 of Switch 2 is connected to Port 1 of the
Member switch and Port 2 is connected to Port 1 of the Active switch. As we understand that the Active
switch will send Port IDs lower than that of the Member switch in its BPDUs, Port 2 of Switch 2 is
elected root port.
A Topology Change Notification (TCN) can trigger the STP election process. When a switch detects a
change in the network topology, such as a trunk port transitioning to the forwarding state or going up or
down, it sends a TCN to the root bridge. The root bridge then acknowledges the TCN, prompting all
switches to update their MAC address tables and recalculate the best path to the root bridge.
For MS390/Catalyst switches, the outcome of the Stack Election process does not influence how Switch
Stack Port IDs are incremented. As such, a Member switch may send BPDU's with a lower Port ID to that
of the Active Switch. It is not unexpected to see ports connected to a Member switch to therefore be elected
root port if reaching the 4th tiebreaker.
Rapid spanning tree protocol (RSTP) is as its name suggests, a faster transition to a port-forwarding state.
Unlike STP, which has five switchport states, RSTP has only three: discarding, learning, and forwarding.
Disabled - The result of an administrative command that will disable the port.
Discarding - When a device is connected, the port will first enter the discarding state.
Learning - The switch will receive a superior BPDU, will stop sending its own BPDUs, and will relay the
superior BPDUs.
Forwarding - The port is forwarding traffic.
Root - Ports on non-root switches with best cost path to root bridge. These ports forward data to the
root bridge.
Designated- Ports on root and designated switches. All ports on the root bridge will be designated.
Alternate-Receives BPDUs from another switch but remains in a blocked state.
Backup- Receives BPDUs from its own switch but remains in a blocked state. You are not likely to see
this in a production environment unless hubs are used.
In RSTP, the election process is the same as STP, except the blocked port is split into two new port roles:
alternate and backup.
Alternate
An alternate port receives BPDUs from another switch but remains in a blocked state. For example, let's
say a switch has two paths to the root bridge. It will elect one of the two ports as a root port and the other
will become an alternate port. If at any time the root port fails, this redundant path4the alternate port4will
become the new root port.
Backup
A backup port receives BPDUs from its own switch but remains in a blocked state. For example, If a switch
has two ports connecting to different switches, then one port will be elected as a root port and the other will
become the backup port.
STP RSTP
Blocking Discarding
Listening Discarding
Learning Learning
Forwarding Forwarding
For information on how to configure spanning tree on MS switches, check out our article on Configuring
Spanning Tree on Meraki Switches.