4

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?

1
  • This is not a security question. Migrating.
    – schroeder
    Commented Apr 13, 2016 at 19:21

3 Answers 3

7

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.

2
  • Loops only happen when someone is sending out a broadcast right?
    – User104163
    Commented Apr 13, 2016 at 19:54
  • 4
    @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
    Commented Apr 13, 2016 at 20:04
4

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.

3
  • 1
    So nobody gets to use the least costly path then?
    – User104163
    Commented Apr 13, 2016 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
    Commented Apr 13, 2016 at 20:01
  • @RonMaupin You might want to point out that traffic doesn't necessarily flow through the root bridge, just along the non-looping tree that is rooted at the root bridge.
    – Zac67
    Commented Jan 13, 2022 at 6:44
2

Ethernet is fundamentally designed around a loop-free topology. This combined with the rule that a hub or switch never sends data back the way it came, means that each frame will be delivered to each node at most once.

Spanning tree was introduced to allow a degree of fault-tolerance in an Ethernet network, it is as you have noticed inefficient. Especially as networks get larger.

However, in local area networks efficient use of links is often not the most important criteria, simplicity and availability of low-cost switching hardware is often more important.

If you need to deliver services efficiently over a wide area, then one of the most obvious approaches is to simply not run a large scale Ethernet network, but instead run a bunch of small ones connected by IP routing.

If you really need L2 Ethernet end to end over a wide area with high bandwidth and reliability then there are certainly technologies (for example VXLAN BGP EVPN) that aim at delivering that service, generally by encapsulating the Ethernet traffic and delivering it over a network (for example an IP network) that does support non-tree toplogies, but expect to pay more money both for the equipment to deliver the service and the people to set it up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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