Switching fundamentals
A switch builds a MAC address table by reading the source MAC of every incoming frame and mapping it to the port it arrived on. If the destination MAC isn't in the table, the frame is flooded out every port except the one it came in on (unicast flooding). Broadcasts and multicasts are always flooded within the VLAN.
VLANs and trunking
A VLAN creates a separate broadcast domain on shared switch hardware. Access ports carry traffic for one VLAN only; trunk ports carry multiple VLANs tagged with 802.1Q, which inserts a 4-byte tag holding a 12-bit VLAN ID (range 1-4094, with 1002-1005 reserved for legacy VLANs). VLAN 1 is the default VLAN and carries untagged traffic plus control-plane traffic on many switches - best practice is to move management off VLAN 1. The native VLAN on a trunk is sent untagged; both ends must agree on it or you get a native VLAN mismatch (a common exam trap and a real security issue, since it can allow VLAN hopping).
EtherChannel
EtherChannel bundles up to 8 active physical links into one logical link for bandwidth and redundancy. It negotiates using PAgP (Cisco proprietary, modes desirable/auto) or LACP (open standard, modes active/passive). Both ends need matching speed, duplex, VLAN, and trunk settings or the bundle won't form.
Spanning Tree Protocol (STP)
STP (IEEE 802.1D) prevents Layer 2 loops by electing a root bridge (lowest bridge ID: priority + MAC, default priority 32768) and blocking redundant paths. Port states are blocking, listening, learning, forwarding (and disabled) - convergence can take up to 50 seconds with classic STP. Rapid PVST+ (802.1w) converges in seconds using alternate/backup roles. PortFast should only be enabled on ports connecting to end devices, never to another switch, since it skips listening/learning and can create a loop if misused - always pair it with BPDU Guard.
Common mistakes to avoid
- Confusing access and trunk port roles, or forgetting `switchport trunk allowed vlan` limits which VLANs actually cross a trunk
- Mixing up PAgP (Cisco-only) with LACP (standards-based)
- Enabling PortFast on an inter-switch link
- Forgetting that STP cost is based on link bandwidth (lower cost wins) and that a lower bridge priority wins root election
- Assuming VLAN 1 is safe to leave for management traffic
Quick numbers to memorise
- 802.1Q VLAN ID range: 1-4094 (1002-1005 reserved)
- EtherChannel: up to 8 active links (plus up to 8 standby with PAgP)
- Default switch priority for STP: 32768
- Classic STP convergence: up to 50 seconds; Rapid PVST+: a few seconds
What is the VLAN ID range defined by 802.1Q, and which IDs are reserved?
1 to 4094, with 1002-1005 reserved for legacy VLANs.
tap to reveal
What traffic does an access port carry versus a trunk port?
Access port: a single VLAN, untagged. Trunk port: multiple VLANs, tagged with 802.1Q.
tap to reveal
What is the native VLAN on a trunk, and why does a mismatch matter?
The VLAN sent untagged across the trunk; a mismatch between switches can leak traffic between VLANs (a security risk) and is a classic exam trap.
tap to reveal
How many active physical links can EtherChannel bundle into one logical link?
Up to 8 active links.
tap to reveal
Name the two EtherChannel negotiation protocols and who owns each.
PAgP (Cisco proprietary) and LACP (open IEEE standard).
tap to reveal
What are the PAgP and LACP port modes that will form a bundle when paired?
PAgP: desirable-desirable or desirable-auto. LACP: active-active or active-passive.
tap to reveal
What does STP stand for and what problem does it solve?
Spanning Tree Protocol - it prevents Layer 2 loops by blocking redundant paths between switches.
tap to reveal
How is the STP root bridge elected?
The switch with the lowest bridge ID wins, calculated from priority (default 32768) plus MAC address.
tap to reveal
List the STP port states in order.
Blocking, listening, learning, forwarding (plus disabled).
tap to reveal
How long can classic STP (802.1D) take to converge, and what's faster?
Up to 50 seconds; Rapid PVST+ (802.1w) converges in a few seconds.
tap to reveal
What is PortFast and where should it be enabled?
A feature that skips STP listening/learning states for faster access-port startup - only on ports connecting to end devices, never to other switches.
tap to reveal
What should always accompany PortFast, and why?
BPDU Guard - it shuts the port down if a BPDU is received, protecting against an accidental loop if PortFast is misapplied to a switch link.
tap to reveal
What happens when a switch receives a frame for a destination MAC not in its MAC address table?
It floods the frame out every port except the one it arrived on (unicast flooding).
tap to reveal
How does a switch build its MAC address table?
By reading the source MAC address of each incoming frame and recording which port it arrived on.
tap to reveal
What determines STP path cost, and which value wins?
Link bandwidth determines cost - lower cost is preferred, so higher-bandwidth links get lower cost values.
tap to reveal