Spanning TreeGlobal Config

spanning-tree vlan [id] priority [value]

Sets the bridge priority for a specific VLAN to influence root bridge election in Spanning Tree Protocol.

Overview

The 'spanning-tree vlan [id] priority [value]' command is used in Cisco NX-OS to manually set the bridge priority for a specific VLAN in Rapid PVST+ (Per-VLAN Spanning Tree Plus) mode. This command is critical for controlling which switch becomes the root bridge for a given VLAN, thereby influencing the Layer 2 topology and path selection. In Spanning Tree Protocol (STP), the root bridge is the reference point for all path cost calculations. By default, all switches have a priority of 32768, and the root bridge is elected based on the lowest bridge ID (priority + MAC address). By lowering the priority on a desired switch, network engineers can force it to become the root, optimizing traffic flow and ensuring deterministic failover. This command is typically used in data center or campus networks where traffic patterns are well understood and specific switches are better positioned as roots. On Cisco NX-OS, the command operates in global configuration mode and affects only the specified VLAN. The priority value must be a multiple of 4096, ranging from 0 to 61440. Setting a priority of 0 makes the switch the most likely root, while 61440 makes it least likely. This command is often used in conjunction with 'spanning-tree vlan [id] root primary' or 'secondary' for dynamic root selection, but manual priority setting provides finer control. In troubleshooting workflows, verifying the root bridge with 'show spanning-tree vlan [id]' helps identify unexpected root placements due to misconfiguration or network changes. The command is also useful for load balancing across multiple VLANs by designating different root bridges per VLAN, reducing convergence time and improving bandwidth utilization.

Syntax·Global Config
spanning-tree vlan {vlan-id} priority {priority-value}

When to Use This Command

  • Ensuring a specific switch becomes the root bridge for a VLAN to optimize traffic flow.
  • Configuring a backup root bridge by setting a priority higher than the primary root but lower than default.
  • Load balancing across multiple VLANs by assigning different root bridges per VLAN.
  • Preventing suboptimal paths by adjusting priority to force a specific switch as root.

Parameters

ParameterSyntaxDescription
vlan-id1-4094Specifies the VLAN number on which to set the priority. Only one VLAN can be configured per command. The VLAN must exist in the VLAN database.
priority-value0, 4096, 8192, 12288, 16384, 20480, 24576, 28672, 32768, 36864, 40960, 45056, 49152, 53248, 57344, 61440Sets the bridge priority for the specified VLAN. Must be a multiple of 4096. Lower values increase the likelihood of becoming root. Default is 32768.

Command Examples

Set VLAN 10 priority to 4096

spanning-tree vlan 10 priority 4096

No output is displayed upon successful configuration. Use 'show spanning-tree vlan 10' to verify.

Verify priority change for VLAN 10

show spanning-tree vlan 10
VLAN0010
  Spanning tree enabled protocol rstp
  Root ID    Priority    4096
             Address     00de.fb8b.4c80
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    4096    (priority 4096 sys-id-ext 10)
             Address     00de.fb8b.4c80
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Eth1/1           Desg FWD 4         128.1    P2p
Eth1/2           Desg FWD 4         128.2    P2p

The output shows VLAN 10 spanning tree status. 'Root ID Priority 4096' indicates the root bridge priority. 'This bridge is the root' confirms this switch is root. 'Bridge ID Priority 4096' shows the local bridge priority including system ID extension (10). Interface roles (Desg = Designated, FWD = Forwarding) and costs are displayed.

Understanding the Output

The 'show spanning-tree vlan [id]' command displays the spanning tree state for a specific VLAN. Key fields include: Root ID (priority and MAC address of the root bridge), Bridge ID (local switch priority and MAC), and interface details (role, state, cost, priority, type). A healthy root bridge has a lower priority number (e.g., 4096) compared to default (32768). Problem values include high priority (e.g., 32768) when you expect the switch to be root, or inconsistent root IDs across switches. Interface roles: Desg (Designated), Root, Altn (Alternate), Back (Backup). States: FWD (Forwarding), BLK (Blocking), LRN (Learning). Cost indicates path cost; lower is better. The sys-id-ext in Bridge ID shows the VLAN ID added to the priority.

Configuration Scenarios

Setting a Primary Root Bridge for VLAN 10

