Port Security lab practice
Limit which MAC addresses an access port accepts, choose a violation action, learn sticky addresses and recover err-disabled ports.
5 labs · 9 lessons · 8 commands · 5 projects
Port security limits which MAC addresses an access port will accept. It stops someone plugging an unmanaged switch or an unknown laptop into a wall port, and it caps the damage of a MAC flooding attack.
The configuration is short; the skill is in the details: it must be enabled with the bare switchport port-security command, sticky addresses must be saved, and you need to know how each violation mode behaves and how to recover an err-disabled port.
Hands-on labs
- Switchport Port Security (free)
- Port Security Maximum MAC Count (Pro)
- Sticky MAC Address Learning (Pro)
- Port Security Violation Action (Pro)
- A Complete Port Security Policy (Pro)
Lessons, in order
- Security Fundamentals & Threat Landscape (5. Security Fundamentals, 11 min)
- Layer 2 Port Security (5. Security Fundamentals, 9 min)
- Limit secure MAC addresses and verify sticky learning (5. Security Fundamentals, 14 min)
- Compare port-security violation modes and recovery (5. Security Fundamentals, 14 min)
- Recover err-disabled ports automatically (5. Security Fundamentals, 10 min)
- Close the native VLAN and DTP hopping paths (5. Security Fundamentals, 11 min)
- Protect an edge port with PortFast and BPDU Guard (5. Security Fundamentals, 11 min)
- Dynamic ARP Inspection (DAI) (5. Security Fundamentals, 12 min)
- Validate ARP with snooping bindings and bounded trust (5. Security Fundamentals, 14 min)
Commands
- show port-security — Summarises every port-security-enabled port: maximum and current MAC count, violation count and violation action.
- show port-security interface — Shows one port’s port-security status, violation mode, MAC limits, sticky addresses and last violating source.
- show port-security address — Lists every secure MAC address the switch holds, its VLAN, port and whether it is static, sticky or dynamic.
- show interfaces status err-disabled — Lists only the ports that are err-disabled, with the reason the switch shut each one.
- show errdisable recovery — Shows which err-disable causes recover automatically, the recovery timer, and ports waiting to recover.
- show ip arp inspection — Shows Dynamic ARP Inspection status per VLAN and counters of ARP packets forwarded and dropped.
- show mac address-table — Shows which MAC addresses the switch has learned, in which VLAN, on which port.
- show ip dhcp snooping — Shows whether DHCP snooping is on, for which VLANs, and which interfaces are trusted.
Related projects
- Port Security Hardening for Open Floor Collaboration Area — An open-plan co-working floor has four public-facing wall jacks on FLOOR-SW (two hot desks, the lobby kiosk and a spare lobby jack), and twice this quarter someone has plugged in an unmanaged switch or an unknown laptop. Put the four jacks in VLAN 30 (OPEN-FLOOR, 10.30.0.0/24) and lock each to one device: one MAC per port, learned and kept, and the port shut down on violation. The canvas opens on a Cisco Catalyst; to build it on Junos instead, delete FLOOR-SW, place a Juniper EX, and cable HOTDESK-1, HOTDESK-2 and LOBBY-KIOSK to jacks 1-3 (ge-0/0/0 to ge-0/0/2). The checks follow the hosts, so either platform is graded the same way.
- Single-MAC Port Lockdown for Unattended Lobby Sockets — A shared office building has live network sockets in an unstaffed lobby. Lock each one to a single MAC address and shut the port on violation.
- Access-Switch Security Hardening — Whitlow Conference Centre rents meeting rooms with live network ports. A delegate's travel router has already handed out addresses on the staff VLAN once. Harden the access switches against the things visitors actually do: rogue DHCP, ARP spoofing, and unused ports plugged into.
- Layered Security for a Trading Office: VLANs, Port Security and an Information Barrier — A small investment firm's compliance officer needs three controls in place before an audit: the trading desks and the back office on separate networks, trading-desk sockets that accept only the desk phone and PC, and an information barrier so the trading floor cannot reach back-office records. FIN-GW already routes both VLANs (router-on-a-stick) and translates to the internet; FIN-SW is factory-fresh. Build the switch side, lock the desk ports, and write the barrier as an access list on the gateway that also refuses any source address that does not belong on the trading VLAN.
- Enterprise Cyber Attack & Defense: Mitigating L2/L3 Exploits — Simulate active network attacks (CAM table flooding, STP root hijacking, rogue DHCP server, and VLAN hopping) in an isolated cyber range, then implement defense configurations to neutralize each exploit.