All switches on a network using STP will exchange BDPUs. Switches will exchange BDPUs to:
- Designate a single Root Bridge
- Determine the shortest path from each switch back to the root
- Select a designated switch for each LAN to forward data back to the root
- Designate a port for each switch that provides the best path back to the root
- Determine which ports should be blocked.
BPDU messages are used to designate the bridge root for the spanning tree network and elect a designate bridge for each LAN segment. The exchange of BDPUs also results in placing redundant switched ports into a backup state. Any paths back to the bridge root that are not required are placed into STP-blocked mode. This is essentially how the loops are eliminated.
If a topology change occurs such as a link coming online or a link going down, the network must converge on a new stable configuration (keep in mind that with STP, this can take anywhere from a few seconds to several minutes). Ports must wait for the topology change until they can begin forwarding frames again.
When a topology change does occur, a device will send out a special BDPU known as a Topology Change Notification. The message is sent through the switches designated port and forwarded by any device until it reaches the bridge root. The root bridge will then send out a BDPU down the spanning tree notifying all switches of the topology change.
At any given time, every port on a switch with the Spanning Tree Protocol enabled can be in one of five states. These port states are outlined in the list below:
- Disabled – A port that is in a disabled state will not send nor receive packets. It has been put in a disabled state by an administrator or it is not functioning.
- Blocking – Ports in a blocking state are on stand-by. Any ports in this state will listen for BDPU messages but do not transmit any packets.
- Listening – A port in listening state does not transmit normal traffic only BDPU messages.
- Learning – A learning port listens to network traffic in order to fill its address table during a topology change so it will not have to flood messages out every port when it goes active. It stays in this state for the length of the forward delay timer.
- Forwarding – A forwarding port forwards frames as the designated port of the switch. This is the normal active mode for a switch. Root ports and designated ports will be in a forwarding state.
STP can take several seconds or even minutes to converge as it detects changes in network topology and generates a new topology. This can be too long for some applications. To reduce the convergence time, you can enable the Fast Link option.
Using the Fastlink option, you can disable STP on certain ports. This is done to reduce the convergence time since ports are set to Blocking mode until STP can determine if there are any loops within the topology.
An example of when this option may be used is to eliminate issues that may result with DHCP clients that boot too fast. When a DHCP client boots up while a port is in blocking mode, it can prevent the client from obtaining an IP address.