contact@embeddedgeeks.com
Embedded World

All about RSTP !

What is RSTP?

RSTP (Rapid Spanning Tree Protocol) is an evolution of STP. It was originally introduced as IEEE 802.1w standard and in 2004 IEEE decided to replace STP with RSTP in 802.1D standard. Finally, in 2011, in the IEEE decided to move all the RSTP details into 802.1Q standard.

RSTP is backwards-compatible with STP and there are many similarities between the two protocols, such as:

  • the root switch is elected using the same set of rules in both protocols
  • root ports are selected with the same rules, as well as the designated port on LAN segments
  • both STP and RSTP place each port in either forwarding or blocking state. The blocking state in RSTP is called the discarding state.

However, there are differences between STP and RSTP:

  • RSTP enables faster convergence times than STP (usually within just a couple of seconds)
  • STP ports states listening, blocking, and disabled are merged into a single state in RSTP – the discarding state
  • STP features two port types – root and designated port. RSTP adds two additional port types – alternate and backup port.
  • with STP, the root switch generates and sends Hellos to all other switches, which are then relayed by the non-root switches. With RSTP, each switch can generate its own Hellos.

Consider the following network topology with RSTP turned on:

RSTP example topology

In order to avoid loops, RSTP has placed one port on SW3 in the alternate state. This port will not process or forward any frames except the RSTP messages. However, if the root port on SW3 fails, the alternate port will rapidly become the root port and start forwarding frames.

How RSTP works

Just like STP, RSTP creates a topology database of the network. To prevent loops, some interfaces on switches are placed in forwarding state and other interfaces in discarding state. How does RSTP decides in which state the port will be placed? A couple of criteria exist:

1. all switches in a network elect a root switch. All working interfaces on the root switch are placed in a forwarding state.
2. all other switches, called non-root switches, determine the best path to get to the root switch. The port used to reach the root switch (root port) is placed in a forwarding state.
3. on the shared Ethernet segments, the switch with the best path to reach the root switch is placed in a forwarding state. That switch is called the designated switch and its port is known as the designated port.
4. all other interfaces are placed in the discarding state and will not forward frames. NOTE
RSTP is backward-compatible with STP and they both can be used in the same network.

Consider the following example:

How RTSP works

Let’s say that SW1 is elected as the root switch. All ports on SW1 are placed in the forwarding state. SW2 and SW3 choose ports with the lowest cost to reach the root switch to be the root ports. These ports are also placed in a forwarding state. On the shared Ethernet segment between SW2 and SW3, port Fa0/1 on SW2 has the lowest cost to reach the root switch. This port is placed in a forwarding state. To prevent loops, port Fa0/1 on SW3 is placed in a discarding state. If the root port on SW3 fails, this alternate port will quickly take over and become the root port.NOTE
RSTP also introduces a concept of the backup port. This port serves as a replacement for the designated port inside the same collision domain. This can only occur when using hubs in your network.

Configuring RSTP

Most newer Cisco switches use RSTP by default. RSTP prevents frame looping out of the box and no additional configuration is necessary. To check whether a switch runs RSTP, the show spanning-tree command is used:

SW1#show spanning-tree 
VLAN0001
  Spanning tree enabled protocol rstp
  Root ID    Priority    32769
             Address     0004.9A47.1039
             This bridge is the root
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     0004.9A47.1039
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/3            Desg FWD 19        128.3    P2p
Fa0/2            Desg FWD 19        128.2    P2p

If RSTP is not being used, the following command will enable it:

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

Most other configuration options (electing root switch, selecting root and designated ports) are similar to the ones used in STP.