IEEE 802.1D Spanning Tree Protocol (STP) and Rapid Spanning Tree Protocol (RSTP) use the Spanning Tree Algorithm (STA) to decide which switch ports on a network must be put in a blocking state to prevent loops. The Spanning Tree Algorithm designates one switch in the network as the root bridge. The root bridge is considered the reference for all path calculations.
The root bridge is selected through an election process where all switches exchange Bridge Protocol Data Units (BPDUs). The switch with the lowest Bridge ID wins. The Bridge ID is a composite: 16-bit priority (default 32768) + 48-bit MAC address + optional VLAN ID (in PVST+).
| Component | Description | Default/Example Value |
|---|---|---|
| Priority | Configurable value (multiples of 4096) | 32768 |
| MAC Address | Unique hardware ID of the switch | 00:1B:0C:DD:DD:DD |
| Extended System ID | VLAN number (for per-VLAN STP) | 1 (native VLAN) |
Pro Tip (CCNP Level): Manually set priority via spanning-tree vlan 1 priority 4096 on your core switch to ensure consistent root selection and avoid topology changes during failures.
A BPDU is a messaging frame containing a Bridge ID identifying the switch that sent it. The Bridge ID includes a priority value, the sending switch’s MAC address, and an optional extended system ID. The combination of these three values determines the lowest Bridge ID value.
When the Root Bridge is elected, the Spanning Tree Algorithm (STA) calculates the shortest path to the root bridge. Each switch uses the Spanning Tree Algorithm (STA) to decide which ports to block. The Spanning Tree Algorithm (STA) selects the best paths to the root bridge for all switch ports in the broadcast domain.
The spanning-tree algorithm uses cost to determine the shortest path, where cost inversely correlates with bandwidth (higher speed = lower cost). Use 802.1t ‘long’ metrics for speeds >1Gbps to avoid overflow.
| Link Speed | Legacy Cost (802.1D) | Long Cost (802.1t) |
|---|---|---|
| 10 Mbps | 100 | 2,000,000 |
| 100 Mbps | 19 | 200,000 |
| 1 Gbps | 4 | 20,000 |
| 10 Gbps | 2 | 2,000 |
| 100 Gbps | N/A | 200 |
Verify with show spanning-tree vlan 1 to see active costs in your lab.
After determining the most relevant paths to each switch, STA assigns port roles to the participating switch ports. The different port roles are the following:-
- Root ports– The switch ports closest to the root bridge are known as the root ports. The figure below illustrates the root ports of the network switch. If one side of the trunk is a designated port, the other must be a root or alternate port.
- Designated ports—All ports are still permitted to forward data on the network, and root ports are designated ports. Designated ports are chosen on a per-trunk basis. If one side of a trunk is a root port, the other must be a specified port. All ports on the root bridge are designated ports.
- Alternate and backup ports—Alternate ports and backup prevent a loop on the network. These ports are configured to block. Alternate ports are chosen only on trunk links where neither end is a root port.
- Disabled ports– A disabled port is a switch port that is shut down.

FAQs
What is a root port in Spanning Tree Protocol?
In STP, the root port is the switch port with the lowest path cost to the root bridge, ensuring the shortest route for BPDUs. It’s always in forwarding state and unique per non-root switch. On trunk links, it’s opposite a designated port, vital for loop-free topologies in CCNA labs. Verify with ‘show spanning-tree’ commands.
How are designated ports determined in STP?
Designated ports forward traffic on a segment toward the root bridge and are elected based on the lowest root path cost from the sending switch. All ports on the root bridge are designated. This role prevents loops by allowing only one forwarding path per LAN segment, key for stable Ethernet networks.
What is the role of alternate and backup ports?
Alternate ports act as backups on trunk links, blocking to avoid loops while ready for quick failover in RSTP. Backup ports handle shared media redundancy. Both receive superior BPDUs but don’t forward, ensuring redundancy without storms. Essential for resilient designs in CCNP scenarios.
How does path cost influence STP port roles?
Path cost, based on link speed (e.g., higher for slower interfaces), determines the shortest route to the root bridge. STP sums costs along paths; lowest wins for root/designated roles. This algorithm blocks higher-cost ports as alternates, optimizing bandwidth and preventing loops in switched networks.
What happens to disabled ports in STP?
Disabled ports are administratively shut down, excluding them from STP topology—no BPDUs sent/received. They don’t participate in role elections or loop prevention, isolating segments. Reactivate carefully to avoid reconvergence delays; monitor with Cisco IOS for CCNA troubleshooting practice.
