STP determining blocked port using cost

When implementing Spanning Tree Protocol (STP), an STP topology will avoid creating a Layer 2 loop by choosing to block certain ports in the topology. To determine which port will be blocked, you can follow this exercise:

In order to determine which port between SW2 and SW4 is designated, you should imagine placing an imaginary device on the link between the two switches like so:


You then measure the cost from H1 to the root bridge via each of the two possible paths like so:


When you measure the cost from H1 to each of the two switches, use half of the cost between the two. So the costs are:

  • H1 → SW2 → SW1 = 2+4 = 6 (green line)
  • H1 → SW4 → SW3 → SW1 = 2+4+4=10 (red line)

So since the path via SW2 is shorter, the port on switch 2 becomes designated.

Therefore it is the port on SW4 that becomes blocked.

In the event that the cost is the same, take a look at other tie breakers used to determine the blocked port .