Home Mike Meyers, A+ Certification Guru

Tech Files

Spanning Tree Protocol

Switches, unlike hubs, are not subject to the infamous Ethernet 5-4-3 rule – and for some of us that’s a problem when we ask more from our switches than they really are capable of doing. Luckily for us, every switch comes with a special feature called the Spanning Tree Protocol (STP). To appreciate the versatility of switches, the ease by which we can screw them up, and how STP protects us from our own stupidity, it would be helpful to review interconnecting hubs.

Back in the days before switches made hubs obsolete, you had to carefully connect your hubs together. If you wanted to connect two or more hubs, you had to ensure that you kept the hubs in a single “line” or “daisy-chain”. The trick with hubs was to remember the bus stored inside each hub: each connection between hubs did little more than extend the Ethernet bus to the next hub. The figure below shows a properly configured series of hubs – each hub daisy-chained to his neighbor.

Chained hubs

 

Failure to properly daisy-chain hubs resulted in a serious problem: the network wouldn’t function. To appreciate this, think about the Ethernet bus stored inside each hub and look at this figure – the bus is a simple, single line, just as though it were an old 10BASE5 or 10BASE2 bus.

Chained hubs showing internal bus 

Now look what happens to the bus when you try to make a hierarchal configuration with a single “main” hub connected to two subordinate hubs:

Hubs in hierarchal config

Note the problem – you now have a “T” instead of a simple linear bus. If you try this setup with hubs the results are – as I was once told  by a hub expert – “unpredictable.” At best three of the four hubs will work. At worst every hub fails.

Switches changed all these problems. Even though a switch looks like a hub – and still technically has a bus – the fact that a switch creates a direct connection between any two ports eliminates the 5-4-3 rule. You may connect switches together in any fashion you wish: daisy chain, hierarchical or any combination of the two. This amazing flexibility is very convenient for a number of different real world setups. Probably the most common is a hierarchical setup where a central backbone switch connects to a number of other switches, which in turn support individual PCs.

Backbone
   Switches in hierarchal config 

The problem is that networks grow and change, often starting as a simple hierarchal setup as shown above but quickly turning into a vastly more complex beast. While good planning and carefully planned growth are always nice ideas, in the real world many networks are simply slapped together – and that’s where the dreaded bridge loops often occur.

Looped Switches

Bridge loops, often just called “loops”, are the bane of switched networks. A loop will cause broadcast Ethernet frames to loop endlessly, creating broadcast storms that immediately shut down the entire network. Bridge loops are bad and must be avoided.

Luckily for us, a very smart lady named Dr. Radia Perlman invented the Spanning Tree Protocol. STP adds extra “smarts” to layer-2 devices (bridges, switches) that, when  they detect a loop, stop it immediately by automatically shutting down one of the ports that make up the loop. Any time you connect two switches together they immediately begin negotiating to determine which switch will become the root switch. The root switch is the boss switch of all the connected switches and any other switch that connects to these will respect the existing root switch.

Loop fixed by STP

If the root switch detects a loop, it will shut off one of its ports in order to stop it. The nice part here is that there is nothing you need to do to make this work – STP just happens.

So STP is used by all layer-2 devices (bridges and switches) to prevent loops. That’s great but this seems like a lot of trouble to go through – why not just train users to do it right? Well, actually STP goes a lot deeper as networks get more complicated. The most common uses of STP are in networks that INTENTIONALLY make redundant connections between switches so that if one connection is lost, the other takes over.

Network+ wants you to understand these basics of STP . I hope this light touch on the subject  piques your interest and inspires you to learn more about Spanning Tree Protocol. To go deeper, first read about STP in the excellent Wikipedia article:

http://en.wikipedia.org/wiki/Spanning_tree_protocol

Mike

Top of Page