Like take this example:

enter image description here

Also not mentioned in image, lets take:

  • Segment 1 is between switch 1 and switch 2
  • Segment 2 is between switch 2 and switch 3
  • Segment 3 is between switch 3 and switch 1
  • All lines have equal bandwidth capacity

If someone in segment 2 wants to send something to someone in segment 3, then he can't just go through switch 3 cause the port is blocked. So has to go through switch 2 and then to switch 1 to finally reach segment 3. Is this right? In this case didn't Spanning tree make him go through the more costly path?

  • This is not a security question. Migrating. – schroeder Apr 13 '16 at 19:21

Yes it did make him go through a more costly path. Maybe you aren't confused on how it works, maybe you're confused on what it's for?

Spanning-tree is for stopping network loops. It finds short paths from the root to each edge, and closes other paths between edges - it's not about making every connection as short as possible.

Consider your picture - you get the same problem if you close Switch 1 <-> Switch 2, or Switch 1 <-> Switch 3 instead, the problem just moves around. It's impossible for your picture to have no loops, and one hop from anywhere to anywhere.

  • Loops only happen when someone is sending out a broadcast right? – User104163 Apr 13 '16 at 19:54
  • 3
    @ponglenis, not only broadcasts, which are an essential part of how layer-2 ethernet works, but also multicasts, and switches will also flood unknown unicasts to all ports. – Ron Maupin Apr 13 '16 at 20:04

STP is about providing a loop-free environment, and path cost is a secondary concern.

The key is that it elects a root switch. The best metric to the root switch is the metric used to send traffic, not the best metric to the destination. This forces the traffic to travel toward the root switch in order to get to its destination. If you look at the topology, you can see how this eliminates loops.

  • So nobody gets to use the least costly path then? – User104163 Apr 13 '16 at 19:56
  • 1
    That depends. If you are sending to something connected to the root switch, or a switch in the path to the root switch, then it is on the path with the best cost. You should realize that the best cost is toward the root switch. In your diagram, if your connection from one switch to the root switch was a very high cost, that path may be blocked, and the connection between the bottom switches would not be blocked. This would also be a loop-free path. The entire point of STP is to eliminate all the possible loops. Having layer-2 loops will almost instantly kill your network. – Ron Maupin Apr 13 '16 at 20:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.