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.

Verifying Configuration and Priority STP Configuration 3

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 SpeedPort Cost
10 Gbps2
1 Gbps4
100 Mbps19
10 Mbps100

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:

Path Cost Spanning Tree Protocol

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:

  1. Lowest Path Cost: The port with the lowest cumulative Path Cost to the Root Bridge becomes the Root Port.
  2. 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.
  3. 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.
Spanning Tree Path Cost Calculation
  • 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).
Spanning Tree Path Cost Calculation Longest Path
  • 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.
Spanning Tree Path Cost Calculation SW3
  • 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).
Spanning Tree Path Cost Calculation Longest Path for SW3

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:

Root Port Election Spanning Tree Topology
  • 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:

Designated Ports on the Root Switch

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

Designated Port When There is a Root Port

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:

  1. Lowest Path Cost: The port on the switch with the lowest cumulative Path Cost to the Root Bridge becomes the Designated Port.
  2. Tiebreaker – Lowest Bridge ID: If both switches have the same Path Cost, the switch with the lower Bridge ID wins.
  3. 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:

Designated Port When There is No Root Port
  • 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
Designated Port When There is No Root Port Elected

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:

Designated Ports Connected to End Devices
  • SW2’s G0/2 and G0/3, which connect to PCs or end devices, are automatically Designated Ports.

Summary of Designated Ports

  1. All ports on the Root Bridge are Designated Ports.
  2. If one end of a segment has a Root Port, the other end becomes the Designated Port.
  3. 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.
  4. 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.
Blocked Port Spanning Tree Protocol

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.