Spanning Tree – the Roots Go Deeper!

Home > Blogs > Cisco > Spanning Tree – the Roots Go Deeper!

Spanning Tree – the Roots Go Deeper!

Like This Blog 4 Mark Jacob
Added by June 17, 2013

While I have posted a couple of blogs regarding spanning-tree, the Layer 2 loop prevention mechanism that runs on Cisco switches, I wanted to post one with a few more switches and a bit more detail on the step-by-step process. Follow the steps as we proceed from a blank scenario to one in which all the switches, MAC addresses, ports, speeds, and costs are included. Seeing the process as it flows from beginning to end really helps solidify the concept. I hope it helps you!

001-Cisco-Swithces-Layer-2-loop-prevention

All switches have the default priority: 32768

002-Cisco-Swithces-Layer-2-loop-prevention

Let’s put in some fake MAC addresses.

003-MAC-address-Cisco-Swithces-Layer-2-loop-prevention

Based on the rule that Bridge ID = Priority and MAC address concatenated and lowest Bridge ID wins, Switch A becomes the root.

004-bridge-ID-Cisco-Swithces-Layer-2-loop-prevention

Let’s put some speeds and port identifiers on these links…

 

005-port-ID-Cisco-Swithces-Layer-2-loop-prevention

 

006-cost-values-Cisco-Swithces-Layer-2-loop-prevention

On root bridge, all ports are designated, which means they are forwarding.

007-port-forwarding-Cisco-Swithces-Layer-2-loop-prevention

Root ports:

Lowest-cost path from non-root bridge to the root bridge. Ex: C-to-A has multiple paths, but lowest cost is direct link with cost of 4. So for Switch C, g0/1 is the root port.

008-lowest-cost-Cisco-Swithces-Layer-2-loop-prevention

Root ports:

Lowest-cost path from non-root bridge to the root bridge. Switch B has multiple paths to root also. The direct link has cost 19, but the path from B-to-C-to-A has total cost 8 (4+4). So for Switch B, root port is g0/2.

009-lowest-cost-non-root-Cisco-Swithces-Layer-2-loop-prevention

Root ports:

Lowest-cost path from non-root bridge to the root bridge. For Switch E, lowest-cost is path E-to-C-to-A with total cost 8. So for Switch E, the root port is g0/3.

010-lowest-cost-bridge-Cisco-Swithces-Layer-2-loop-prevention

Root ports:

Lowest-cost path from non-root bridge to the root bridge. For Switch D, lowest-cost path goes like this: D-to-B-to-C-to-A with total cost of 12. So for Switch D, the root port is g0/1.

011-lowest-cost-path-Cisco-Swithces-Layer-2-loop-prevention

Designated ports:

Now that root ports are identified, we must select the designated ports for each segment. Each link between switches is a segment. The designated port is selected on the bridge with the lowest-cost path to the root bridge. A root port cannot also be the designated port.

012-designated-ports-Cisco-Swithces-Layer-2-loop-prevention

Designated ports:

Between B and A, and between C and A the designated ports are already selected by virtue of the fact that all ports on the root bridge are designated ports.

013-designated-ports-Cisco-Swithces-Layer-2-loop-prevention

Designated ports:

Between B and C, switch C has a lower cost to the root (4 vs. 19), so switch C gets the designated port on that segment. Also, that segment already has a root port on B, which means g0/2 on switch B cannot also be the designated port, so switch C, g0/2 becomes the designated port.

014-designated-ports-lower-cost-root-Cisco-Swithces-Layer-2-loop-prevention

Designated ports:

Between B and D, switch B has the lower cost path to the root, so g0/1 on B becomes the designated port. As before, since D has the root port on that segment, it can’t also be the designated port, so g0/1 on Switch B is the designated port.

015-designated-ports-lower-cost-path-Cisco-Swithces-Layer-2-loop-prevention

Designated ports:

Between C and E, Switch C has the lower cost path to the root (and Switch E has the root port), so g0/3 on Switch C becomes the designated port on that segment.

016-designated-ports-lower-cost-path-to-root-Cisco-Swithces-Layer-2-loop-prevention

Non-Designated ports:

The ports that remain once the root ports and designated ports are selected are considered non-designated ports (normally they block). So on Switch B and Switch D, the ports that are neither green nor blue (they are black) are the blocking ports.

017-non-designated-ports-Cisco-Swithces-Layer-2-loop-prevention

No loops:

Notice two possible loops in this network diagram are the big rectangle and the triangle. Each potential loop has a block in place to prevent the loop from occurring. Thus spanning-tree has allowed for redundancy but prevented Layer 2 loops!

018-non-designated-ports-loops-Cisco-Swithces-Layer-2-loop-prevention

To add a little more to this, if Switch D and Switch E each had equal cost paths to the Root, there are tie-breakers. For D and E with equal cost paths to the root, the tie-breaker is to select the switch with the lowest Bridge ID. In that case Switch D would have the designated port and E would block.

019-non-designated-ports-switch-Cisco-Swithces-Layer-2-loop-prevention

All other factors being the same: If Switch D and E had two links between them (not ether-channeled) and also had equal cost paths to the root, the tie would be broken based on lowest Bridge ID and then on port priority.

020-lowest-bridge-id-Cisco-Swithces-Layer-2-loop-prevention

Default port priority starts at 128, so port 1 would have priority 128.1 and port 2 would have priority 128.2. Lowest priority wins so Switch E would choose to block its port which did not have the lower priority, which would mean E would block port f0/2.

Even though it seems that Layer 2 access layer solutions are slowly being replaced by blazing fast Layer 3 solutions, it pays as a network admin to understand how spanning tree makes its decisions.

I hope you found value in this blog.

Until next time…

Mark Jacob
Cisco Instructor – Interface Technical Training
Phoenix, AZ

Videos You May Like

Agile Methodology in Project Management

0 154 0

In this video, you will gain an understanding of Agile and Scrum Master Certification terminologies and concepts to help you make better decisions in your Project Management capabilities. Whether you’re a developer looking to obtain an Agile or Scrum Master Certification, or you’re a Project Manager/Product Owner who is attempting to get your product or … Continue reading Agile Methodology in Project Management

JavaScript for C# Developers – September 24, 2014

0 487 3

Is JavaScript worth taking the time to learn if I’m a server-side .NET developer? How much of C# carries over to JavaScript? In this recorded video from Dan Wahlin’s webinar on September 24,2014, Dan answers these questions and more while also discussing similarities between the languages, key differences, and the future of JavaScript (ES6). If … Continue reading JavaScript for C# Developers – September 24, 2014

Detailed Forensic Investigation of Malware Infections – April 21, 2015

4 608 5

How does an investigator hunt down and identify unknown malware? In this recording of our IT Security training webinar on April 21, 2015, Security expert Mike Danseglio (CISSP / CEH) performed several malware investigations on infected computers and identify symptoms, find root cause, and follow the leads to determine what’s happening. He demonstrated his preferred … Continue reading Detailed Forensic Investigation of Malware Infections – April 21, 2015

Write a Comment

See what people are saying...

  1. Avatar Francisco

    Thank you Mark.
    Very well explained.

  2. Avatar Iliyas Shelat

    Awesome explanation..

  3. Avatar Nishant

    “I hope you found value in this blog.”

    A lot! Its very well explained. Thanks for sharing.

  4. Avatar rock

    very nice thanks for the upload

Share your thoughts...

Please fill out the comment form below to post a reply.