Spanning Tree – Port Roles

IEEE 802.1D Spanning Tree Protocol (STP) and Rapid Spanning Tree Protocol (RSTP) uses the Spanning Tree Algorithm (STA) to decide which switch ports on a network have to be put in blocking state to preventing loops. The Spanning Tree Algorithm designates one switch in the network as the root bridge. The root bridge is considering the reference for all path calculations. The root bridge is selected through an election process. All switches in the network that are enabling spanning tree protocol participate in the election process. The switches exchange BPDU frames to decide which switch should be the root bridge in the network. The switch with the lowest Bridge ID automatically becomes the root bridge for the STA calculations.

A BPDU is a messaging frame contains Bridge ID that identifies the switch that sent the BPDU. The Bridge ID also contains a priority value, the MAC address of the sending switch, and an optional extended system ID. The lowest Bridge ID value is determined by the combination of these three values.

When Root Bridge is elected, the Spanning Tree Algorithm (STA) calculates the shortest path to the root bridge. Each switch uses the Spanning Tree Algorithm (STA) to decide which ports to block. Spanning Tree Algorithm (STA) select the best paths to the root bridge for all switch ports in the broadcast domain.

Spanning-tree algorithm uses cost to determine the shortest path to the root bridge. The slower the interface, the higher the cost is. The path with the lowest cost will be used to reach the root bridge. The sum of the port cost values determines the overall path cost to the root bridge. If there is more than one path to choose from, STA chooses the path with the lowest path cost.

After determining the most relevant paths to each switch, STA assigns port roles to the participating switch ports. The different port roles are the following:-

  • Root ports– The switch ports closest to the root bridge are known as the root port. The figure below illustrates the root ports of the network switch. If one side of the trunk is designated port the other side must be root port or alternate port.
  • Designated ports– All ports that are still permitted to forward data on the network and they are not a root port are designated ports. Designated ports are chosen on a per trunk basis. If one side of a trunk is a root port, then the other side must be designated port. All ports on the root bridge are designated ports.
  • Alternate and backup ports– Alternate ports and backup prevent loop on the network. These ports are configured to be blocking. Alternate ports are chosen only on trunk links where neither end is a root port.
  • Disabled ports– A disabled port is a switch port that is shut down.

spanning tree port roles