RSTP / RPVST Explained with Examples

A switching loop occurs when a switch has more than one path to reach a destination. Switches forward broadcast frames from all ports except for the incoming port. If the network contains a switching loop, switches will receive their forwarded frame back on other ports. They will forward them again. This cycle will never end. A network never works with a switching loop. Spanning tree protocol removes switching loops. It dynamically builds a virtual topology of the network, finds loops, and blocks the ports that cause the loops. 

There are many variations of the spanning tree protocol. The two most popular and widely used variations are STP and RSTP. RSTP is the upgraded version of STP. STP and RSTP use a similar mechanism to find and remove loops. However, RSTP takes a shorter time to reach convergence. Convergence is a state when the switch forwards user frames.

RSTP port states

Ports on an RSTP switch go through the following three states to reach convergency.

  1. Discarding
  2. Learning
  3. Forwarding

Discarding state

When a switch starts or a network change occurs, the switch moves all ports in the discarding state. In this state, the switch does not accept user frames. It accepts only BPDUs. A BPDU is an STP frame. It includes all the information STP/RSTP needs to learn and build the network topology.

Learning State

In the learning state, the switch accepts user frames but does not forward them. From the incoming frames, it builds the CAM table entries.

Forwarding state

In the forwarding state, the switch accepts and forwards user frames.

Electing the root bridge

All STP/RSTP running switches elect one switch as the root bridge. After electing the root bridge, they check all network paths. If a switch has more than one path to reach the root path, it chooses only one path to reach the root bridge. Apart from the root bridge, all other switches become the non-bridge switches.

RSTP port types

There are five RSTP port types. These types are root, alternative, destinated, backup, and disabled. A port can play one role. A root port connects the non-root bridge switch to the root bridge switch. The non-root bridge switch uses the alternative port to reach the root bridge when the link connected to the root port fails. A designated port connects the non-root bridge switch to the local segment. The non-root bridge switch uses the backup port to reach the local segment when the link attached to it fails. A disabled port does not forward any user frames. It removes loops.

RSTP Packet Tracer LAB

Create a packet tracer lab, as shown in the following image.

Cisco lab

Download the above packet tracer lab.

By default, all Cisco switches run STP. We can use the show spanning-tree command in privileged exec mode to verify it. Run this command on S1.

default show spanning-tree

As the above output shows, the switch is running STP. If you see IEEE in the output, it indicates the switch is running STP.

A long ago, DCE developed the original version of STP. It is called DCE's STP. Later, IEEE developed an open-sourced version of STP. Cisco improved it for its switches. It is called PVST. STP/PVST has slow convergence. IEEE updated the STP to speed up the convergence. The updated version is called RSTP. Cisco also updated its variation for the same reason. The updated version is called RPVST. PVST/RPVST is similar to STP/RSTP but has some additional features. Both use the same terminology and algorithm.

RSTP / RPVST configuration

The spanning-tree mode command changes the STP mode. The following command changes the STP mode to RSTP.

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

configure RSTP on S1

STP and RSTP are compatible. You can run both on the same network. However, it will increase the network convergence time. Since the network is running both, it will converge when STP finishes its operation. If all switches are RSTP compatible, you should use only RSTP to speed up convergence and utilize the added benefits of RSTP.

Configure RSTP / RPVST on S2.

configure rstp on s2

Configure RSTP / RPVST on S3.

configure rstp on s3

Download the configured packet tracer lab.

Verifying RSTP / RPVST ports

The show spanning-tree command displays all information about the STP instances. The following image shows the output of this command on S1.

show spanning-tree on S1

S1 is the root bridge. On the root bridge, all ports are designated ports.

The following image shows the output of this command on S2.

show spanning-tree on S2

S2 is a non-root bridge switch. It has a root and a designated port.

The following image shows the output of this command on S3.

show spanning-tree on S3

S3 is a non-root bridge switch. It has a root port and an alternate port. The alternate port remains blocked till the root port is up. If the root port goes down, the switch enables the alternate port.

The following image shows the output of the spanning-tree command on S3 when the link connected to the root port is down.

s3 one link down

The following image shows the output of the spanning-tree command on S3 when the link connected to the root port is up again.

non root bridge s3

Conclusion

RSTP / RPVST dynamically manages all links. If a link creates a loop, it blocks the connected port. If a link goes down, it automatically enables the backup link to maintain the connectivity.

ComputerNetworkingNotes CCNA Study Guide RSTP / RPVST Explained with Examples