Rapid PVST+ and RSTP

Rapid STP elects the root and picks root ports with STP's own rules, but lets a spare port take over far faster. It adds the alternate port, which replaces a failed root port, and the backup port; it merges disabled and blocking into one discarding state and has no listening state. Rapid PVST+ runs a separate rapid tree for each VLAN.

In Daveth Pro (Network)15 min video · lab: Spanning tree

By , founder of Daveth · Updated

Opening frame of the video walkthrough of Rapid PVST+ and RSTP

Watch this lesson

15 min · Video walkthrough

In Daveth Pro (Network)

The full 15 min walkthrough is in Daveth Pro (Network). See what the plan opens

Upcoming practical lab

Lab N8: Spanning tree

What the lab covers

What this page answers

What is RSTP (Rapid Spanning Tree)?

The newer version of spanning tree. It elects the root and picks root ports with the same rules as STP, but an alternate port can replace a failed root port with no wait, so the tree converges much faster. Read it in “Why a faster spanning tree”

What are the RSTP port roles?

Root port, alternate port (replaces the root port when it fails), designated port, backup port (replaces a designated port when it fails) and disabled port. Read it in “RSTP port roles”

What is PVST+ (Per-VLAN Spanning Tree)?

A separate spanning tree for each VLAN, so each VLAN can block a different port and traffic is balanced over more links. PVST+ and Rapid PVST+ are one vendor's protocols; MSTP is the standards body's answer. Read it in “One tree per VLAN”

Why a faster spanning tree

Monday, 11 a.m., after 03.3.3's half minute. "Half a minute is fine for email," Maya says. "It's not fine in the middle of a video call on the meeting-room PC." The fix doesn't change the cables or the elections. It changes how quickly a spare port is allowed to take over.

The newer version of spanning tree is Rapid STP, RSTP. It works like STP in most ways:

  1. It elects the root switch with the same rules and tiebreakers.
  2. It picks each switch's root port with the same rules.
  3. It picks the designated port on each link with the same rules and tiebreakers.
  4. It puts each port in forwarding or blocking, though RSTP calls blocking discarding.

It works so much like STP that both can run in the same network: RSTP features on the switches that support them, STP on the rest. So why bother? Convergence. STP can take 50 seconds with its default timers when every wait applies, as 03.3.3 showed. RSTP usually converges within a few seconds, or about 10 in slow conditions.

It gets there by not waiting on timers where it can avoid it. It can replace a root port without any wait to reach forwarding, in some conditions, and do the same for a designated port. Where it still has to wait, the waits are shorter: its MaxAge is 3 times the Hello timer, not 10. And rather than wait, a switch can send its neighbour a message asking whether something has gone wrong. With RSTP each switch also creates its own Hellos, rather than only passing on the root's.

STP waits to see whether its neighbour is still there. RSTP just asks.

RSTP port roles

RSTP keeps the root port and the designated port, adds the alternate and backup roles for spares, and lists disabled ports too:

RoleWhat it does
Root portThe port that begins a nonroot switch's best path to the root
Alternate portReplaces the root port when the root port fails
Designated portThe switch port designated to forward onto a link
Backup portReplaces a designated port when that designated port fails
Disabled portA port that is administratively disabled

An alternate port is another way to the same root. To be one, a port must receive Hellos naming the same root switch as the root port does, and be neither the root port nor designated. It's the second-best choice for the root port, kept ready. In the office, SW3's Gi0/2, Sam's cable, hears Hellos naming LAB-SW1 as root, just as its root port Gi0/1 does, so in VLAN 10 Gi0/2 is SW3's alternate port. (Disabled covers a port that's been shut down, and also, as you'll see below, one whose cable has failed.)

It works kind of like a spare key already cut and hanging by the front of the house: nobody uses it, but nobody has to go and find a locksmith either. (Where it stops: anyone can pick up a spare key. An alternate port only takes over when the root port fails or its Hellos stop, and only for that switch.)

The alternate port in action

Here is the office. All three switch-to-switch cables are trunks carrying VLANs 10 and 20, and the meeting-room PC is on SW3's Fa0/13, an access port in VLAN 10. On Tuesday lunchtime, with every switch now running the rapid version (the configuration is further down this page), Maya pulls the meeting-room cable, SW2's Gi0/1 to SW3's Gi0/1, herself. Here is what SW3 does:

  1. Interactive tool: RSTP: SW3 loses its VLAN 10 root port trunks: VLANs 10, 20 access port, VLAN 10 LAB-SW1 SW2 SW3 Room Gi0/1 · DP Fa0/24 · DP Gi0/2 · RP Gi0/1 · DP Gi0/2 · Altn · discarding Gi0/1 · RP Fa0/13 Before the failure VLAN 10, Rapid PVST+ running. Gi0/1 is SW3's root port. Gi0/2, Sam's cable, hears Hellos naming the same root, LAB-SW1, so it is an alternate port: discarding, and ready.

    Step 1 of 5

  2. Interactive tool: RSTP: SW3 loses its VLAN 10 root port trunks: VLANs 10, 20 access port, VLAN 10 LAB-SW1 SW2 SW3 Room Gi0/1 · DP Fa0/24 · DP Gi0/2 · RP Gi0/1 · disabled Gi0/2 · Altn · discarding Gi0/1 · disabled Fa0/13 Step 1 of 4 Step 1. The meeting-room cable fails, so SW3's root port, Gi0/1, fails.

    Step 2 of 5

  3. Interactive tool: RSTP: SW3 loses its VLAN 10 root port trunks: VLANs 10, 20 access port, VLAN 10 LAB-SW1 SW2 SW3 Room Gi0/1 · DP Fa0/24 · DP · MAC flush Gi0/2 · RP Gi0/1 · disabled Gi0/2 · Altn · discarding Gi0/1 · disabled Fa0/13 RSTP messages Step 2 of 4 Step 2. SW3 and LAB-SW1 exchange RSTP messages over Sam's cable to confirm that Gi0/2 will now be SW3's root port. LAB-SW1 flushes the MAC tab

    Step 3 of 5

  4. Interactive tool: RSTP: SW3 loses its VLAN 10 root port trunks: VLANs 10, 20 access port, VLAN 10 LAB-SW1 SW2 SW3 Room Gi0/1 · DP Fa0/24 · DP Gi0/2 · RP Gi0/1 · disabled Gi0/2 · RP · discarding Gi0/1 · disabled Fa0/13 Step 3 of 4 Step 3. SW3 gives Gi0/1 the disabled role and Gi0/2 the root port role.

    Step 4 of 5

  5. Interactive tool: RSTP: SW3 loses its VLAN 10 root port trunks: VLANs 10, 20 access port, VLAN 10 LAB-SW1 SW2 SW3 Room Gi0/1 · DP Fa0/24 · DP Gi0/2 · RP Gi0/1 · disabled Gi0/2 · RP · forwarding Gi0/1 · disabled Fa0/13 Step 4 of 4 Step 4. SW3 moves Gi0/2 straight to forwarding, without the learning state: this is one case where RSTP knows the change can't create a loop. None of it waits on a timer;

    Step 5 of 5

