6.1 Introduction to STP Explained
1. Key Concepts of STP
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 in the network.
- Path Cost: A value representing the efficiency of a path between switches.
- Port Roles: Different roles assigned to switch ports (Root, Designated, Alternate, and Disabled).
- Port States: Various states a port can be in during the STP convergence process (Blocking, Listening, Learning, Forwarding, and Disabled).
2. Root Bridge
The Root Bridge is the central switch in the STP topology. All other switches in the network will calculate their paths to this bridge. The Root Bridge is determined by the switch with the lowest Bridge ID.
Example: In a network with three switches, Switch A might be elected as the Root Bridge because it has the lowest Bridge ID. All other switches will then calculate their paths to Switch A to ensure a loop-free topology.
3. Bridge ID
The Bridge ID is a unique identifier for each switch in the network. It consists of an 8-byte value, typically composed of a priority value (default is 32768) and the switch's MAC address. The switch with the lowest Bridge ID becomes the Root Bridge.
Example: If Switch A has a Bridge ID of 32768.00:11:22:33:44:55 and Switch B has a Bridge ID of 32768.00:11:22:33:44:66, Switch A will be elected as the Root Bridge because its Bridge ID is lower.
4. Path Cost
Path Cost is a value representing the efficiency of a path between switches. Lower path costs indicate better paths. Path costs are calculated based on the speed of the links between switches. Faster links have lower path costs.
Example: If Switch A is the Root Bridge and there are two paths to it: one through a 1 Gbps link (path cost 4) and another through a 100 Mbps link (path cost 19), the switch will choose the 1 Gbps link because it has a lower path cost.
5. Port Roles
Port Roles define the function of each port in the STP topology. Common roles include:
- 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 can take over if the Root Port fails.
- Disabled Port: A port that is not participating in STP.
Example: In a network with three switches, Port 1 on Switch B might be designated as the Root Port because it has the lowest path cost to the Root Bridge (Switch A). Port 2 on Switch B might be designated as an Alternate Port, ready to take over if Port 1 fails.
6. Port States
Port States define the operational status of a port during the STP convergence process. Common states include:
- Blocking: The port does not forward traffic and only listens to BPDUs.
- Listening: The port is preparing to forward traffic but is not yet doing so.
- Learning: The port is learning MAC addresses but is not yet forwarding traffic.
- Forwarding: The port is actively forwarding traffic.
- Disabled: The port is administratively disabled and does not participate in STP.
Example: When a network is first powered on, all ports start in the Blocking state to prevent loops. After a few seconds, they transition to the Listening state, then to the Learning state, and finally to the Forwarding state, ensuring a loop-free topology before traffic begins to flow.