It's a new year and what better way to start it off than by discussing one of the most fundamental topics in networking: the Spanning-Tree Protocol (STP)! If you've ever studied networking (even just a little bit) then you've probably come across STP. It's a fairly simple concept, but with a variety of standard and proprietary implementations, along with the actual specifics of how the protocol works, it's a topic that easily warrants its own full discussion. In fact, there's so much to talk about that there's no way I'm going to be able to cover it with one post, and as such this is going to be a multi-part discussion. We'll start with just an overview of what STP is and why we need it.
Why We Need STP
So what is STP? Simply put, it's a way to prevent broadcast loops from occurring. Take for example, the simple network in the diagram below:
Here we have four switches, all connected to each other, with a host connected to switch A. Now suppose that the host sends out a broadcast. Switch A is going to forward that broadcast out of every port (except the port on which the broadcast was originally received it). So now every other switch on that network receives that broadcast and floods it as well. For example, switch D will receive the broadcast from switch A and then forward that broadcast to switch C and switch B. Switch C will then forward that broadcast to switch A and switch B while switch B forwards it to switch A and switch C. So now switch A is receiving the broadcast that it originally flooded again and it will in turn forward copies of those frames. This is a broadcast loop, and it's very, very bad.
How STP Prevents Loops
So how do we prevent this? Well, that's where STP comes in. The idea behind STP is to eliminate links that could cause loops in the first place. The way this is accomplished is by changing the network topology into a tree in which no loops exist. The first thing you need to do if you're building a tree is to decide who the root is going to be. We'll talk about how that's decided when we look at the details of the protocol, but for now let's just say that switch B is going to be the root. From there, each switch decides which path to the root is best as well as figuring out if it is the designated switch (this will be explained in the next part) on any non-root port. Any port that is not used to get to root or is not a designated port is simply not used. So the network above would be transformed to look like this:
In this example, switches A, C, and D all used their direct links to the root switch. This, however, may not always be the case, since STP looks at the speed of each link in making its determinations as to the best path to the root switch. For example, if the the links from D to C and C to B were both 1Gbps, while the link from D to A was 100Mbps, then D would actually use the path D->C->B instead of the direct path to B.
This is a very high level overview of how spanning-tree is changing the topology of the network in order to prevent loops. In the next post I'll go into detail as to how this was actually implemented in IEEE 802.1d.
A Word About STP Versions
The general concept and many of the details of spanning-tree protocol that is so prevalent today was originally invented by Radia Perlman around 1980 when she was working for Digital Equipment Corporation. Since then, there have been a number of standard and proprietary implementations of STP. I'm going to focus mainly on the IEEE's standards as well as Cisco's proprietary implementations. Now personally, I am not generally a fan of proprietary technology, especially when an open standard exists. Standardization means interoperability which generally gives the customer more options and control. However, standardization is also a slow process and it may not take into consideration the latest technology or trends, and in the case of spanning-tree I believe Cisco's proprietary implementations are absolutely justified. I'll discuss them in detail in a future post, but for now understand that the main difference between Cisco's STP and the IEEEs standards have to do with taking Vlans into consideration.
In addition to the competing standard and non-standard version of STP, there are also two general version of spanning-tree: the original STP and the newer rapid-STP or RSTP. As suggested by the name, the main difference between the two versions have to do with the amount of time it takes them to perform their calculations and react to changes in the network, though there are other changes that will be discussed in a future post.
No comments:
Post a Comment