Tutorial 1: 802.1d - Spanning Tree Protocol
- By: vhoang
- On: 03/14/2009 20:23:44
- In: Learning Cisco
- Comments: 0
A recap on the process involved in preventing loops in network topologies and why loop happens.
I have been spending this week trying to wrap my mind around the protocol: (concepts of) spanning tree.
Now is a good time, as any, to try to sum it up in a paragraph or two.
Hopefully in a version of english that makes sense.
I must admit, sometimes the best way to feel comfortable that you know something about a particular topic is to try to explain it to someone else.
The world of Cisco I'm trying to learn about currently revolves around two basic concepts:
Routing and Switching.
Before I hop into my main topic, I'm going to make a few side notes on Routing & Switching.
This is the first tutorial in the series, so I'll try to ease in some terminology and concepts that will make the articles a little more useful.
Scenario:
- Routing:
- The message gets from Emilie to me via a process called routing.
- Routing is the function of directing the message to the next "router" in the path to a destination.
- The devices at positions 1,2,3,4 all exchange routing data so I can be contacted
- Switching:
- Because it's not practical to connect every device to every other device, we use switches.
- Switches have lots of interfaces (ports) that are used to interconnect devices.
- Switching involves taking a message that come in one interface and sending it out another.
- Devices 2,3,4 and my desktop in the scenario above are all connected via switches.
- Switches forward messages from the source to a destination as if they are directly connected.
Spanning tree protocol is a technique which selectively cuts off looping paths within a network of many interconnecting switches to form a tree like structure with no loop.
It's very common to have a switch, that connects to another switch, that connects to another switch, and so on. When any of the subsequent switches have a connection back to the starting point, you have a loop in your network.
The spanning tree protocol is very complicated and simple at the same time. In very basic terms, it frees the topology of loops by disabling ports that leads in a loop formation.
Switches in a network that has Spanning Tree Protocol enabled (802.1d), exchange data with one another using messages referred to as BPDU. Upon learning about each of the switches (aka bridges) involved, they negotiate and designate a master switch, referred to as the root bridge. Any other bridge, that discovers it has two ways of getting to the root bridge, will give preference to one and mark that as the root path, then shut down the other path / port.
The folks as Cisco created a nice flash animation of the details of this process here:
- Slide 1: You've connected your Switches in way that form a little loop. Luckily you've enabled STP on all the switches to keep your network from blowing up.
- Slide 2: Right off the bat, each STP enabled switch shuts down packet forwarding on all port, never allowing the loop to cause problem.
- Slide 3: Then each switch begin using BPDU messages to fight for the "root bridge" title (the guy with all the good connections to everywhere).
- Slide 4: When a bridge receives a BPDU with the name of a more qualified "root bridge" it gives up the title and records the winner.
- Slide 5: The fight continues. B gives up, and A & C continues the fight.
- Slide 6: Switch A wins.
- Slide 7: Each switch that didn't win must determine the best path to the winner, the root path.
- Slide 8: The path to the root bridge is based of a number of favorable conditions or metrics.
- Slide 9: All network segments are now assigned to a specific switch, knows as the designated bridge. Only one per segment.
- Slide 10: Each bridge then maps every segment on the network to exit via a designated port.
- Slide 11: Every port on the root bridge is always classified as a designated port.
- Slide 12: When the root bridge finds two path to a segment (segment 3), it picks one over the other.
- Slide 13: It then tells Bridge C to own the designated port to segment 3.
- Slide 14: Root ports & designated ports now start passing traffic.
- Slide 15: Duplicate paths to the same segment stay blocked.
- Slide 16: We're done.
- Slide 17: BPDU are now used as keep-alive messages
- Slide 18: If a cable gets broken...
- Slide 19: The block port gets unblocked as the loop no longer exists.
- Slide 20: Everybody is happy again.
Spanning Tree Protocol is a very handy mechanism to prevent a network from being flooded by messages that are passed around in an infinite loop.
Here are some additional resources if you'd like further information about the nitty gritty of the port state, timer, etc involved in 802.1d:
Article 1
Article 2
-vth
Comments
There have been no comments made on this article. Why not be the first and add your own comment using the form below.
Leave a comment
Commenting is restricted to registered users only. Please register or login now to submit a comment.