Spanning Tree – Port Roles
IEEE 802.1D Spanning Tree Protocol (STP) and Rapid Spanning Tree Protocol (RSTP) use the Spanning Tree Algorithm (STA) to decide which switch ports on a network must be put in a blocking state to prevent loops. The Spanning Tree Algorithm designates one switch in the network as the root bridge. The root bridge is considered the reference for all path calculations.
The root bridge is selected through an election process. All switches in the network that enable the 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 containing a Bridge ID identifying the switch that sent it. The Bridge ID also includes a priority value, the sending switch’s MAC address, and an optional extended system ID. The combination of these three values determines the lowest Bridge ID value.
When the 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. The Spanning Tree Algorithm (STA) selects the best paths to the root bridge for all switch ports in the broadcast domain.
The 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 selects 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 ports. 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 are still permitted to forward data on the network, and root ports are designated ports. Designated ports are chosen on a per-trunk basis. If one side of a trunk is a root port, the other must be a specified port. All ports on the root bridge are designated ports.
- Alternate and backup ports—Alternate ports and backup prevent a loop on the network. These ports are configured to block. 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.