This article provides more information about the Spanning Tree topology and its related terminologies to aid in troubleshooting Spanning Tree issues. It is part of KB22774 - Resolution Guide - EX - Troubleshoot Spanning Tree Protocol (STP) [juniper.net].
It is important to collect the network topology and label the key components, which will prove to be useful for troubleshooting when an issue occurs.
Brief definitions of the network topology components are given below:
Root Bridge
The Root Bridge (switch) is a special bridge, which is at the top of the Spanning Tree. The other non-root switches are then branched out from the root switch, connecting to other switches in the Local Area Network (LAN).
All bridges (switches) are assigned a numerical value called bridge priority. The bridge priority value is used to find the Bridge ID.
A bridge ID is a combination of two values:
Switch Priority, which is a numerical value defined by IEEE 802.1D and is equal to 32,768 by default
MAC Address of the switch
As a whole, a Bridge ID is the string obtained by appending the MAC address of the switch to the Switch Priority.
If all the switches in your LAN are configured with the default Switch Priority (32,768), the Switch MAC address will become the decisive factor in electing the Root Bridge (Switch). The switch with the lowest Bridge ID is then elected as the Root Bridge (Switch). The above example shows four switches with the default priority value. In the Sample Network Topology image, Switch A is the Root Bridge since it has the lowest MAC address.
To identify the Root Bridge in your network, refer to KB22777 - [EX] Identify the Root Bridge in a Spanning Tree (STP) network [juniper.net].
Edge Port
A port on the switch that is connected to a LAN that has no other bridges attached is an edge port. These edge ports transition directly to the forwarding state. RSTP monitors the port continuously for BPDUs (Bridge Protocol Data Units) in case a bridge is connected. Edge ports do not participate in Spanning Tree. RSTP can also be configured to automatically detect edge ports.
To configure an interface as an edge port on the switch, issue the following command:
user@switch# set protocols rstp interface <interface-name> edge
The example below shows the edge port configuration for interface ge-0/0/0:
user@switch# set protocols rstp interface ge-0/0/0 edge
Non-Edge Port
Non-edge ports are ports on the switch that participate in the Spanning Tree algorithm. These non-edge ports generate Topology Changes (TCs) on the network. As soon as the bridge detects a BPDU being received on an edge port, the port becomes a non-edge port.
All the interfaces shown in the sample diagram are non-edge ports.
Bridge Protocol Data Unit (BPDU)
BPDUs are data messages in a LAN that use a Spanning Tree Protocol and are exchanged between switches. These BPDU data messages are information about ports, MAC addresses, priorities, and port costs. They make sure that the data reaches the intended switch. BPDU messages are exchanged across different Spanning Tree Protocol enabled bridges to detect loops in a network topology. These layer 2 loops are cleared by shutting down certain switch interfaces and enabling redundant switch ports in a backup state or blocked state.
Port Types
The root port is responsible for forwarding data to the Root Bridge.
The alternate port is a standby port for the root port. When a root port goes down, the alternate port becomes the active root port.
The designated port forwards data to the downstream network segment or device.
For more Spanning Tree definitions, refer to Spanning-Tree Protocol Overview.
2020-08-19: Updated links
2022-05-18: Added sample topologies for MSTP and VSTP including graphic; added definitions for port roles as well as simplified terminology and port states; updated links; added QFX because the platform can also make use of this