Spanning Tree Port Roles
1. Root Bridge Elected
In the previous course, we configured our topology so that SW1 was elected as the Root Bridge, based on its lowest Bridge ID (32769:AABB.CCDD.EE01
). With the Root Bridge now established, the next step is to assign roles to each port in the switches to ensure the topology remains loop-free and operates efficiently.

2. Identify Root Ports
The second step in the process is to elect the Root Ports. Each non-root switch selects its Root Port—the single port that provides the most efficient path to the Root Bridge.
But you might ask, how does a switch decide which port is the best path to the Root Bridge?
It’s the Root Path Cost that provides this critical information.
What is the Root Path Cost?
The Root Path Cost is the metric used to determine the shortest and most efficient path to the Root Bridge. It is calculated by summing the individual port costs of all the links along the path to the Root Bridge.
Default Port Cost Values
The cost of a port depends on the speed of the link it connects to. The IEEE 802.1D standard defines the following default values:
Link Speed | Port Cost |
---|---|
10 Gbps | 2 |
1 Gbps | 4 |
100 Mbps | 19 |
10 Mbps | 100 |
These values are cumulative, meaning the total cost of a path is the sum of the costs for all links in the path. Lower Path Costs are always preferred, ensuring that STP selects the most efficient route.
Note: Port costs can be manually configured by network administrators to influence the topology and enforce specific paths.
Topology Overview with Path Costs
The following diagram illustrates the Path Costs associated with each interface in the topology:

Electing the Root Port
The Root Port is the port on each non-root switch that offers the shortest path to the Root Bridge.
The election process follows these steps:
- Lowest Path Cost: The port with the lowest cumulative Path Cost to the Root Bridge becomes the Root Port.
- Tiebreaker – Lowest Sender Bridge ID: If two ports have the same Path Cost, the port connected to the switch with the lowest Bridge ID is selected.
- Tiebreaker – Lowest Port ID: If the Bridge IDs are identical, the port with the lowest Port ID is chosen.
Root Port Election in Our Topology
SW2:
- G0/0 connects directly to SW1 (the Root Bridge) with a Path Cost of 4.

- G0/1 connects to SW3 → SW1. This indirect path has a total Path Cost of 8 (4 for SW2 → SW3 and 4 for SW3 → SW1).

- G0/0 is selected as the Root Port because it provides the shortest Path Cost to the Root Bridge.
SW3:
- G0/0 connects directly to SW1 (the Root Bridge) with a Path Cost of 4.

- G0/1 connects to SW2, which is already connected to the Root Bridge via its Root Port (G0/0). This indirect path has a total Path Cost of 8 (4 for SW3 → SW2 and 4 for SW2 → SW1).

G0/0 is selected as the Root Port because it provides the shortest Path Cost to the Root Bridge.
Final Summary of Root Port Election:

- SW1 (Root Bridge): No Root Port.
- SW2: G0/0 is the Root Port (Path Cost: 4).
- SW3: G0/1 is the Root Port (Path Cost: 4, direct connection to SW1).
3. Elect Designated Ports
The third step in Spanning Tree Protocol (STP) is to elect the Designated Ports for each network segment. A Designated Port is responsible for forwarding traffic on the segment toward the Root Bridge.
Every segment has one Designated Port, ensuring efficient traffic flow and keeping the network connected.
Case 1 : Designated Ports on the Root Bridge
All ports on the Root Bridge are automatically Designated Ports. This is because the Root Bridge has the lowest cost to itself and serves as the central point for traffic forwarding.
Example:
In our topology:

All ports on SW1 (the Root Bridge) are Designated Ports.
Case 2 : Designated Port When There is a Root Port
On a segment where one switch has a Root Port, the other switch’s port on that segment becomes the Designated Port.
Example: Adding SW4

Let’s imagine a new switch, SW4, is added to the topology and connected to SW3 via G0/2. In this case:
- SW4’s G0/0 becomes its Root Port, as it provides the shortest path to the Root Bridge (via SW3 → SW1).
- The port at the opposite end of the link, SW3’s G0/2, automatically becomes the Designated Port for that segment.
Case 3: Designated Port When There is No Root Port
When a network segment connects two switches, and neither switch has a Root Port, the Spanning Tree Protocol (STP) must elect a Designated Port for that segment.
Election Process
The election of the Designated Port follows these rules:
- Lowest Path Cost: The port on the switch with the lowest cumulative Path Cost to the Root Bridge becomes the Designated Port.
- Tiebreaker – Lowest Bridge ID: If both switches have the same Path Cost, the switch with the lower Bridge ID wins.
- Tiebreaker – Lowest Port ID: If the Bridge IDs are identical, the port with the lowest Port ID is selected.
Example: Designated Port Between SW2 and SW3
Let’s analyze the segment between SW2 and SW3:

- Neither switch has a Root Port on this segment.
- Both switches have the same Path Cost to the Root Bridge.
- SW2 has a lower Bridge ID than SW3.
- Therefore, SW2’s G0/1 becomes the Designated Port

Case 4 : Designated Ports Connected to End Devices
Ports arethat connect to end devices, such as PCs, servers, or other hosts, are always Designated Ports. These ports must forward traffic to ensure proper communication between the devices and the rest of the network.
Example:
In our topology:

- SW2’s G0/2 and G0/3, which connect to PCs or end devices, are automatically Designated Ports.
Summary of Designated Ports
- All ports on the Root Bridge are Designated Ports.
- If one end of a segment has a Root Port, the other end becomes the Designated Port.
- On segments without a Root Port, the Designated Port is elected based on the first the Path Cost, then Bridge ID and after if their is a tie Port ID.
- Ports connected to end devices (such as PCs or hosts) are always Designated Ports to ensure proper traffic forwarding.
4. Elect Alternate (Blocked) Ports
The final step in Spanning Tree Protocol (STP) is to elect Alternate (or Blocked) Ports. If a port is not selected as a Root Port or a Designated Port, it becomes an Alternate (Blocked) Port. These ports are placed in the blocking state to prevent Layer 2 loops while remaining ready to transition if the topology changes.
Example: Alternate Port in Our Topology
Let’s examine the link between SW2 and SW3:
- SW2’s G0/1 is the Designated Port for this segment, as it has the lower Bridge ID.
- SW3’s G0/1 becomes the Alternate Port because it is not a Root Port or Designated Port. It enters the blocking state, preventing traffic loops.

In this configuration, SW3’s G0/1 remains ready to switch to the forwarding state if the network topology changes, such as a failure in another link.
5. Summary of Port Roles
Port roles in Spanning Tree Protocol (STP) are essential for creating a loop-free, efficient, and redundant network topology:
- Root Port (RP):
The port on a non-root switch with the shortest path to the Root Bridge. It forwards traffic toward the Root Bridge, ensuring all switches stay connected to the network’s central point. - Designated Port (DP):
The port responsible for forwarding traffic onto a segment. It ensures that the segment has an active path toward the Root Bridge. Each segment has exactly one Designated Port, which is either on the Root Bridge or the switch with the best path to the Root Bridge. Ports connected to end devices are always designated ports. - Blocked Port (BLK):
A port that prevents loops by remaining in the blocking state. It does not forward traffic but stays ready to transition to an active state if the network topology changes.
Next Steps: In the following course, we’ll explore STP Timers & Port States and how they help maintain stability and adapt to changes in the network.