How Spanning Tree Protocol (STP) Select Designated Port?
Spanning tree protocol is a type of communication protocol that functions to build a loop-free topology, which means the arrangement of elements in a computer network. STP commonly works for layer-2 bridges and switches. It also provides a backup link for the network system if the active link fails. Layer-2 devices send the data in the form of frames.
The root port of each bridge forms a part of the spanning tree. The ports selected by the spanning tree are the best ports to reach the root bridge, which is also known as the destination port. It means that every switch or bridge has only one root port. If any other switch does not have any root port, it selects one designated port and the other as non-designated ports. The designated port will be considered as the ports in forwarding state, while others in blocking state.
STP enables a single port of a node and disables all other ports. It means that it allows only one active path for transmission between the two nodes. The port selected by the STP is named the root port, which sends data to the root bridge. The root bridge receives all the data from different bridges.
The cost of the port, port priority, and switch ID determines the path for the destination. If the cost of the port and the switch ID is the lowest, it becomes the path for the destination.
Steps of selecting the designated port
The process to select the designated port is listed below:
- Select the switch with the lowest path cost: We need to select the switch that has the lowest path cost.
- Select the designated port in the switch based on the lowest cost: There are two ports to reach the destination. We need to select one port with the lowest cost as the designated port and another port as the non-designated port.
Select the designated port in the switch based on the bridge ID: If the lowest cost on two switches is the same, it selects the designated port based on the Bridge ID. The designated port works in a forwarding state. It forwards the data.
- Specify the other port as the Non-designated port: The root port of the other switches is specified as NDP (Non-designated port), which is in a non-forwarding or blocking state. It is done to avoid any loops during the data transmission.
Example: Consider the below switch diagram:
Data transfer in the above diagram will be from switch3 to switch2.
Explanation: It is because of the lowest cost. The switch2 has the lowest Bridge ID and is thus selected as the root bridge. Among the switches, switch3, and switch1, one needs to be selected as the designated port and the other is selected as the non-designated port. Since, switch3 has the lowest cost (10<18), it is selected as the designated port made in the forwarding state. Switch1 is selected as the non-designated port made in the blocking state.