Switch Port Security: 802.1X, Sticky MAC & Port Isolation Guide

Updated 2026-11-15 • By Devon Brooks, CISSP (Network Security & VPN Specialist)

Unprotected Ethernet switch access ports expose enterprise and home-office networks to unauthorized rogue hardware, MAC address spoofing, and CAM table exhaustion attacks. Implementing **Sticky MAC Port Security** limits a physical port to approved hardware addresses and disables compromised links automatically, while **802.1X EAP-TLS** enforces cryptographic identity authentication and **Port Isolation** blocks lateral Layer 2 malware traversal between endpoints on the same subnet.

Key Technical Takeaways
  • Mitigating CAM Table Flooding: Attackers flood switches with thousands of bogus source MACs to fill the Content Addressable Memory (CAM) table, forcing the switch into fail-open hub mode where it broadcasts all traffic across all ports.
  • Sticky MAC Port Security: Dynamically learns the authorized device's hardware address, records it directly into the running configuration, and executes a penalty action (Shutdown, Restrict, or Protect) if an unauthorized laptop connects.
  • Enterprise 802.1X EAP-TLS: The gold standard for zero-trust edge security, requiring certificate-based authentication against a RADIUS server (FreeRADIUS, PacketFence) before opening the port.
  • Port Isolation (Private VLAN): Blocks direct Layer-2 communication between untrusted devices (such as smart TVs or IoT hubs) sharing the same subnet, while allowing all of them to communicate upstream with the default gateway router.

The Threat: CAM Table Flooding & Rogue Physical Access

Standard Ethernet switches operate on implicit trust: any device plugged into an RJ45 wall jack is granted immediate access to the broadcast domain. This architecture introduces two severe physical-layer vulnerabilities:

  1. Rogue Device Insertion: An unauthorized visitor, contractor, or intruder in a conference room or lobby unplugs an authorized IP phone or printer and connects their own laptop, gaining immediate internal LAN access behind your perimeter firewall.
  2. CAM Table Overflow (MAC Flooding Attack): A switch maintains a Content Addressable Memory (CAM) table mapping MAC addresses to physical port numbers. Using tools like macof, an attacker generates up to 155,000 synthetic MAC addresses per second. When the CAM table exhausts its memory (typically 8,000 to 32,000 entries), the switch enters a fail-safe fail-open condition known as Fail-to-Hub mode, broadcasting all inbound frames across every port and allowing an attacker to capture sensitive corporate traffic with a passive packet sniffer.
Switch port security architecture showing 802.1X RADIUS authentication, sticky MAC address limiting, and port isolation
Figure 1: Architectural mechanisms for hardening access ports using 802.1X, Sticky MAC security, and Private VLAN port isolation.

Configuring Sticky MAC Port Security & Violation Modes

Port Security with Sticky MAC is the most practical defense for small offices, branches, and homelabs that lack full 802.1X public key infrastructure (PKI). When enabled on an access interface:

# Cisco IOS / Catalyst Configuration:
interface GigabitEthernet1/0/5
 description WORKSTATION_PORT
 switchport mode access
 switchport access vlan 10
 switchport port-security
 switchport port-security maximum 1
 switchport port-security mac-address sticky
 switchport port-security violation shutdown

The switch listens to the first frame sent by the connected PC, automatically learns its 48-bit MAC address, and writes it directly to the running configuration as a sticky entry. If an unauthorized user disconnects the PC and connects a rogue device, the switch detects a MAC address mismatch and executes one of three selectable violation actions:

  • Shutdown (Recommended): Immediately transitions the switch port into an err-disabled state, turning off port link LEDs and generating an SNMP trap/syslog alert. The port remains down until an administrator manually issues shutdown followed by no shutdown, or an errdisable recovery timer expires.
  • Restrict: Drops frames from the unauthorized MAC address, increments the security violation counter, and generates an SNMP trap while permitting the authorized device to communicate if reconnected.
  • Protect: Silently drops frames from unauthorized MAC addresses without logging, generating SNMP alerts, or disabling the interface.

Enterprise 802.1X Network Access Control (EAPOL, RADIUS & Dynamic VLANs)

For high-security environments, IEEE 802.1X replaces static MAC address filtering with cryptographic mutual authentication. 802.1X consists of three distinct entities:

  • Supplicant: Software running on the client workstation (native Windows 11, macOS, or Linux NetworkManager 802.1X client).
  • Authenticator: The managed network switch, which holds the edge port in an unauthorized, blocked state (passing only EAPOL frames on EtherType 0x888E) until authentication succeeds.
  • Authentication Server: A central RADIUS server (such as FreeRADIUS, Microsoft NPS, or PacketFence) that verifies credentials or client X.509 certificates.

