Spanning tree follows the following steps:
- Elect root bridge
- Elect root ports on non root bridges
- Elect one designated port per segment
- Ports transition to forwarding or blocking.
Elections for root bridge: general rule: Lower is better.
- Priority (Default 32768)
- MAC address.
Root port is the one which has the lowest cost to the root bridge:
10mb = 100
100mb =19
Gigabit=4
10 Gig =2
Designated Port
Costs are added together, lowest cost wins.
4 states of ports in 802.1D CST:
Blocking (20s) (BPDU every 2s) No BPDU received—>Listening
Listening (15s) (Learn MAC addresses)
Learning (15s) (Now learn MAC addresses, put in CAM table)
Forwarding
(use the word ‘belief’ as a mnemonic)
3 states for 802.1w:
Discarding, learning, forwarding
Types of Spanning Tree
STP | 802.1D | Low resource | Slow | 1 Tree |
PVSTP+ | Cisco | High Resource | Slow | 1 Tree for each VLAN |
RSTP | 802.1w | Med resource | Fast | 1 Tree |
Rapid PVSTP+ | Cisco | Very High | Fast | 1 Tree for each VLAN |
Configuring Spanning Tree
Spanning tree is on by default.
You can change the mode with spanning-tree mode command
Configure priority: Spanning-tree vlan 1 priority xxxx
or spanning-tree vlan1 root
Identifying Designated Ports
There will always be one designated port per segment. (Segment is collision domain).
Consider the diagram below:
Switch 1 has been made the Root Bridge because priority changed to 4096.
Consider the link between 2 and 4. Because the path to switch 4 must be made through Switch 1, the Root Bridge the direct link between 4 and 2 must be blocked. One side designated, the other blocking.
- Which switch has the lowest cost to the root, Switch 1? Answer: Equal. Both 19 -hence a tie.
- Lowest Bridge ID (First Priority, second MAC address)
- Set port priorities manually if desired
- Lowest port number: eg Fa0/1 before Fa0/2
Fault finding:
sh spanning-tree summary
sh spanning-tree
sh spanning-tree vlan 1
sh spanning-tree detail
***********************************************************
Sample outputs for root bridge
sh spanning-tree summary
Switch is in pvst mode
Root bridge for: default
Extended system ID is enabled
Portfast Default is disabled
PortFast BPDU Guard Default is disabled
Portfast BPDU Filter Default is disabled
Loopguard Default is disabled
EtherChannel misconfig guard is disabled
UplinkFast is disabled
BackboneFast is disabled
Configured Pathcost method used is short
Name Blocking Listening Learning Forwarding STP Active
———————- ——– ——— ——– ———- ———-
VLAN0001 0 0 0 3 3
———————- ——– ——— ——– ———- ———-
1 vlans 0 0 0 3
*****************************************************
Switch#sh spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 4097
Address 0060.3E3D.53E2
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 4097 (priority 4096 sys-id-ext 1)
Address 0060.3E3D.53E2
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
—————- —- — ——— ——– ——————————–
Fa0/1 Desg FWD 19 128.1 P2p
Fa0/2 Desg FWD 19 128.2 P2p
Fa0/3 Desg FWD 19 128.3 P2p
**********************************************************
Switch#sh spanning-tree vlan 1
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 4097
Address 0060.3E3D.53E2
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 4097 (priority 4096 sys-id-ext 1)
Address 0060.3E3D.53E2
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
—————- —- — ——— ——– ——————————–
Fa0/1 Desg FWD 19 128.1 P2p
Fa0/2 Desg FWD 19 128.2 P2p
Fa0/3 Desg FWD 19 128.3 P2p
***********************************************
Switch#sh spanning-tree detail
VLAN0001 is executing the ieee compatible Spanning Tree Protocol
Bridge Identifier has priority of 4096, sysid 1, 0060.3E3D.53E2
Configured hello time 2, max age 20, forward delay 15
Current root has priority 4097
Topology change flag not set, detected flag not set
Number of topology changes 0 last change occurred 00:00:00 ago
from FastEthernet0/1
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0, aging 300
Port 1 (FastEthernet0/1) of VLAN0001 is designated forwarding
Port path cost 19, Port priority 128, Port Identifier 128.1
Designated bridge has priority 4097, address 0060.3E3D.53E2
Designated port id is 128.1, designated path cost 19
Timers: message age 16, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is point-to-point by default
Port 2 (FastEthernet0/2) of VLAN0001 is designated forwarding
Port path cost 19, Port priority 128, Port Identifier 128.2
Designated bridge has priority 4097, address 0060.3E3D.53E2
Designated port id is 128.2, designated path cost 19
Timers: message age 16, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is point-to-point by default
Port 3 (FastEthernet0/3) of VLAN0001 is designated forwarding
Port path cost 19, Port priority 128, Port Identifier 128.3
Designated bridge has priority 4097, address 0060.3E3D.53E2
Designated port id is 128.3, designated path cost 19
Timers: message age 16, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is point-to-point by default
**********************************************
Sample output for Switch 4 (Note, all ports blocking except the root port)
Switch#sh spanning-tree
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address 0060.3E3D.53E2
Cost 19
Port 1(FastEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 00D0.FF45.B48B
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
—————- —- — ——— ——– ——————————–
Fa0/2 Altn BLK 19 128.2 P2p
Gi0/1 Altn BLK 4 128.25 P2p
Fa0/1 Root FWD 19 128.1 P2p