Sub topic 15
One tree per VLAN: PVST+ and Rapid PVST+
This chapter assumes you already know how a single spanning tree is built: root bridge election, root and designated ports, path cost, and the difference between classic 802.1D and Rapid STP. It also assumes you know what a VLAN and an 802.1Q trunk are. Here you will see what changes when each VLAN gets its own tree.
Why one tree is not enough
Plain 802.1D, and the 802.1Q standard that followed it, defines a single spanning tree for the whole switched network, called the Common Spanning Tree (CST). Every VLAN follows the same tree. That has two consequences:
- Whichever links are blocked are blocked for every VLAN. A redundant uplink carries no traffic at all until the active path fails.
- You cannot balance load across redundant links by VLAN.
Cisco's answer is Per-VLAN Spanning Tree Plus (PVST+). It runs a separate spanning tree instance for each VLAN. Each instance elects its own root bridge, computes its own port roles, and sends its own BPDUs.
Rapid PVST+ is the same idea built on Rapid STP (802.1w). It gives you one rapid instance per VLAN, with the faster convergence you saw in the Rapid STP chapter.
How PVST+ works
One instance per VLAN
Each VLAN runs a complete STP computation. The root bridge for VLAN 10 can be a different switch from the root bridge for VLAN 20. A port can be forwarding in VLAN 10 and blocking in VLAN 20 on the same trunk.
The extended system ID
The bridge ID has to be unique per VLAN instance, yet the priority field is only 16 bits wide. PVST+ splits it:
- The top 4 bits are the configurable priority.
- The lower 12 bits carry the VLAN number, called the extended system ID.
Because only 4 bits are configurable, priority moves in steps of 4096: 0, 4096, 8192, and so on up to 61440. The default is 32768. The effective priority of VLAN 10 at the default is 32768 + 10 = 32778. This is why the earlier configuration example insists that an explicit priority be a multiple of 4096.
How BPDUs are carried
On a trunk, the switch sends one BPDU per VLAN, each tagged with its own VLAN. The behavior depends on the trunk encapsulation:
- On 802.1Q trunks, the BPDU for the native VLAN is sent untagged to the standard STP multicast address 01:80:C2:00:00:00. BPDUs for other VLANs are sent to the Cisco multicast address 01:00:0C:CC:CC:CD, tagged with the VLAN ID.
- On access ports, only the BPDU for that access VLAN is relevant.
This is the reason for the "Plus" in PVST+. The original PVST worked only over Cisco's ISL trunking. PVST+ added 802.1Q support and interoperates with a standard CST network by mapping the native VLAN's tree onto the CST.
PVST+ versus Rapid PVST+
| Feature | PVST+ | Rapid PVST+ |
|---|---|---|
| Based on | 802.1D | 802.1w |
| Instances | One per VLAN | One per VLAN |
| Port states | Blocking, listening, learning, forwarding | Discarding, learning, forwarding |
| Typical failover | 30 to 50 seconds | Typically a few seconds or less |
| Alternate and backup roles | Not formally defined | Defined, enabling fast takeover |
| Edge ports | PortFast | PortFast, treated as an edge port |
Modern Cisco switches default to PVST+ in many releases, but Rapid PVST+ is the usual choice for new designs. Both can interoperate on a link, but the neighbor falls back to classic behavior on that link, so you lose the fast convergence there.
Load balancing with per-VLAN roots
The practical payoff of PVST+ is load balancing. Take two distribution switches, D1 and D2, each connected to an access switch A1 through its own uplink.
- Make D1 the root for VLAN 10 and the secondary root for VLAN 20.
- Make D2 the root for VLAN 20 and the secondary root for VLAN 10.
On A1, the uplink to D1 forwards VLAN 10 and blocks VLAN 20. The uplink to D2 does the reverse. Both links carry traffic, and either one takes over for the other if it fails.
Configuration
The configuration below selects Rapid PVST+ and sets the roots on each distribution switch. The root primary macro lowers the priority to 24576, or lower if needed to win. The root secondary macro sets it to 28672.
! D1: Cisco IOS
configure terminal
spanning-tree mode rapid-pvst
spanning-tree vlan 10 root primary
spanning-tree vlan 20 root secondary
end
! D2: Cisco IOS
configure terminal
spanning-tree mode rapid-pvst
spanning-tree vlan 20 root primary
spanning-tree vlan 10 root secondary
endEvery switch in the domain should run the same mode. Set it on the access switch as well:
! A1: Cisco IOS
configure terminal
spanning-tree mode rapid-pvst
endIf you prefer fixed values, use an explicit priority, for example spanning-tree vlan 10 priority 4096. The macro is convenient, but it computes a value at the time you enter it. It does not track later changes elsewhere in the network.
Verifying per-VLAN behavior
Check each VLAN separately, because the output is per instance.
show spanning-tree vlan 10
show spanning-tree vlan 20
show spanning-tree summaryIn the output for each VLAN, look for these items:
- The protocol line should read
rstpwhen Rapid PVST+ is active. - The root ID block should name the intended switch for that VLAN. On the root itself, it says "This bridge is the root".
- The bridge ID priority should read the configured value plus the VLAN number, for example 24586 for VLAN 10 after
root primary. - Interface lines show the role (Root, Desg, Altn) and state (FWD, BLK or LRN) for that VLAN.
The show spanning-tree summary command lists how many VLANs are in each state and which mode is running. It is a quick way to catch a switch still in pvst mode.
Costs and gotchas
CPU and memory load
Each VLAN is a separate instance with its own timers and BPDUs. With a few dozen VLANs this is harmless. With hundreds of VLANs on many trunks, the BPDU load and the per-instance state can become significant on smaller switches. This scaling limit is the reason MSTP exists, which maps many VLANs to a few trees.
Pruned VLANs and unwanted instances
An instance runs only for VLANs that exist on the switch. If a VLAN is pruned or not allowed on a trunk, that trunk does not carry the VLAN's tree either. This matters for design: a loop-free tree in VLAN 10 says nothing about VLAN 30 if VLAN 30 is allowed on a different set of trunks. Always check that the allowed VLAN list on each trunk matches your intent.
Inconsistent mode or VLAN settings
Several mistakes produce the same symptom: a tree that looks wrong for one VLAN only.
- A switch left in
pvstmode forces its Rapid PVST+ neighbors to use classic timers on that link. - A trunk with mismatched native VLANs makes the untagged BPDU land in a different VLAN on each end. IOS reports a "PVID inconsistent" or "type inconsistent" condition and blocks the VLAN on that port until it is fixed. Check it with
show spanning-tree inconsistentports. - If you set priorities for only some VLANs, the others keep the default and the root for those VLANs is decided by the lowest MAC address. That can put the root on an old access switch.
Interoperating with standard 802.1Q networks
When a PVST+ switch connects to a network running CST, it uses the native VLAN's instance to talk to the CST. The CST region sees the Cisco tagged BPDUs as ordinary multicast frames and passes them through. Make sure the native VLAN has the right root there. Otherwise the CST and the PVST+ side can disagree about the best path.
Per-VLAN protection features
BPDU Guard, Root Guard, PortFast and Loop Guard apply per port, but their effect crosses VLANs. Root Guard, for example, blocks a port in every VLAN where a superior BPDU arrives. A port can be in a root-inconsistent state for VLAN 10 and operate normally in VLAN 20. The show spanning-tree inconsistentports output lists the VLAN along with the interface, so read it carefully.
Exercise
Two distribution switches D1 and D2 both connect to an access switch. You want D1 to carry VLAN 10 and D2 to carry VLAN 20, with each acting as backup for the other. Write the commands for D1, assuming Rapid PVST+. Then state what priority value VLAN 10 shows in show spanning-tree vlan 10 on D1 if you set it explicitly to 4096.
Show answer
On D1: spanning-tree mode rapid-pvst, spanning-tree vlan 10 root primary, and spanning-tree vlan 20 root secondary. D2 mirrors this with the VLANs swapped. With an explicit priority of 4096 on VLAN 10, the displayed priority is 4096 + 10 = 4106, because the VLAN number is added as the extended system ID.
Exercise
A trunk between two switches shows VLAN 1 as "PVID inconsistent" and the port is blocked in that VLAN. What is the most likely cause, and how do you confirm it?
Show answer
The native VLAN differs on the two ends of the 802.1Q trunk, so the untagged BPDU arrives in a different VLAN than the one it was sent for. Confirm it with show interfaces trunk on both switches, then set the same native VLAN on both ends. show spanning-tree inconsistentports should then show the port cleared.