802.1w (Rapid Spanning Tree Protocol)

RSTP significantly speeds the recalculation of the spanning tree when the network topology changes. RSTP defines the additional port roles of Alternate and Backup and defines port states as discarding, learning, or forwarding. The 802.1D STP standard was designed with the understanding that recovering connectivity after an outage within a minute or so gives adequate performance. With the interdiction of layer 3 switches in the LAN environment, switching is now competing with routing protocols which can provide an alternative path in approximately 1sec. RSTP defines new variations on BPDUs between switches, new port states, and new port roles, all with the capability to operate backwardly compatible with 802.1d switches.

The following the key components that can speed up this convergence with RSTP;

  • Waiting for only three missed Hellos on an RP before reacting (versus ten missed Hellos via the Maxage timer with 802.1d)
  • New processes that allow transition from the disabled state (replaces the blocking state in 802.1d) to learning state, bypassing the concept of an 802.1d listening state
  • Standardization of features like Cisco PortFast, UplinkFast, and BackboneFast
  • An additional feature to allow a backup DP when a switch has multiple ports connected to the same shared LAN segment

Cisco did try to make the original 802.1D work faster when it came to link failures by adding in such feathers as UplinkFast, BackboneFast, and PortFast to speed up the convergence time. The only drawback to these feathers then was that they are proprietary and do need additional configuration.

To support these new processes, RSTP uses the same familiar Hello BPDUs, using some previously undefined bits to create the new features. RSTP takes advantage of a switched network topology by categorizing ports, using a different link type to describe each. RSTP takes advantage of the fact that STP logic can be simplified in some cases, based on what is attached to each port. The following are the three different link types that RSTP uses to tell each port type apart;

  • Point-to-Point – Connects a switch to another switch
  • Shared – Connects a switch to a hub
  • Edge – Connects a switch to a single end-user device

RSTP knows that link-type edge means the port is connected to one device, and that device is not a switch. So, RSTP treats edge links with the same logic as Cisco PortFast. (Note – the same spanning-tree portfast command defines a port as link-type edge to RSTP) RSTP puts edge links into forwarding state immediately. RSTP takes advantage of point-to-point links by asking the other switch about its status. For instance, if one switch fails to receive its periodic Hello on a point-to-point link, it will query the neighbor. The neighbor will reply, stating whether it also lost its path to the root. It is the same logic as BackboneFast.

RSTP selects one switch as the root of an active spanning-tree–connected topology and  assigns port roles to individual ports on the switch, depending on whether the ports are part of the active topology.RSTP provides rapid connectivity following the failure of a switch, switch port, or LAN. A new root port and the designated port of the connecting bridge transition to forwarding through an explicit handshake protocol between them. RSTP enables switch-port configuration so that the ports transition to forwarding directly when the switch reinitializes.

RSTP Port States: RSTP has only three port states, corresponding to the three possible operational statuses: discarding, learning, and forwarding. The RSTP 802.1w discarding state represents a merger of the 802.1D STP port states of disabled, blocking, and listening.

  • Discarding – This state is seen in both a stable active topology and during topology
    synchronization and changes. The discarding state prevents the forwarding of data frames, thus “breaking” the continuity of a Layer 2 loop.
  • Learning – This state is seen in both a stable active topology and during topology synchronization and changes. The learning state accepts data frames to populate the MAC table to limit flooding of unknown unicast frames.
  • Forwarding – This state is seen only in stable active topologies. The forwarding switch ports determine the topology. Following a topology change, or during synchronization, the forwarding of data frames occurs only after a proposal and agreement process.

IEEE 802.1D STP mixes the state of a port, whether blocking or forwarding traffic, with the role it plays in the active topology (root port, designated port, and so on). from an operational point of
view, there is no difference between a port in the blocking state and a port in the listening state. Both discard frames and do not learn MAC addresses. The real difference lies in the role the spanning tree assigns to the port. It can safely be assumed that a listening port is either designated or root and is on its way to the forwarding state. Unfortunately, when in the forwarding state, there is no way to infer from the port state whether the port is root or  designated. RSTP considers there to be no difference between a port in blocking state and a port in listening state; both discard frames, and neither learns MAC addresses. RSTP decouples the role of a port from the state of a port. In all port states, a port will accept and process BPDU frames. Establishing these additional port roles allows RSTP to have a standby switch port ready before a failure or topology change happens. The alternate port moves to the forwarding state if a failure occurs on the designated port for the segment.

  • Root ports: Do not use the link type parameter. Root ports can make a rapid transition to the forwarding state as soon as the port receives the BPDU of the root and it puts the  nondesignated ports in blocking state. This operation is called sync.
  • Alternative and backup ports: Same as the Alternate Port concept in UplinkFast; an alternate Root Port. Do not use the link type parameter in most cases because these ports need to arrive at these states based on the operation of the RSTP. The only times you would configure link type parameter explicitly is when you understand the final state of these ports due to your full understanding of the topology.
  • Designated ports: A port that is attached to the same link-type shared link as another port on the same switch, but the other port is the DP for that segment. The Backup Port is ready to take over if the DP fails. Make the most use of the link type parameter. Rapid transition to the forwarding state for the designated port occurs only if the link type parameter indicates a point-to-point link.

Rapid Transition to Forwarding: Before the introduction of 802.1w, the spanning tree algorithm waited passively for the network to converge before transitioning a port to the forwarding state. RSTP algorithm will confirm that a  port can transition safely to forwarding without relying on a timer to be configured. To achieve this fast convergence the protocol relies on the following two variables;

  1. Link type
  2. Edge port

