What you will build
This walkthrough was written from Cisco IOS documentation and Packet Tracer behaviour as generally described. It has not been run in Packet Tracer here, so port names and prompts can differ slightly on your version.
Step 1: build it and read the default tree
- Place three 2960 switches and two PCs; cable with copper straight-through as shown and wait for the lights.
- On each switch run
show spanning-tree. Find the line This bridge is the root: only one switch says it. - Draw the result: which switch is root, which ports are Root and Desg (designated), and which one port is Altn/BLK.
SW3#show spanning-tree VLAN0001 Spanning tree enabled protocol ieee Root ID Priority 32769 Address 00D0.BC12.3401 Cost 19 Port 1(GigabitEthernet0/1) Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) Interface Role Sts Cost Prio.Nbr Type Gi0/1 Root FWD 19 128.1 P2p Gi0/2 Altn BLK 19 128.2 P2p
Step 2: choose the root bridge
! SW1
spanning-tree vlan 1 root primary
! SW2 (backup root)
spanning-tree vlan 1 root secondaryroot primary lowers SW1's priority below the current root's (typically to 24576); root secondary sets a value that makes SW2 the next choice. You can also set an explicit value with spanning-tree vlan 1 priority 4096.
Run show spanning-tree on SW1 again: it now says it is the root, and the blocked port has moved.
Step 3: switch to Rapid PVST+
! on all three switches
spanning-tree mode rapid-pvstRapid PVST+ converges in about a second instead of 30 to 50. Use the same mode on every switch; mixed modes interoperate but lose the speed benefit on the shared links.
Confirm with show spanning-tree summary, which names the mode.
Step 4: protect the edge ports
! SW2 and SW3 (on the PC ports)
interface FastEthernet0/1
switchport mode access
spanning-tree portfast
spanning-tree bpduguard enablePortFast puts the port straight into forwarding, and BPDU guard shuts it down (err-disabled) if a switch is plugged in.
To test the guard, add a fourth switch and connect it to a PC port. It should go err-disabled. Recover with shutdown then no shutdown on the port.
Step 5: test a failure
- On PC1 open the Command Prompt and run
ping -t 192.168.1.12(a continuous ping). - On SW1 shut down
Gi0/1to break one root path. - Watch the ping: with Rapid PVST+ there are only a few lost replies before it recovers; with classic PVST+ the gap is far longer.
- Bring the interface back with
no shutdownand check that the tree returns to normal.
What to record
On small screens, swipe sideways or focus the diagram and use the arrow keys.
Common Packet Tracer problems
- The ping drops for a long time: check that every switch runs
rapid-pvst. - PortFast refused on a trunk: it belongs on access ports only (or use trunk PortFast deliberately).
- BPDU guard did not trigger in the simulation: the connected device must actually send BPDUs, so use a switch, not a PC.
Test yourself
In a three-switch triangle with spanning tree, how many ports are blocked?
Which command makes SW1 the root bridge for VLAN 1?
What does BPDU guard do when a BPDU arrives on a PortFast port?
Why switch to Rapid PVST+ in this lab?
In show spanning-tree, which port state/role breaks the loop?