Reference notes.

VLANs (Virtual Local Area Networks) logically segment a physical network at Layer 2, creating separate broadcast domains without requiring separate physical infrastructure.

Why Use VLANs?

  • Security isolation - Separate sensitive traffic (e.g., management, IoT, guest)
  • Reduced broadcast traffic - Smaller broadcast domains improve performance
  • Logical organisation - Group devices by function rather than location
  • Cost efficiency - One switch can serve multiple logical networks

Key Concepts

VLAN ID

  • 12-bit identifier ( values): 0 (priority-tagged frames) and 4095 (reserved by IEEE 802.1Q) cannot be used, leaving 1–4094 usable
  • VLAN 1 is the default (avoid using it for security)
  • VLANs 1002–1005 are Cisco-specific reservations for legacy protocols (FDDI / Token Ring)

Port Types

TypeDescriptionUse Case
Access portCarries single VLAN, untaggedEnd devices (PCs, printers)
Trunk portCarries multiple VLANs, taggedSwitch-to-switch, switch-to-router
Native VLANUntagged VLAN on trunkManagement, compatibility

802.1Q Tagging

The IEEE 802.1Q standard adds a 4-byte (32-bit) tag to Ethernet frames on trunk ports, increasing the maximum standard Ethernet frame size from 1518 to 1522 bytes:

  • TPID (Tag Protocol Identifier, 16-bit): 0x8100
  • PCP (Priority Code Point, 3-bit): QoS priority (802.1p)
  • DEI (Drop Eligible Indicator, 1-bit): Discard eligibility
  • VID (VLAN Identifier, 12-bit): VLAN ID (1–4094)

Access ports strip tags before forwarding to end devices. Service providers can stack a second outer tag (TPID 0x88A8) using IEEE 802.1ad (QinQ) to carry customer VLANs transparently across provider networks.

Inter-VLAN Routing

Devices on different VLANs cannot communicate directly - they need a Layer 3 device.

Router-on-a-Stick

Single router interface with subinterfaces for each VLAN. Each subinterface is assigned to a VLAN and given an IP address to serve as the default gateway.

Layer 3 Switch (SVI)

Switch Virtual Interfaces handle routing internally. More efficient than router-on-a-stick as traffic doesn’t leave the switch.

Common VLAN Design

VLANPurposeExample Subnet
10Management10.0.10.0/24
20Servers10.0.20.0/24
30Workstations10.0.30.0/24
40VoIP10.0.40.0/24
50IoT/Guest10.0.50.0/24
99Native (trunk)-

Best Practices

  • Never use VLAN 1 for user traffic
  • Use dedicated management VLAN
  • Document VLAN assignments
  • Keep native VLAN consistent across trunks
  • Consider private VLANs for additional isolation
  • Use VLAN pruning to limit trunk traffic

Security Considerations

  • VLAN hopping - Attacker jumps between VLANs via double-tagging or switch spoofing
  • Mitigations:
    • Disable DTP (Dynamic Trunking Protocol, Cisco-proprietary) and configure trunk/access ports statically to prevent switch spoofing
    • Set unused ports to access mode (on an unused VLAN) and shut them down
    • Tag the native VLAN on trunks (or assign an unused dedicated native VLAN, never VLAN 1) to prevent double-tagging VLAN hopping
    • Enable port security to limit MAC spoofing, and BPDU guard on access ports to mitigate Spanning Tree (STP) hijacking (a separate Layer 2 threat)

See Also

  • ARP — ARP and broadcast traffic are scoped to a single VLAN
  • Routing — Inter-VLAN traffic requires Layer 3 forwarding
  • DHCP — DHCP relay agents bridge VLANs to a central DHCP server
  • Container Networking — Kubernetes NetworkPolicies are the cluster-native analogue of VLAN segmentation

References