When the root port fails, or Hellos stop arriving on it, the switch changes the old root port's role to disabled and its state from forwarding to discarding. Then, without waiting on any timer, it makes the alternate port the root port and puts it straight into forwarding. It doesn't spend time in learning. In a lab, a change like this takes about a second: the meeting-room PC barely notices, where on Monday it lost half a minute.

The spare port already knew whose side it was on. It just needed a nod from LAB-SW1.

RSTP states and processes

RSTP keeps the learning and forwarding states, for the same purposes as STP. It doesn't define a listening state at all. And it uses one state, discarding, for what STP called two: disabled, where the interface is administratively down, and blocking, where it works but STP chooses not to forward to avoid loops.

What the port doesSTP stateRSTP state
Administratively disabledDisabledDiscarding
Stable; ignores incoming data frames and doesn't forward themBlockingDiscarding
Passing through; no MAC learning, no forwardingListeningNot used
Passing through; MAC learning, no forwardingLearningLearning
Stable; MAC learning and forwardingForwardingForwarding

Why could STP never skip ahead? When the tree changes, old MAC table entries can cause a loop. STP's switches tell each other the topology has changed and to time those entries out using the forward delay, which is why a port has to sit in listening and then learning, 15 seconds each. RSTP's switches tell each other the topology has changed, and the same messages tell their neighbours to flush the entries that could cause a loop, straight away. That's the flush in step 2 above. So RSTP has more cases where a discarding port can go straight to forwarding, without waiting and without learning.

Just like when you clear out the risky things in the fridge rather than waiting for them to go off, the flush gets rid of the dangerous entries now. (Where it stops: a fridge clear-out is a guess. The switches remove every entry that could cause a loop.)

The backup port

The backup port does for a designated port what the alternate does for a root port. It only arises when one switch has two ports on the same link, which takes a hub: say a switch connects two ports to one hub. One of those ports wins the designated port election; the other becomes its backup. If the designated port fails, the backup takes over as designated, with no delay moving from discarding to forwarding.

Hubs are rare today, so you're unlikely to meet a backup port outside an exam. The office has none: every link is one cable between two devices.

RSTP port types

RSTP also names ports by what's on the other end of the cable:

  1. Point-to-point: the link connects exactly two devices. Between two switches, like all three of the office's trunks, the ports are simply point-to-point ports.
  2. Point-to-point edge, or just edge: the other end is a single end device, like a PC or server, at the edge of the network. SW3's Fa0/13, with only the meeting-room PC on it, is that kind of port by definition. The switch only treats it as an edge port once it's configured as one, which is the next topic.
  3. Shared: connected to a hub. Hubs make the switch port use half duplex, so RSTP treats every half-duplex port as shared. It converges more slowly on shared ports than on point-to-point ones.

An access VLAN tells you about the traffic. It doesn't tell you who is plugged into the far end.

One tree per VLAN

The first STP standard, 802.1D in 1990, came before VLANs and made one spanning tree for the whole LAN, a common spanning tree. Once LANs had VLANs, one tree meant every VLAN blocked the same port. With a separate tree per VLAN, each VLAN can block a different port, so traffic is balanced over more of the links.

Three ways to get more than one tree came out of that history. PVST+ and Rapid PVST+ are one vendor's own protocols; MSTP is the standards body's answer. These switches offer the three through the spanning-tree mode command; they don't offer STP or RSTP with a single common tree at all:

NameBased onTreesOriginal standardspanning-tree mode
STPSTP1 (common spanning tree)802.1Dnot available
PVST+STP1 per VLAN802.1Dpvst
RSTPRSTP1 (common spanning tree)802.1wnot available
Rapid PVST+RSTP1 per VLAN802.1wrapid-pvst
MSTPRSTP1 or more, as the designer chooses802.1smst

Rapid PVST+ is RSTP run once for each VLAN, and it's what the office will use. It works a little differently from standard RSTP:

Standard RSTPRapid PVST+
TreesOne, the common spanning treeOne per VLAN
Messages (BPDUs)One set, however many VLANsOne set per VLAN
Destination MAC0180.C200.00000100.0CCC.CCCD
On a trunkIn the native VLAN, untaggedEach VLAN's messages inside that VLAN, tagged
VLAN ID in the messageNoYes, in an extra field
System ID extensionAll zeros: no VLANThe VLAN ID