What's the interest of Designated Port in STP algorithm ?I didn't get their goal,we have both RootPort and DesignatedPort
3 Answers
I'll try to answer this to make you get the idea, without diving deeply into details.
STP builds a tree. So, think of these port roles from the perspective of direction you're going over this tree - upstream (to the Root Bridge) or downstream (from the Root Bridge).
The Root Port basically is an upstream port, and Designated Port is a downstream port. The Root Port receives BPDUs from the Root Bridge (directly or indirectly), caches them, and replicates out its Designated Ports.
Why does it matter? The ultimate goal of STP to ensure that there's only one logical path between any two points in the topology - that's how it makes the topology loop-free. That's why there may be only one Root Port per switch - this is the only exit point on a switch to reach the Root Bridge.
The Designated Port, on a contrary, is the port that sends BPDUs and connects the segment to the Root Bridge (that's why the Root Bridge has all its ports as Designated). So, there're multiple Designated ports per switch - as many as the number of the physical segments (from port to port, or, collision domain like matteo have mentioned) the particular switch serves. Keeping in mind the goal of the STP, it's obvious that there may be only one Designated port per segment (to ensure only one logical path from the segment towards the Root Bridge).
These port roles are exactly about how the tree is actually built. Once the Root Bridge is elected you have the root of the tree. Now, you need to construct the tree itself.
The tree is constructed in a downstream manner, i.e. from the Root Bridge down the rest of the topology.
This is done through the exchange of BPDUs. In most STP versions (I won't touch different 'additions' from STP toolkit or MSTP here to avoid overcomplicating things) the Root Bridge is the only source of BDPUs - rest of the switches just receive them, cache for some time, and replicate downstream the topology (changing few parameters in them).
Look at the picture below and imagine the process of the construction of the tree:
- Root Bridge is elected, and all of its ports are Designated. The fact that there is already a Root Bridge means that to this point all switches has all necessary information to construct a tree - they were exchanging BDPUs for some time and now all they know who is the Root Bridge and where it is located, in terms of direction (the port), the distance (the cost to reach it), and the upstream switch on the way to it.
- Downstream bridges each elects exactly one Root Port - the path to the Root.
- Once the Root port is elected, each bridge elects its Designated ports.
- If the Designated port (the downstream port) is also receiving BPDUs, this means that it's connected to the similar Designated port - i.e. you have two ports that both lead to the Root Bridge - this directly violates the goal of STP because you have two logical paths to the same point (the Root Bridge), and it's essentially a loop (imagine frames flow from the Root Bridge, exit from one of these Designated ports and going into another, getting back to the Root Bridge). So, to avoid this, STP simply blocks one of this ports thus breaking the loop.
The Root port in a switch is the port connecting to the root bridge or has the lowest cost to the root bridge.
The designated port is a port on a link with lowest cost to root bridge. So on a segment with two switches, neither being the root, the switch with shortest path to the root bridge will have the designated port on that segment and the other one will be blocking. On a link where the port on one side is a root port, the other side will be a designated port. You could say that the designated port is the one responsible for forwarding traffic to a segment.
Found this picture that might help explain it.
Sw1 being the root bridge has only got designated ports. The other port on those two links are both root ports as they connect to Sw1. Sw3 which has got the lowest cost to the root bridge(Sw1) has got the Designated port(DP) on the third segment which leaves Blocking state for Sw2 since that link is not the shortest path to the root.
-
1That's not quire correct. The designated port has the lowest cost (to the root) on that segment or link. Every network segment will be connected to one bridge with a designated port. Also, every port that is neither the root port or the designated port will be in the blocking state. Mar 6, 2016 at 20:11
Actually you might find useful to approach the spanning tree operations in terms of network segments.
A segment is a collision domain or, technically speaking, a portion of a network where connected devices use the same physical layer.
So, for instance, the cat5 wire that connects a switchport with a PC is a segment, and if 2 switchports of 2 different switches are connected to an old hub in which a common IP subnet is assigned, these 2 ports are on the same segment, etc.
From the spanning tree point of view, in a single segment only 1 switchport is allowed to forward frames to that segment, and it is the designated port, and any other port should be blocked unless there is a switch that choose the segment as the best path to the root bridge.
Indeed, every switch choose which of its segments is the best one to reach the root bridge (and in which it defines one and only one root port).
So, in a segment that is not selected by anyone as a path to the root bridge (ie. a leaf of our tree), one designated port is elected and is in charge of the forwarding of the frames into that segment. In a segment that is used by one or multiple switches to reach the root bridge (ie. a node of our tree - eg. a typical connection between 2 switch in cascade), the switch with the best BID will have its switchport in designated mode, and all the other switches will have 1 port each in root mode.
In other words, a designated port forwards traffic from the root of the tree of STP to its leaves, while the root ports forward the frame from the leaves and the nodes up to the root (or to the proper intermediate note).