Switching Basics
- A Layer 2 switch forwards frames based on MAC addresses stored in a MAC address table (CAM table).
- When a switch receives a frame destined for an unknown MAC address, it floods the frame out all ports except the one it was received on.
- Switches learn MAC addresses by examining the source MAC of incoming frames.
VLANs (Virtual Local Area Networks)
- VLANs logically segment a network at Layer 2, limiting broadcast domains without requiring separate physical switches.
- VLAN 1 is the default VLAN on Cisco switches and is used for management traffic by default.
- VLANs are created using the command vlan [id] in global configuration mode and assigned to ports using switchport access vlan [id].
- Access ports carry traffic for a single VLAN and are typically connected to end devices.
Trunk Links
- Trunk ports carry traffic for multiple VLANs between switches or between a switch and a router.
- Cisco switches use IEEE 802.1Q as the standard trunking encapsulation, which inserts a 4-byte tag into the Ethernet frame to identify the VLAN.
- The native VLAN is the VLAN whose traffic crosses a trunk link untagged. It must match on both ends of the trunk to avoid mismatches.
- Trunk ports are configured using switchport mode trunk.
Dynamic Trunking Protocol (DTP)
- DTP is a Cisco proprietary protocol that can automatically negotiate trunk links between switches.
- Common modes include: dynamic auto (passive, waits to be asked) and dynamic desirable (actively tries to form a trunk).
- Best practice is to disable DTP on ports connected to end devices using switchport nonegotiate or setting the port to access mode.
Inter-VLAN Routing
- Because VLANs are separate Layer 2 networks, a Layer 3 device is needed to route traffic between them.
- A common method is Router-on-a-Stick, where a single router interface is divided into subinterfaces, each assigned to a different VLAN using 802.1Q encapsulation.
- A Layer 3 switch can also perform inter-VLAN routing using Switched Virtual Interfaces (SVIs).
Exam Tips
- Know how to verify VLANs with show vlan brief and trunk status with show interfaces trunk.
- Understand the impact of a native VLAN mismatch (traffic may be dropped or misrouted).
- Be able to identify access vs. trunk port configuration from a running-config snippet.