Learn / Stage 3: Networking and CCNA / Lesson 3.5

$ lesson 3.5 --track ccna --domain switching

Redundant Switch Links: STP, Rapid PVST+, PortFast, BPDU Guard, EtherChannel

Redundancy keeps a network up when a cable dies, and the same redundancy can take it down in seconds if loops are not controlled. Learn how spanning tree decides which ports forward, how to choose the root yourself, how to stop rogue switches, and how EtherChannel turns parallel links into one.

  • Stage 3 Networking and CCNA
  • Level Intermediate
  • 65 min
  • 6 sections, quiz, lab

Start the lesson Jump to the lab

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
3.5.01

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.
Three switches in a triangle. STP elects SW-A as root and blocks one port on the SW-B to SW-C link to break the loopSW-Aroot bridgeSW-BSW-CSW-C port blocks (alternate)root port on SW-Broot port on SW-CWithout STP, one broadcast would circle this triangle forever
Spanning Tree keeps the physical redundancy but logically blocks one port, so there is exactly one active path between any two switches. If an active link fails, the blocked port takes over.
3.5.02

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:

  1. 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.
  2. 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.
  3. Designated port: on every link, the side closer to the root forwards. All ports on the root bridge are designated.
  4. Every remaining port is blocked (an alternate port in Rapid STP).
STP port costs
Link speedDefault STP cost (short method)
10 Mb/s100
100 Mb/s19
1 Gb/s4
10 Gb/s2

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.

3.5.03

Rapid PVST+: faster convergence

802.1D compared with 802.1w
Classic 802.1D (PVST+)Rapid 802.1w (Rapid PVST+)
Port statesBlocking, listening, learning, forwarding, disabledDiscarding, learning, forwarding
Port rolesRoot, designated, blockedRoot, designated, alternate, backup
Recovery after a changeTimer 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
Configurespanning-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.

3.5.04

PortFast, BPDU Guard, Root Guard and Loop Guard

STP protection features
FeatureWhereWhat it does
PortFastAccess ports to a single hostSkips listening and learning, so the PC gets connectivity at once.
BPDU GuardEvery PortFast portIf a BPDU arrives, the port goes err-disabled. A switch has no business on a user port.
Root GuardDistribution ports facing access switchesIf a superior BPDU (a would-be better root) arrives, the port goes root-inconsistent and stops forwarding.
Loop GuardRoot and alternate ports on switch to switch linksIf 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 shutdown
3.5.05

EtherChannel: 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.

EtherChannel modes
ProtocolModesForms a channel when
LACP (IEEE 802.3ad, now 802.1AX)active, passiveactive + active, or active + passive. passive + passive never starts.
PAgP (Cisco only)desirable, autodesirable + desirable, or desirable + auto. auto + auto never starts.
Staticonon + 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.
3.5.06

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.

console: DSW1 (DSW1 STP and EtherChannel)

Missions 0/11

    Simplified IOS simulator in your browser. It teaches the commands; Packet Tracer and real gear have many more.

    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?

    Q2Where should BPDU Guard go?

    Q3Which pair forms an LACP channel?

    Q4Why use EtherChannel instead of two separate trunks?

    Q5spanning-tree vlan 10 priority 1000 is rejected. Why?

    Q6A single large file copy runs over a two member 1 Gb/s bundle. Roughly how fast can it go?

    0 / 6

    Hands-on lab

    Cisco Packet Tracer lab50 minutessimulated network

    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.

    Topology and addressing

    Lab 3.5 topology: two 3650 distribution switches joined by a two link LACP EtherChannel, each uplinked to access switch ASW1Gi1/0/1-2Gi1/0/1-2Gi1/0/3Gi0/1Gi1/0/3Gi0/2Fa0/1Fa0/11L3DSW13650L3DSW23650ASW12960PC1VLAN 10PC2VLAN 20
    DSW1 and DSW2 joined by Gi1/0/1 and Gi1/0/2 (Port-channel 1). DSW1 Gi1/0/3 to ASW1 Gi0/1, DSW2 Gi1/0/3 to ASW1 Gi0/2. PC1 on ASW1 Fa0/1 (VLAN 10), PC2 on Fa0/11 (VLAN 20).
    Addressing table
    DeviceInterfaceIPv4 address / prefixDefault gateway or note
    PC1Fa0192.168.10.11/24VLAN 10
    PC2Fa0192.168.20.11/24VLAN 20
    Switchesno IP needed for this labLayer 2 only
    1. Before you change anything

      DSW1#show spanning-tree vlan 10
      DSW1#show spanning-tree vlan 20

      Write down who is root and which port blocks. Expect the parallel DSW link and one ASW1 uplink to show blocking somewhere.

    2. 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-pvst
    3. Protect the edge (ASW1)

      ASW1(config)#interface range Fa0/1 - 24
      ASW1(config-if-range)#spanning-tree portfast
      ASW1(config-if-range)#spanning-tree bpduguard enable
    4. Root Guard toward the access layer (both DSWs)

      DSW1(config)#interface Gi1/0/3
      DSW1(config-if)#spanning-tree guard root
    5. LACP 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 passive

      On 3650s you may need switchport trunk encapsulation dot1q before switchport mode trunk, depending on the image.

    6. 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.

    7. Trip BPDU Guard

      Connect a spare 2960 to ASW1 Fa0/5. The port should go err-disabled. Remove the switch, then recover with shutdown and no shutdown on Fa0/5.

    8. 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 bpduguard are 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.