A network with two Nexus switches (SW1 and SW2) connected via trunk. VLAN 10 traffic should prefer SW1 as root.

Topology

SW1 ---- SW2 (root) (backup)

Steps

  1. 1.Configure VLAN 10 on both switches.
  2. 2.On SW1, set priority to 4096 to make it root.
  3. 3.On SW2, set priority to 8192 to act as backup root.
  4. 4.Verify with 'show spanning-tree vlan 10' on both switches.
Configuration
! On SW1
spanning-tree vlan 10 priority 4096
! On SW2
spanning-tree vlan 10 priority 8192

Verify: On SW1: 'show spanning-tree vlan 10' should show 'This bridge is the root' with priority 4096. On SW2: Root ID should show SW1's MAC and priority 4096.

Watch out: If VLAN 10 is not created, the command is accepted but has no effect. Ensure VLAN exists.

Troubleshooting with This Command

When troubleshooting spanning tree issues on Cisco NX-OS, the 'spanning-tree vlan [id] priority [value]' command is used to correct root bridge placement. Common problems include: unexpected root bridge due to default priorities, or multiple switches claiming root due to misconfiguration. To diagnose, start with 'show spanning-tree vlan [id]' to identify the current root. If the root is not the desired switch, check the priority and MAC address. Use 'show spanning-tree root' to see all VLAN roots. If a switch has a lower priority than intended, verify the configuration with 'show running-config | include spanning-tree'. On NX-OS, note that the system ID extension (VLAN ID) is added to the priority in the bridge ID, so a priority of 4096 for VLAN 10 appears as 4106 in some outputs. To force a root change, set the priority to a lower value (e.g., 0) on the desired switch. If the root does not change, check for connectivity issues or other switches with even lower priorities. Also verify that spanning tree is enabled globally and per VLAN. Use 'show spanning-tree summary' to see global state. In case of loops, check interface roles and states; blocked ports indicate alternate paths. The command is also useful for load balancing: assign different roots per VLAN to distribute traffic. Remember that priority changes take effect immediately but may cause a topology change (TCN) that temporarily disrupts traffic. Plan changes during maintenance windows.

CCNA Exam Tips

1.

Remember that priority values must be in increments of 4096 (0, 4096, 8192, etc.) on NX-OS.

2.

The root bridge is the switch with the lowest bridge ID (priority + MAC). Changing priority directly affects election.

3.

Use 'show spanning-tree root' to quickly see root bridges for all VLANs.

4.

On NX-OS, the default spanning-tree mode is Rapid PVST+ (rstp).

Common Mistakes

Setting priority to a value not a multiple of 4096 (e.g., 5000) – command will be rejected.

Forgetting to specify VLAN ID, which applies the command to all VLANs (not allowed in NX-OS).

Assuming priority change takes effect immediately without verifying with 'show spanning-tree'.

Platform Notes

On Cisco NX-OS (Nexus), the spanning-tree implementation is based on Rapid PVST+ (IEEE 802.1w) by default, unlike classic IOS which often uses PVST+ (802.1D). The priority command syntax is identical to IOS, but NX-OS enforces the 4096-step rule strictly. On IOS, the command 'spanning-tree vlan [id] priority [value]' also exists but may accept non-multiples (though not recommended). NX-OS also supports MST (Multiple Spanning Tree) with 'spanning-tree mst [instance] priority [value]'. For Rapid PVST+, the 'spanning-tree vlan [id] root primary' command is a convenience macro that sets priority to 24576 (or lower if another root exists). On NX-OS, the 'root primary' command is available but not always present in older versions; manual priority setting is more reliable. In NX-OS, the system ID extension is always added to the priority in the bridge ID, so the displayed priority in 'show spanning-tree' includes the VLAN ID. For example, priority 4096 for VLAN 10 shows as 4106. This is consistent with IEEE 802.1t. On IOS, this behavior depends on the version. Also, NX-OS uses a different default hello time (2 sec) and forward delay (15 sec) compared to classic IOS (2 sec and 15 sec respectively, but may vary). When migrating from IOS to NX-OS, verify all spanning-tree parameters.

Practice for the CCNA 200-301

Test your knowledge with hundreds of CCNA practice questions covering all exam domains.

Practice CCNA Questions