Dynamic VLAN Assignment: A primary advantage of 802.1X is dynamic network steering. When an authorized corporate laptop authenticates using an internal client certificate (EAP-TLS), the RADIUS server returns Tunnel-Type = VLAN and Tunnel-Private-Group-ID = 10, instructing the switch port to join Corporate VLAN 10. If an unmanaged guest device or employee smartphone plugs in, the switch drops it into an isolated Quarantine or Guest VLAN 40 automatically.

Port Isolation (Protected Ports): Zero-Trust Layer-2 Segmentation

In many environments—such as smart-home IoT subnets, hotel guest networks, or IP security camera networks—you want to prevent devices from communicating with one another while sharing a single IP subnet without having to create dozens of complex 802.1Q VLANs.

Port Isolation (Protected Ports): When access ports are designated as Isolated / Protected, the switch ASIC drops all direct Layer-2 traffic between isolated ports. A security camera on Port 1 cannot send frames to a camera on Port 2. However, isolated ports can freely forward traffic upstream to Uplink / Promiscuous ports (the gateway router or NVR server). This eliminates lateral malware propagation, prevents ARP poisoning / man-in-the-middle attacks, and stops rogue camera scanning without burning routing tables.

Switch Edge Security Feature Comparison

Security MechanismAuthentication MethodAdministrative OverheadRogue Attachment DefenseCAM Flooding DefenseBest Deployment Scope
Sticky MAC SecurityHardware MAC addressLow (Learns on first plug)High (Shuts down port)Complete (Capped at 1 MAC)Small offices, labs, printers
Static MAC FilteringManually configured MACsHigh (Manual admin entry)Moderate (MAC spoofable)Complete (Hardware enforced)Fixed legacy industrial gear
802.1X (EAP-TLS)X.509 Cryptographic CertsHigh (Requires PKI/RADIUS)Enterprise Gold StandardComplete (Port locked until auth)Corporate workstations, laptops
802.1X (PEAP-MSCHAPv2)Active Directory Username/PWMedium (RADIUS directory)High (Resistant to spoofing)Complete (Port locked until auth)Office BYOD, domain PCs
Port Isolation (PVLAN)ASIC Forwarding RuleVery Low (Single checkbox)None (Focus is lateral containment)None (Must pair with MAC limit)IoT VLANs, Security Cameras, Guest
DHCP Snooping + DAIDHCP Transaction & ARP BindMedium (Requires snooping db)High (Stops rogue DHCP/ARP)Partial (Mitigates ARP poisoning)All managed access switches

Access Switch Port Hardening Checklist

  1. Disable all unused switch ports immediately (shutdown) and place them in an isolated, unrouted blackhole VLAN (e.g., VLAN 999).
  2. Enable Sticky MAC port security on all edge workstation interfaces with a maximum MAC threshold of 1 (or 2 if an IP phone shares the port).
  3. Configure the violation action to shutdown so unauthorized MAC attachments automatically disable the interface.
  4. Configure an automated error-disable recovery timer (errdisable recovery cause psecure-violation 300) to recover ports after 5 minutes.
  5. Enable Port Isolation (Protected Ports) across all IoT, guest Wi-Fi access point, and security camera edge ports.
  6. Activate DHCP Snooping and Dynamic ARP Inspection (DAI) on the switch to prevent rogue DHCP servers and ARP spoofing.

Frequently Asked Questions

What happens when a second device plugs into a port-secured switch port via an unmanaged hub?

If port security is set to maximum 1 and an unmanaged desktop hub is connected with two computers, the switch permits traffic from whichever computer sends the first frame. The moment the second computer transmits a packet, the switch detects that the active MAC count exceeds the threshold and immediately triggers the violation action (shutting down the entire port if set to shutdown).

Can an attacker bypass Sticky MAC port security by spoofing an authorized MAC address?

Yes. If an attacker visually reads the MAC address printed on a printer or reads an unencrypted broadcast frame, they can clone that MAC address onto their laptop. This is why high-security enterprise environments use 802.1X EAP-TLS with cryptographic certificates, which cannot be forged simply by spoofing an Ethernet MAC address.

How does Port Isolation differ from an 802.1Q VLAN?

An 802.1Q VLAN creates a distinct Layer 2 and Layer 3 broadcast domain requiring its own subnet, gateway IP, and router routing table. Port Isolation operates within a single VLAN and single IP subnet, using internal switch forwarding rules to block lateral communication between isolated ports while permitting all of them to reach the default gateway.

What is the difference between errdisable recovery and manual recovery?

When a port security violation occurs with shutdown mode, the switch places the port into an err-disabled state. By default, an administrator must manually enter interface configuration mode and issue shutdown followed by no shutdown. Enabling errdisable recovery configures a background timer (e.g., 300 seconds) that automatically tests and re-enables the port.

Related Switch Setup & Engineering Guides

Reviewed by Devon Brooks, CISSP (Network Security & VPN Specialist)

Part of the Packetsaver Network Engineering Team. All configurations and firmware safety instructions follow vendor-verified RFC and IEEE standards. Read our testing methodology →