By the end of this lesson you can
- Explain broadcast storms and why Ethernet needs STP
- Predict the root bridge, root ports, designated ports and blocked ports
- Configure Rapid PVST+ and choose a root and secondary per VLAN
- Apply PortFast, BPDU Guard and Root Guard where they belong
- Build and verify an LACP EtherChannel trunk
Why redundant links can melt a network
You add a second link between switches so one cable failure does not take a building offline. Ethernet frames have no hop limit (there is no TTL in the Layer 2 header), so without protection a redundant link creates a loop and three things happen within seconds:
- Broadcast storm: every broadcast is flooded out every port, comes back round the loop, and is flooded again, until links and CPUs are saturated.
- MAC table instability: the same source MAC arrives on different ports, so the switch keeps rewriting its table (MAC flapping).
- Duplicate frames: hosts receive several copies of the same unicast frame.
How STP elects a root and picks ports
Switches exchange BPDUs (bridge protocol data units). Each has a bridge ID: a priority (default 32768, changeable only in steps of 4096) plus the VLAN number (the system ID extension) plus its MAC address. Then:
- Root bridge: the lowest bridge ID wins. With default priorities that means the lowest MAC, which is often the oldest switch in the building. That is why you always choose the root yourself.
- Root port: every other switch picks its port with the lowest total cost to the root. Ties break on the lowest neighbour bridge ID, then the lowest port ID.
- Designated port: on every link, the side closer to the root forwards. All ports on the root bridge are designated.
- Every remaining port is blocked (an alternate port in Rapid STP).
| Link speed | Default STP cost (short method) |
|---|---|
| 10 Mb/s | 100 |
| 100 Mb/s | 19 |
| 1 Gb/s | 4 |
| 10 Gb/s | 2 |
Cisco Catalyst switches run one spanning tree per VLAN: PVST+ by default (802.1D based) or Rapid PVST+ (802.1w based). Because each VLAN has its own tree, you can make DSW1 root for VLAN 10 and DSW2 root for VLAN 20 so both uplinks carry traffic.
Rapid PVST+: faster convergence
| Classic 802.1D (PVST+) | Rapid 802.1w (Rapid PVST+) | |
|---|---|---|
| Port states | Blocking, listening, learning, forwarding, disabled | Discarding, learning, forwarding |
| Port roles | Root, designated, blocked | Root, designated, alternate, backup |
| Recovery after a change | Timer based: 30 to 50 seconds (forward delay 15 s twice, plus max age 20 s) | Handshake based: usually within a few seconds on point to point links |
| Configure | spanning-tree mode pvst (default) | spanning-tree mode rapid-pvst |
An alternate port is a pre-computed backup root port: when the root port fails, it moves to forwarding almost immediately. A host plugged into a port should never wait 30 seconds for the network either, which is what PortFast fixes.
PortFast, BPDU Guard, Root Guard and Loop Guard
| Feature | Where | What it does |
|---|---|---|
| PortFast | Access ports to a single host | Skips listening and learning, so the PC gets connectivity at once. |
| BPDU Guard | Every PortFast port | If a BPDU arrives, the port goes err-disabled. A switch has no business on a user port. |
| Root Guard | Distribution ports facing access switches | If a superior BPDU (a would-be better root) arrives, the port goes root-inconsistent and stops forwarding. |
| Loop Guard | Root and alternate ports on switch to switch links | If BPDUs stop arriving (for example a one way fibre fault), the port is held instead of wrongly moving to forwarding. |
ASW1(config)#interface range Fa0/1 - 24
ASW1(config-if-range)#spanning-tree portfast
ASW1(config-if-range)#spanning-tree bpduguard enable
! or globally, for every access port:
ASW1(config)#spanning-tree portfast default
ASW1(config)#spanning-tree portfast bpduguard default
! recover an err-disabled port after removing the cause:
ASW1(config)#interface Fa0/5
ASW1(config-if)#shutdown
ASW1(config-if)#no shutdownEtherChannel: many links, one logical link
STP blocks redundant parallel links, so two cables between DSW1 and DSW2 would give you the bandwidth of one. EtherChannel bundles up to 8 active physical links into one logical Port-channel interface. STP sees one link, nothing is blocked, and losing one member just reduces bandwidth.
| Protocol | Modes | Forms a channel when |
|---|---|---|
| LACP (IEEE 802.3ad, now 802.1AX) | active, passive | active + active, or active + passive. passive + passive never starts. |
| PAgP (Cisco only) | desirable, auto | desirable + desirable, or desirable + auto. auto + auto never starts. |
| Static | on | on + on only. No negotiation, so mistakes are not detected. Avoid. |
- All members must match: speed, duplex, access or trunk mode, allowed VLANs and native VLAN. A mismatched port is suspended from the bundle.
- Traffic is shared per flow using a hash (for example of source and destination IPs), so a single big transfer still uses one member. Two 1 Gb/s links give 2 Gb/s of capacity, not one 2 Gb/s flow.
- Configure trunk settings on the Port-channel interface; they apply to the members.
Practise on DSW1
DSW1 is a 3650 with VLANs 10, 20 and 99 already created and its uplinks already trunked. Gi1/0/1 and Gi1/0/2 go to DSW2, Gi1/0/3 goes down to ASW1. DSW2 has already been made root primary for VLAN 20, and nobody chose a root for VLANs 10 and 99. This console models DSW2's side of the election for you, so treat the outputs as a guide rather than a real protocol run.
Missions 0/11
Flashcards: do you remember?
Tap a card to flip it. Try to answer in your head first; recalling is what makes it stick.
Quick quiz
Instant feedback on every answer. Score 70% or more to pass this lesson's quiz.
Q1All switches use priority 32768. Which becomes root?
Lowest bridge ID; with equal priority the MAC decides.
Q2Where should BPDU Guard go?
User ports should never receive BPDUs.
Q3Which pair forms an LACP channel?
At least one side must be active.
Q4Why use EtherChannel instead of two separate trunks?
The bundle is one logical link, so nothing is blocked.
Q5spanning-tree vlan 10 priority 1000 is rejected. Why?
Valid values are 0, 4096, 8192 and so on up to 61440.
Q6A single large file copy runs over a two member 1 Gb/s bundle. Roughly how fast can it go?
Load sharing is per flow, not per packet.
Hands-on lab
Packet Tracer lab 3.5: Rapid PVST+, guards and an LACP EtherChannel
You need: Cisco Packet Tracer (free with a Cisco Networking Academy account; version 9.0.1 was the current download on the NetAcad Resource Hub when this lesson was written). Devices: 2 x 3650-24PS, 1 x 2960-24TT, 2 x PC-PT. Create VLANs 10, 20 and 99 on all three switches and trunk every inter-switch link (native 99, allowed 10,20,99) as in lesson 3.4.
Simulator lab, zero risk. This lab runs inside Cisco Packet Tracer, so it touches no real network. Packet Tracer is free with a Cisco Networking Academy account (netacad.com). It simulates a subset of Cisco IOS, so where support for a feature is uncertain we say so instead of promising it works.
Topology and addressing
| Device | Interface | IPv4 address / prefix | Default gateway or note |
|---|---|---|---|
| PC1 | Fa0 | 192.168.10.11/24 | VLAN 10 |
| PC2 | Fa0 | 192.168.20.11/24 | VLAN 20 |
| Switches | no IP needed for this lab | Layer 2 only |
Before you change anything
DSW1#show spanning-tree vlan 10 DSW1#show spanning-tree vlan 20Write down who is root and which port blocks. Expect the parallel DSW link and one ASW1 uplink to show blocking somewhere.
Rapid PVST+ and the roots
DSW1(config)#spanning-tree mode rapid-pvst DSW1(config)#spanning-tree vlan 10,99 root primary DSW1(config)#spanning-tree vlan 20 root secondary DSW2(config)#spanning-tree mode rapid-pvst DSW2(config)#spanning-tree vlan 20 root primary DSW2(config)#spanning-tree vlan 10,99 root secondary ASW1(config)#spanning-tree mode rapid-pvstProtect the edge (ASW1)
ASW1(config)#interface range Fa0/1 - 24 ASW1(config-if-range)#spanning-tree portfast ASW1(config-if-range)#spanning-tree bpduguard enableRoot Guard toward the access layer (both DSWs)
DSW1(config)#interface Gi1/0/3 DSW1(config-if)#spanning-tree guard rootLACP EtherChannel (both DSWs)
DSW1(config)#interface range Gi1/0/1 - 2 DSW1(config-if-range)#channel-group 1 mode active Creating a port-channel interface Port-channel 1 DSW1(config-if-range)#interface Port-channel1 DSW1(config-if)#switchport mode trunk DSW1(config-if)#switchport trunk native vlan 99 DSW1(config-if)#switchport trunk allowed vlan 10,20,99 DSW2(config)#interface range Gi1/0/1 - 2 DSW2(config-if-range)#channel-group 1 mode passiveOn 3650s you may need
switchport trunk encapsulation dot1qbeforeswitchport mode trunk, depending on the image.Fail a link
Start a continuous ping from PC1 to another VLAN 10 host (
ping -t), then delete or shut the DSW1 to ASW1 link. Watch the alternate port on ASW1 take over and count the lost pings.Trip BPDU Guard
Connect a spare 2960 to ASW1 Fa0/5. The port should go err-disabled. Remove the switch, then recover with
shutdownandno shutdownon Fa0/5.Verify
DSW1#show spanning-tree vlan 10 DSW1#show spanning-tree summary DSW1#show etherchannel summary DSW1#show interfaces trunk ASW1#show interfaces status err-disabled
You are done when: DSW1 is root for VLANs 10 and 99 and DSW2 for VLAN 20; show etherchannel summary shows Po1(SU) with both members (P); ASW1 Fa0/5 went err-disabled when a switch was attached.
Packet Tracer limits and notes
- In some Packet Tracer versions a 3650 starts without a power supply and stays off until you add one in its Physical tab. UNVERIFIED for every version.
- Root Guard, Loop Guard and
errdisable recovery cause bpduguardare real IOS features; their support on Packet Tracer's switch images is UNVERIFIED. If a command is rejected, note it and read about it instead. - Convergence timing in Packet Tracer is simulated and does not match real hardware; treat lost ping counts as rough.
- Layer 3 EtherChannel on the 3650 in Packet Tracer is UNVERIFIED; this lab uses a Layer 2 bundle. Cisco NetAcad publishes official Packet Tracer activities for Rapid PVST+ and EtherChannel if you want more practice.
- Packet Tracer simulates a subset of IOS. If a command here is rejected in your version, note it, skip that step and carry on; the concept still applies to real Cisco gear.
Download the lab checklist (.txt) Print it or keep it open beside Packet Tracer.
Key takeaways
- Loops cause storms; STP blocks just enough ports to prevent them.
- Choose the root yourself, per VLAN, with a secondary.
- Rapid PVST+ recovers in seconds instead of up to 50.
- PortFast plus BPDU Guard on user ports; Root Guard where the root must never appear.
- EtherChannel makes parallel links one logical link; use LACP.
Finished the sections, quiz and lab? Mark the lesson complete. Progress is saved only in this browser.