TechKnowSurge
Cisco CCNA 2.5 Cisco CCNA 1.13
VideoNetworkFree

STA - Example #1

Spanning Tree Protocol (STP) root bridge election, root path cost calculation, and port role assignment are walked through using a multi-switch topology example. The process covers how bridge IDs, link costs, and port IDs determine which ports forward traffic and which are blocked.

Complete this video to capture a CTF flag worth 1 point.

About this video

Spanning Tree Protocol operates through a structured election process that determines how traffic flows across a redundant switched network, and this content walks through each stage of that process using a concrete three-switch topology. Root bridge election comes first, relying on the bridge ID — a value composed of the switch priority, extended system ID, and MAC address. When two switches share the same default priority of 32,768, the MAC address becomes the tiebreaker, and the switch with the numerically lower MAC address wins. In this example, Switch 2 is elected root bridge on that basis. Once the root bridge is established, root path cost is calculated for every non-root switch. Link speed drives this calculation: 100 Mbps connections carry a cost of 19, while gigabit connections carry a cost of 4. Switches that reach the root bridge through intermediate hops accumulate costs along the path, so Switch 3's total path cost through gigabit links adds up to 8. Each non-root switch then selects its root port — the port with the lowest cumulative cost to the root bridge. When costs are equal, the sending port ID serves as the tiebreaker, with the lower port ID winning. Designated ports are then assigned to each network segment, with the port closest to the root bridge on any given link taking the designated role. All ports on the root bridge itself are designated by default. After root and designated ports are identified, any remaining ports are assigned the alternate role and placed in a blocking state. In this topology, specific ports on Switch 1 and Switch 3 are blocked as alternates, eliminating redundant paths and preventing loops while preserving a loop-free active topology throughout the network.

What you'll learn

What's covered

Spanning Tree Algorithm Example

Aligned to

Cisco CCNA
2.5 Interpret basic operations of Rapid PVST+ Spanning Tree Protocol
1.13 Describe switching concepts

Key terms

Spanning Tree Protocol
STP
A network protocol that prevents loops in Ethernet networks by creating a loop-free logical topology.
Bridge
A network device that connects two or more network segments and filters traffic based on MAC addresses.
Media Access Control
MAC
A sublayer of the Data Link layer that controls how devices on a network gain access to a medium and transmit data.
Bridge ID
BID
A unique identifier used in the Spanning Tree Protocol consisting of a configured priority value and the bridge's MAC address. The BID is used in STP elections to determine which switch becomes the root bridge.
Root Bridge
The switch elected as the reference point for the Spanning Tree Protocol topology, determined by the switch with the lowest Bridge ID (priority + MAC address). All other switches calculate their best path to the root bridge and block redundant links to create a loop-free tree.
Root Port
The port on a non-root switch that provides the least-cost path to the root bridge.
Designated Port
DP
In STP, the port on each network segment that provides the best path to the root bridge and is placed in a forwarding state. Each segment has exactly one designated port, which is selected based on the lowest cumulative path cost to the root.
Alternate Port
A switch port that is not elected as a root port or designated port and is placed in a blocking state to prevent loops, serving as a backup path.
Path Cost
A value assigned to a switch port based on link speed, used by STP to determine the shortest path to the root bridge.

Topics

Spanning Tree Protocol Root Bridge Election Port Role Assignment Path Cost Calculation Bridge Id Networking

Transcript

Now that we have a good understanding of spanning tree algorithm, let's look at an example. See if you can figure it out, and then we'll go over it together.

Electing the Root Bridge

The first step is to find out what the root bridge is. We need to elect a root bridge. The root bridge is based off of whichever is the lowest bridge ID. The bridge ID is a combination of the priority plus the extended system ID plus the MAC address.

So we take a look at the priorities, and we can see that two of these are default priorities, while one of these is 36,864. The default is 32,768, so both these defaults are 32,768. So we know that this switch 3 is not going to be a root bridge; it's going to be one of the other two. And we know that the priority is the same on switch one and switch two, so we have to look at the MAC address. In the MAC address, we start to see that this one starts with a 1, versus this other one starts with a 0. So we're going to prefer the one that starts with a 0 because it's a lower number. Therefore this switch 2 will be the root bridge. So switch 2 is the root bridge.

Calculating Root Path Cost

Next, let's go ahead and calculate the root path cost, and we've got to do that for every switch link. Switch 2 is our root bridge. Let's take a look at switch one, and we can see that the cost that goes to the root bridge from this first one is going to be 19. I look at this, this is 100 megabits per second, and 100 megabits per second means that we're at a cost of 19. So that's 19. This next one is the same one, so this is 19 as well.

The gigabit per second connections are at four, so these are four, plus whatever it takes to get across here. So this switch 3 also has a cost of four for each of these, so total, each of these links are actually going to be eight to get to the root bridge. And these are both four right there. So that is the root path cost for each one of these.

Electing Root Ports

The next one is we need to elect root ports. So we take a look at this and we say, well, these two on switch one are not going to be root ports, so it's got to be one of these other two, 046 or 045. And so if they are the same cost, which they are, then we look at what the sending port ID is. So we see 047 and 048, so it's going to be 047, the lowest, if there's no priority set. We don't see that there's any priority listed, so we're going to assume that it's the default priority. So this first one, 045, is actually going to be the root port.

And we do the same process on switch three. So on switch three, we can see that this is a 45 right here versus 46, so this is going to be the root port — it's going to be 045 on switch 3. So there we have it. Now we've figured out the root ports.

Electing Designated Ports

Now we've got to figure out designated ports. The designated ports are going to be whatever is closest to the root bridge. Obviously these ports on the root bridge are the closest, so those are all designated ports. And then we will see on switch 3 we've got designated ports on both these links right here.

So let's see, are all the links accounted for? This link has a designated port here, this link has a designated port, this link has a designated port, this link has a designated port, this one and this one. Okay, so we've got every link has a designated port.

Electing Alternate Ports

Now we need to elect the alternate ports, the ones that we're going to block. So this 045 is the root port for switch three, so now we're going to block 046 because that is an alternate. So let's mark that as an alternate, put an A right there. And then these other two ports on switch three are designated ports already.

So then on switch one we can see that 046 is going to be the alternate, so we'll mark that as an A. And then also 43 and 44 are redundant links also, so we need to make both those alternates. So there we have it. Now we have elected the designated ports and elected the alternate ports, and we have finished.

About TechKnowSurge

TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.

Explore free tools and programs →