Nondesignated Port (Blocking)

Designated Port (Forwarding)

10 Mbps

NOTE Notice that STP terminology refers to the devices as bridges rather than switches.

Within an STP network, one switch is elected as the root bridge—it is at the root of the spanning tree. All other switches calculate their best path to the root bridge. Their alternative paths are put in the blocking state. These alternative paths are logically disabled from the perspective of regular traffic, but the switches still communicate with each other on these paths so that the alternative paths can be unblocked in case an error occurs on the best path.

All switches running STP (it is turned on by default in Cisco switches) send out Bridge Protocol Data Units (BPDU). Switches running STP use BPDUs to exchange information with neighboring switches. One of the fields in the BPDU is the bridge identifier (ID); it comprises a 2-octet bridge priority and a 6-octet MAC address. STP uses the bridge ID to elect the root bridge—the switch with the lowest bridge ID is the root bridge. If all bridge priorities are left at their default values, the switch with the lowest MAC address therefore becomes the root bridge. In Figure 1-19, switch Y is elected as the root bridge.

All the ports on the root bridge are called designated ports, and they are all in the forwarding state—that is, they can send and receive data. The STP states are described in the next section.

On all nonroot bridges, one port becomes the root port, and it is also in the forwarding state. The root port is the one with the lowest cost to the root. The cost of each link is by default inversely proportional to the link's bandwidth, so the port with the fastest total path from the switch to the root bridge is selected as the root port on that switch. In Figure 1-19, port 1 on switch X is the root port for that switch because it is the fastest way to the root bridge.

NOTE If multiple ports on a switch have the same fastest total path costs to the root bridge, STP considers other BPDU fields. STP looks first at the bridge IDs in the received BPDUs (the bridge IDs of the next switch in the path to the root bridge); the port that received the BPDU with the lowest bridge ID becomes the root port. If these bridge IDs are also equal, the port ID breaks the tie; the port with the lower port ID becomes the root port. The port ID field includes a port priority and a port index, which is the port number. Therefore, if the port priorities are the same (for example, if they are left at their default value), the lower port number becomes the root port.

Each LAN segment must have one designated port. It is on the switch that has the lowest cost to the root bridge (or, if the costs are equal, the port on the switch with the lowest bridge ID is chosen), and it is in the forwarding state. In Figure 1-19, the root bridge has designated ports on both segments, so no more are required.

NOTE The root bridge sends configuration BPDUs on all its ports periodically—every 2 seconds, by default. These configuration BPDUs include STP timers, therefore ensuring that all switches in the network use the same timers. On each LAN segment, the switch that has the designated port forwards the configuration BPDUs to the segment; every switch in the network therefore receives these BPDUs on its root port.

All ports on a LAN segment that are not root ports or designated ports are called nondesignated ports and transition to the blocking state—they do not send data, so the redundant topology is logically disabled. In Figure 1-19, port 2 on switch X is the nondesignated port, and it is in the blocking state. Blocking ports do, however, listen for BPDUs.

If a failure happens—for example, if a designated port or a root bridge fails—the switches send topology change BPDUs and recalculate the spanning tree. The new spanning tree does not include the failed port or switch, and the ports that were previously blocking might now be in the forwarding state. This is how STP supports the redundancy in a switched network.

STP States

Figure 1-20 illustrates the various STP port states.

Figure 1-20 A Port Can Transition Among STP States


50 seconds max age = 20 seconds forward delay = 15 seconds forward delay = 15 seconds




- listen for BPDUs send and receive BPDUs elect root bridge, select root ports and designated ports can populate MAC address table send and receive BPDUs send and receive data send and receive BPDUs

When a port initially comes up, it is put in the blocking state, in which it listens for BPDUs and then transitions to the listening state. A blocking port in an operational network can also transition to the listening state if it does not hear any BPDUs for the max-age time (a default of 20 seconds). While in the listening state, the switch can send and receive BPDUs but not data. The root bridge and the various final states of all the ports are determined in this state.

If the port is chosen as the root port on a switch, or as a designated port on a segment, that port transitions to the learning state after the listening state. In the learning state, the port still cannot send data, but it can start to populate its MAC address table if any data is received. The length of time spent in each of the listening and learning states is dictated by the value of the forward-delay parameter, which is 15 seconds by default. After the learning state, the port transitions to the forwarding state, in which it can operate normally. Alternatively, if in the listening state the port is not chosen as a root port or designated port, it becomes a nondesignated port and transitions back to the blocking state.


Do not confuse the STP learning state with the learning process that the switch goes through to populate its MAC address table. The STP learning state is a transitory state. Although a switch can learn MAC addresses from data frames received on its ports that are in the STP learning state, it does not forward those frames. In a stable network, switch ports are in either the forwarding or blocking state. Ports in the blocking state do not listen to data frames and therefore do not contribute to the switch's MAC address table. Ports in the forwarding state do, of course, listen to (and forward) data frames, and those frames populate the switch's MAC address table.

Several features and enhancements to STP are implemented on Cisco switches to help to reduce the convergence time—the time it takes for all the switches in a network to agree on the network's topology after that topology has changed.

Rapid STP

Rapid STP (RSTP) is defined by IEEE 802.1w. RSTP incorporates many of the Cisco enhancements to STP, resulting in faster convergence. Switches in an RSTP environment converge quickly by communicating with each other and determining which links can forward, rather than just waiting for the timers to transition the ports among the various states. RSTP ports take on different roles than STP ports. The RSTP roles are root, designated, alternate, backup, and disabled. RSTP port states are also different from STP port states. The RSTP states are discarding, learning, and forwarding. RSTP is compatible with STP. For example, 802.1w alternate and backup port states correspond to the 802.1d blocking port state.

Was this article helpful?

0 0
Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook

Post a comment