6.2 STP Operation Explained
Key Concepts of STP Operation
Spanning Tree Protocol (STP) is a network protocol that ensures a loop-free topology for Ethernet networks. Key concepts include:
- Root Bridge: The central switch in the STP topology.
- Bridge ID: A unique identifier for each switch.
- Path Cost: The cost associated with each link.
- Port Roles: Designations for each port on a switch (Root, Designated, Alternate, and Disabled).
- Port States: The operational states of each port (Blocking, Listening, Learning, and Forwarding).
Root Bridge
The Root Bridge is the central switch in the STP topology. It is chosen based on the lowest Bridge ID, which is a combination of the switch's priority and MAC address. All other switches in the network will forward traffic to the Root Bridge.
Example: In a network with multiple switches, the switch with the lowest Bridge ID will be elected as the Root Bridge. This switch will become the central point for all STP calculations and traffic forwarding.
Bridge ID
The Bridge ID is a unique identifier for each switch, consisting of an 8-bit priority value and a 48-bit MAC address. The switch with the lowest Bridge ID is elected as the Root Bridge. Administrators can manually configure the priority to influence the Root Bridge election.
Example: If two switches have the same priority, the switch with the lower MAC address will be elected as the Root Bridge. This ensures a deterministic and consistent Root Bridge election process.
Path Cost
Path Cost is the cost associated with each link between switches. Lower costs indicate better paths. The Path Cost is calculated based on the link speed, with faster links having lower costs. Switches will choose the path with the lowest cumulative Path Cost to the Root Bridge.
Example: A 1 Gbps link might have a Path Cost of 4, while a 100 Mbps link has a Path Cost of 19. Switches will prefer the 1 Gbps link over the 100 Mbps link when calculating the best path to the Root Bridge.
Port Roles
Port Roles define the function of each port on a switch. The main roles are:
- Root Port: The port with the lowest Path Cost to the Root Bridge.
- Designated Port: The port on a segment that forwards traffic to and from the Root Bridge.
- Alternate Port: A backup port that is blocked to prevent loops.
- Disabled Port: A port that is administratively disabled and does not participate in STP.
Example: In a network with redundant links, the Root Port on each switch will be the one with the lowest Path Cost to the Root Bridge. The Designated Port on each segment will be the one that forwards traffic to the Root Bridge, while Alternate Ports will be blocked to prevent loops.
Port States
Port States define the operational status of each port. The main states are:
- Blocking: The port does not forward traffic and only listens to BPDUs.
- Listening: The port prepares to forward traffic but does not yet learn MAC addresses.
- Learning: The port learns MAC addresses and prepares to forward traffic.
- Forwarding: The port actively forwards traffic and learns MAC addresses.
Example: When a switch is powered on, its ports enter the Blocking state to prevent loops. After a period, they transition to Listening, then Learning, and finally Forwarding. This ensures that the network is loop-free before traffic begins to flow.