Bridge ID
Priority4 bits
Sys-id-ext12 bits: the VLAN
MAC address48 bits
- Priority runs 0 to 61440 in steps of 4096. Default 32768.
- Show output adds the VLAN: VLAN 10 at the default reads 32778.
- Lowest wins: priority first, then the lowest MAC.
root primary sets 24576, or 4096 below the current root if that's not enough. root secondary sets 28672.
Who wins
- Root bridge: lowest bridge ID.
- Root port, one per non-root switch: lowest root path cost, then lowest neighbor bridge ID, then lowest neighbor port ID.
- Designated port, one per link: the side with the lowest root path cost, then bridge ID, then port ID. Every port on the root is designated.
- Everything else discards: alternate, or backup if the better BPDU comes from the same switch.
Port ID is priority (default 128, steps of 16) then port number, shown as 128.1.
Port roles
| Role | Show | State |
| Root | Root | Forwarding. Best path to the root. |
| Designated | Desg | Forwarding. Best port on its link. |
| Alternate | Altn | Discarding. Backup path to the root. |
| Backup | Back | Discarding. Backup for a designated port on a shared segment. |
| Disabled | none | Shut down; not listed. |
States: 802.1D and RSTP
| 802.1D | RSTP | Learns MACs | Forwards |
| Disabled | Discarding | No | No |
| Blocking | No | No |
| Listening | No | No |
| Learning | Learning | Yes | No |
| Forwarding | Forwarding | Yes | Yes |
Show output prints discarding as BLK, and a guard's block as BKN*.
Path cost
| Speed | Short | Long |
| 10 Mbps | 100 | 2,000,000 |
| 100 Mbps | 19 | 200,000 |
| 1 Gbps | 4 | 20,000 |
| 10 Gbps | 2 | 2,000 |
Root path cost adds the cost of each port a BPDU arrives on, on the way back from the root. show spanning-tree summary says which method is in use.
Timers
- 2 s
- Hello: BPDU interval
- 20 s
- Max age (802.1D)
- 15 s
- Forward delay: each of listening and learning
- 3 hellos
- RSTP drops a neighbor's info after 3 missed hellos (6 s)
Without PortFast, a port with no RSTP partner (a PC) waits 2 × 15 s before forwarding.
PortFast and the four guards
Commands
Global
spanning-tree mode rapid-pvst
spanning-tree vlan 10 priority 4096
spanning-tree vlan 10 root primary
spanning-tree vlan 20 root secondary
spanning-tree portfast default
spanning-tree portfast bpduguard default
spanning-tree portfast bpdufilter default
spanning-tree loopguard default
spanning-tree pathcost method long
Interface
spanning-tree portfast
spanning-tree portfast trunk
spanning-tree bpduguard enable
spanning-tree bpdufilter enable
spanning-tree guard root
spanning-tree guard loop
spanning-tree cost 10
spanning-tree vlan 10 cost 10
spanning-tree port-priority 64
Verify
show spanning-tree
show spanning-tree vlan 10
show spanning-tree interface gi1/0/1
show spanning-tree summary
show spanning-tree root
show spanning-tree blockedports
show spanning-tree inconsistentports
show interfaces status err-disabled
Newer IOS releases also accept spanning-tree portfast edge for the same thing. All of these work in the network's consoles.