Pcornel
Networking · Switching

Layer 2 Security

Cheat sheet · https://pcornel.dk/topic.php?topic=616

Back to the Topic

Answer

Layer 2 security features protect the access layer: port security limits MAC addresses per port, DHCP snooping blocks rogue DHCP servers and builds a binding table, Dynamic ARP Inspection and IP Source Guard use that table to stop spoofing, and BPDU guard stops rogue switches.

Remember

DHCP snooping must be in place before DAI and IP Source Guard, since both rely on its bindings. Mark uplinks towards the real DHCP server and other switches as trusted. Statically addressed hosts need static bindings or ARP ACLs, or DAI drops them.

First checks

  • show port-security — ports with port security, violations and action.
  • show ip dhcp snooping — VLANs with snooping and trusted ports.
  • show ip dhcp snooping binding — IP-to-MAC bindings learned from DHCP.
  • show ip arp inspection — DAI per VLAN and drop counters.
  • show interfaces status err-disabled — ports shut by a security feature.
  • show errdisable recovery — automatic recovery settings.

Commands

show port-security interface <interface>
Port Security
show ip dhcp snooping
DHCP Snooping
show ip dhcp snooping binding
DHCP Snooping
show ip arp inspection*
DAI

Verify in this order

feature enabled on the VLAN or port → trusted ports defined → bindings learned or configured → legitimate traffic matches and passes → spoofed or excess traffic dropped and logged

Where it usually breaks

physical/link dependency → local object state → peer/control state → policy → forwarding/adjacency → end-to-end result

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=616

Confirmation

Confirm action

Continue?