Switching, VLANs and Spanning Tree
Switching questions come in two shapes: a configuration that does not work, and a topology asking which port blocks. The command tables answer the first and the spanning tree tables answer the second.
Switching, VLANs and Spanning Tree · firsttry.app/cheatsheets/ccna-switching-vlans · original reference written from published exam objectives. Not affiliated with any certification body.
VLAN and trunk commands
| Command | What it does |
|---|---|
| vlan 20 | Create VLAN 20 and enter VLAN config |
| name SALES | Name the VLAN |
| interface gi0/1 | Enter interface config |
| switchport mode access | Fix the port as an access port |
| switchport access vlan 20 | Put the access port in VLAN 20 |
| switchport mode trunk | Fix the port as a trunk |
| switchport trunk allowed vlan 10,20 | Restrict which VLANs cross the trunk |
| switchport trunk native vlan 99 | Set the untagged VLAN. Must match both ends |
| show vlan brief | VLANs and their ports |
| show interfaces trunk | Trunk status, native and allowed VLANs |
Spanning tree port states
| State | Forwards data | Learns MACs | Duration |
|---|---|---|---|
| Blocking | No | No | 20 s max age |
| Listening | No | No | 15 s forward delay |
| Learning | No | Yes | 15 s forward delay |
| Forwarding | Yes | Yes | Steady state |
| Disabled | No | No | Administratively down |
Spanning tree roles and election
| Concept | Rule |
|---|---|
| Root bridge | Lowest bridge ID: priority first, then MAC address |
| Default priority | 32768, adjusted in increments of 4096 |
| Root port | One per non-root switch, lowest cost to root |
| Designated port | One per segment, forwards toward the root |
| Blocking port | Everything else, prevents the loop |
| PortFast | Access ports skip to forwarding. Never on a trunk to a switch |
| BPDU Guard | Shuts a PortFast port that receives a BPDU |
| RSTP (802.1w) | Faster convergence, states are Discarding, Learning, Forwarding |
EtherChannel and port security
| Feature | Detail |
|---|---|
| LACP | Open standard, modes active and passive |
| PAgP | Cisco proprietary, modes desirable and auto |
| Static | Mode on, no negotiation, both ends must match |
| Will not form | Mismatched speed, duplex, VLAN, or trunk mode |
| Port security | Limits MAC addresses learned on a port |
| Violation: protect | Drops unknown traffic silently |
| Violation: restrict | Drops and logs |
| Violation: shutdown | Err-disables the port. The default |
| Sticky MAC | Learns and saves the address to the config |
Exams covered
Now test yourself
Memorizing a table is a start. Practice questions are what make it stick, and every answer carries the full explanation.