Now that the network is installed, each switch has a bridge ID number, and the root switch has been elected, the next step is for each switch to perform a calculation to determine the best link to the root switch. Each switch will do this by comparing the path cost for each link based on the speed.
For paths that go through one or more other switches, the link costs are added. The switch compares this aggregate value to the other link costs to determine the best path to the root switch.
For example, switch 2 has multiple connections back to the root switch. It selects the 1000 Mbps connection on the trunk (port 1) over the 100 Mbps connection on port 9 because the path cost (see below) for the link is lower. Port 1 is now a forwarding port and port 9 is a blocking port; however, port 9 still receives BPDUs from the root switch.
Link Speed | 10 Mbps | 100 Mbps | 1 Gbps | 10 Gbps |
Path Cost | 100 | 19 | 4 | 2 |
All ports on the root switch are forwarding ports. Each of the other switches in this network has one forwarding port to the root and one or more blocking ports eliminating the loop in the network.
While the network is functioning, the root and the other switches communicate with each other via BPDUs and maintain timers to monitor the links and make adjustments if necessary.
Here are the common STA timers:
- Hello time: The interval at which the root switch sends out BPDUs. The default setting is two seconds. This is a type of keep-alive message that is a short message indicating that everything is okay and that the root switch is functioning correctly.
- Maximum age time: The time a switch stores a BPDU. The default setting for this is twenty seconds. If the root fails and does not send out its BPDUs, after twenty seconds the switches recognize the problem and enter a listening and learning state to collect information about the network via BPDUs from other switches. If necessary, a new root switch is elected and new links chosen for connecting to the root switch.
- Forward delay time: The duration of the listening and learning states while the network is analyzed by STA. The default setting is fifteen seconds. Normally, a port is either forwarding or blocking, but during the initial implementation or during any other topology changes, a port temporarily enters a listening and learning state to determine who is the root and the best paths back to the root from its perspective.
For example, the root switch goes down and fails to send its BPDUs every two seconds. After twenty seconds, each switch examines its maximum age time and declares that the root switch is down. Each switch enters a fifteen second listening and fifteen second learning state to determine the bridge ID of the new root switch and the path selection to the root switch. It takes a total of fifty seconds to go through this process before network connectivity is fully restored.
When a topology change occurs, the STA identifies the problem and takes corrective action.
As an example, Switch 1 is the root and has two connections to switch 4. Port 1 on the switch is a 100BaseFX connection and port 4 is a 10BaseFL connection. Switch 4 uses port 1 for forwarding and port 4 for blocking.
Suppose an accident occurs. The fiber optic riser cable containing the 100BaseFX connection on port 1 of Switch 4 is cut, so the link is down. After twenty seconds, Switch 4 has not seen any BPDUs on port 1, but continues to receive the BPDUs on port 4. Switch 4 will now change the port status of port 1 to blocking and port 4 to forwarding to provide connectivity from Switch 4 to the root.
If the original 100BaseFX connection is repaired, Switch 4 recognizes the repair when it begins getting the BPDUs on port 1 again. Switch 4 reverts back to the 100 Mbps connection over the 10 Mbps connection because of the path cost comparison.
Your network traffic may require multiple links between switches to handle heavier loads or deal with import links. Normally, when multiple links exist between switches, the Spanning Tree Algorithm disables the redundant links to eliminate a loop in the network.
IEEE’s 802.1ax specification includes the LACP (Link Aggregation Control Protocol). It offers the solution of combing several physical ports into a single logical channel. LACP lets a network switch negotiate automatic link bundling. To do this, a switch sends LACP packets to another directly connected switch that also runs LACP.
LACP sends LACPDUs (LACP Data Units) on all links on which a manager has configured the protocol. If it finds a switch on the other end that a manager has also configured LACP, it will independently send frames on the same links. This lets the two switches detect multiple links between them so they can combine them into a single logical channel.
A manager may configure LACP in active or passive mode. In active mode, it always sends frames on the configured links. In passive mode, it waits to hear LACPDUs before acting. This prevents accidental loops as long as the other device is in active mode.
Related Courses
Understanding Networking Fundamentals
Internetworking Multilayer Switches
Network+ Prep Course (N10-005)