Link types allow RSTP to categorize each port that is participating in the spanning-tree topology. This is done by using the duplex mode on the port. A port in full-duplex is assumed to be a point-to-point, where a half-duplex port is seen as a shared port by default. In most switched networks today most links operate in full-duplex mode and are treated as point-to-point links by RSTP. This will make them candidates for rapid transition to the forwarding state.

RSTP Link Types:

  • Point-to-point – Port operating in full-duplex mode. It is assumed that the port is connected to a single switch device at the other end of the link.
  • Shared – Port operating in half-duplex mode. It is assumed that the port is connected to shared media where multiple switches might exist.
  • Edge Port – ports that directly connect to end stations anticipate that no switch device will be connected to them, so they immediately transition to the STP forwarding state, thereby skipping the time-consuming listening and learning stages. Neither edge ports
    nor PortFast-enabled ports generate topology changes when the port transitions to a  disabled or enabled status.

Ports that are directly connected to end stations typically cannot create bridging loops in the network; therefore, they are allowed to transition directly to forwarding, skipping the listening and learning stages. If an edge port receives a BPDU, it immediately loses its edge port status and becomes a normal spanning-tree port. An edge port that receives a BPDU immediately loses its edge port status and becomes a normal spanning-tree port. When an edge port receives a BPDU, it generates a topology change notification (TCN).

When a port is selected to be a designated port, 802.1D will wait two times the forwarding delay (2×15 by default) before going into forwarding state. In RSTP, the port will be assigned as the designated port role but will be in the blocking state until it receives a BPDU telling it to change its state to forwarding. When a designated port is in a discarding or learning state (and only in this case), it sets the proposal bit on the BPDUs it sends out. This proposal bit is notifing the downstream switch that this port is the designated port and they will need to set their end of the link to be the root port. This will starts a sync process that puts nonedge designated ports in blocking state on each switch that receives the new proposal within the BPDU, as it needs to verify that all its ports are in-sync with the new superior BPDU received. The downstream switch will send a agreement message reply to the root. The message is a copy of the proposal BPDU with the agreement bit set instead of the proposal bit. This wave of handshakes propagates quickly toward the edge of the network and quickly restores connectivity after a change in the
topology. If a designated discarding port does not receive an agreement after it sends a proposal, it slowly transitions to the forwarding state by falling back to the traditional 802.1D listening-learning sequence.

RSTP Topology Change Mechanism: When a switch loses its root port, it can put its best alternate port directly into forwarding mode. The selection of an alternate port as the new root port generates a topology change. The 802.1w topology change mechanism clears the appropriate entries in the MAC address tables of the upstream switches. With RSTP it has moved away from how 802.1D used it TCN, all switches reporting the change to the root who will tell every other switch about the change. The topology change propagation is now a one-step process. The initiator of the topology change is flooding this information throughout the network. This mechanism is much faster than the 802.1D equivalent. In RSTP only nonedge ports which move into forwarding state will cause topology changes. If a port was to move to blocking state it will not generate a TC BPDU.

When an RSTP switch detects a topology change it performs these actions;

  1. The RSTP switch starts the TC While timer with a value equal to twice the hello time for all its nonedge designated ports and its root port. The TC While timer is the interval during which the RSTP switch actively informs the rest of the switches in the network of a topology change.
  2. The RSTP switch flushes the MAC addresses associated with all nonedge ports.
  3. As long as the TC While timer is running on a port, the BPDUs sent out of that port have the TC bit set. While the timer is active, the switch sends BPDUs even on the root port.

When a switch receives a BPDU with the TC bit set from a neighbor, the switch performs these actions:

  1. The switch clears the MAC addresses learned on all its ports, except the one that received the topology change.
  2. The switch starts the TC While timer and sends BPDUs with TC set on all its designated ports and root port; RSTP does not use the specific TCN BPDU anymore unless a legacy bridge needs to be notified.

Compatibility with 802.1D: RSTP is backward compatible with legacy STPs but RSTP inherent fast convergence befits will be lost! Each port maintains a variable that defines the protocol to run on the corresponding segment. If the port consistently keeps receiving BPDUs that do not correspond to its current operating mode for two times the hello time, it switches to the other STP mode.

By default, 802.1D switches drop 802.1w BPDUs. This essentially means that in mixed 802.1D and 802.1w switched networks, 802.1D switches inevitably always end up initially sending  BPDUs.

The default spanning-tree mode for a Cisco Catalyst switch is PVST+ (Also Cisco does recommend that you run PVRST+ on your network whenever possible). In this mode a separate STP instance runs for each VLAN. This is unlike CST which only runs one STP instance for all VLANs.

PortFast: Spanning Tree PortFast causes an interface configured as a Layer 2 access port to enter the forwarding state immediately, bypassing the listening and learning states.When you enable PortFast on a layer2 port you are telling the switch that it is only going to be connecting to one signal workstation/server. This also puts that port into a link type Edge. You can enable PortFast on a trunk port too. This is done if you are running a VMs on a signal device that need many Vlans trunked down from the switch. When enabling PortFast on a port connecting to another switch, there is a risk of creating a bridging loop.

Enabling PortFast:

Enabling in global config will only affect access ports

switch(config)#spanning-tree portfast default

Enabling it on a signal port

switch(config-if)#spanning-tree portfast

Enabling portfast on trunk port:

switch(config-if)#spanning-tree portfast trunk

Enabling a port to be an access port and be in portfast:

switch(config-if)#switchport hostswitch                                                                                port mode will be set to access
spanning-tree portfast will be enabled
channel group will be disabled

Configuring PVRST+ on a switch:

switch(config)#spanning-tree mode rapid-pvst

switch(config)#spanning-tree vlan 2 root primary

switch(config)#spanning-tree vlan 3 root secondary