Layer 2 Security & Wireless Security
CCNA 200-301 · Security Fundamentals
Layer 2 is where many real attacks happen, because switches and wireless networks were designed in an era that assumed the local network was trustworthy. A rogue DHCP server, a spoofed ARP reply, or an unauthorised device plugged into a wall socket can all compromise a network without ever touching a firewall. This guide covers the three Layer 2 security features the exam tests — port security, DHCP snooping, and dynamic ARP inspection — plus the wireless security protocols that protect traffic over the air.
Port security
Port security limits which devices can use a switch port by restricting the MAC addresses allowed on it. The classic scenario is a wall socket in a public area: without port security, anyone can plug in a laptop or a rogue switch and join the network. With port security configured, the port accepts frames only from a defined set of MAC addresses. Configuration starts with switchport port-security on an access port (the port must be in access mode or a trunk with explicit configuration — port security will not work on a dynamic port). switchport port-security maximum 2 sets how many MAC addresses are allowed, and switchport port-security mac-address sticky tells the switch to learn the addresses dynamically from incoming frames and remember them, adding them to the running configuration automatically.
When a frame arrives from an unauthorised MAC address, the violation mode decides what happens. Protect drops the unauthorised frames silently, with no notification. Restrict drops the frames and logs the violation (and can send an SNMP trap). Shutdown — the default — drops the frames and error-disables the port entirely, taking it out of service until an administrator re-enables it with shutdown followed by no shutdown. The exam tests which mode does what, and the key distinction is that only shutdown disables the port; protect and restrict only drop the offending traffic. Verify with show port-security and show port-security interface GigabitEthernet0/1.
DHCP snooping and dynamic ARP inspection
DHCP snooping protects against rogue DHCP servers. An attacker who plugs in a DHCP server can hand out false gateway and DNS addresses, redirecting victims' traffic through the attacker's machine. DHCP snooping divides switch ports into trusted (ports facing the legitimate DHCP server or an uplink to another switch) and untrusted (all client-facing ports, the default). DHCP server messages — Offers and Acknowledgements — arriving on an untrusted port are dropped, so a rogue server's answers never reach clients. While it inspects DHCP traffic, the switch also builds a DHCP snooping binding table recording which MAC address legitimately holds which IP address on which port and VLAN — a table that dynamic ARP inspection then relies on. Enable it globally with ip dhcp snooping, per VLAN with ip dhcp snooping vlan 10, and mark trusted ports with ip dhcp snooping trust. DHCP snooping can also rate-limit DHCP requests on untrusted ports to blunt DHCP starvation attacks, where an attacker floods requests to exhaust the address pool.
Dynamic ARP inspection (DAI) protects against ARP spoofing (also called ARP poisoning), where an attacker sends fake ARP replies claiming that the attacker's MAC address belongs to the gateway's IP address, so victims send their traffic to the attacker. DAI intercepts ARP packets on untrusted ports and checks each one against the DHCP snooping binding table: if the sender's MAC and IP address match a legitimate binding, the ARP packet is forwarded; if not, it is dropped and logged. Enable it with ip arp inspection vlan 10, and trust the ports facing routers and other switches with ip arp inspection trust. The exam's key point is the dependency: DAI depends on the DHCP snooping binding table, so DAI is only effective on VLANs where DHCP snooping is also running.
Wireless security protocols
Wireless traffic travels through the air, so anyone in range can capture it — encryption is the only thing standing between a wireless network and anyone with a laptop nearby. WEP (Wired Equivalent Privacy) was the first wireless security protocol, using RC4 encryption with short static keys. It is thoroughly broken: its keys can be recovered in minutes, and it should never be used. WPA (Wi-Fi Protected Access) replaced WEP as a stopgap, introducing TKIP (Temporal Key Integrity Protocol) with per-packet keys and message integrity checks. WPA2 is the full standard (IEEE 802.11i), using AES encryption with CCMP — it has been the baseline for secure wireless for years and is what the exam expects you to configure. WPA3 is the current generation: it replaces the pre-shared key exchange with SAE (Simultaneous Authentication of Equals), which resists offline dictionary attacks and provides forward secrecy (captured traffic cannot be decrypted later even if the password is discovered), and it offers a 192-bit security mode for enterprise environments.
Each protocol comes in two modes. Personal (PSK) mode uses a single shared passphrase for all users — simple, and the right choice for homes and small offices. Enterprise mode uses 802.1X authentication against a RADIUS server, giving each user individual credentials and unique encryption keys — the right choice for any organisation. In the WLC GUI, configuring a WPA2 PSK WLAN means creating the WLAN, choosing WPA2 with AES encryption under the Layer 2 security settings, selecting PSK as the authentication key management method, and entering the passphrase. The exam may show a GUI screenshot or describe these settings and ask you to identify what is being configured.
Putting Layer 2 security together
These three features are usually deployed together, and the exam tests them as a system. Port security controls which devices can connect at all; DHCP snooping controls which devices can hand out addresses; and DAI controls which devices can claim an address in ARP. The deployment order matters: enable DHCP snooping first, because DAI needs its binding table, and verify the binding table with show ip dhcp snooping binding before enabling DAI — if the table is empty, DAI will drop legitimate ARP traffic. Trust the right ports in both features: uplinks toward other switches, routers, and the DHCP server are trusted, and everything facing endpoints is untrusted. A common exam scenario shows DAI dropping legitimate traffic and asks why: the usual answer is that a port facing a router was left untrusted, so the router's ARP replies were dropped. Another shows a port in err-disabled state and asks what happened: port security in shutdown mode is the usual suspect, and the fix is to find the unauthorised device, remove it, and re-enable the port with shutdown followed by no shutdown — or to configure errdisable recovery so the port recovers automatically after a timer expires.
Exam traps to watch for
- Saying port security in restrict mode disables the port. Only shutdown mode error-disables the port; restrict drops frames and logs.
- Forgetting that DAI depends on the DHCP snooping binding table. Without DHCP snooping, DAI has nothing to validate ARP packets against.
- Recommending WEP for anything. WEP is broken and should never be used; WPA2 is the baseline and WPA3 is current.
- Confusing trusted and untrusted ports in DHCP snooping: trusted ports face the DHCP server; untrusted ports face clients and drop DHCP server messages.
Practice questions
Test yourself on this guide. Answers are checked instantly, with a full explanation for each question.
Q1.A switch port is configured with port security in restrict mode. A frame arrives from an unauthorised MAC address. What happens?
Explanation: In restrict mode, port security drops frames from unauthorised MAC addresses and logs the violation (with an optional SNMP trap), but the port stays up. Option A describes shutdown mode, which error-disables the port. Option B is wrong because restrict mode drops the frames — it never forwards unauthorised traffic. Option D is wrong because no violation mode reboots the switch.
Exam objective: 200-301 5.7: Configure and verify Layer 2 security features (DHCP snooping, dynamic ARP inspection, and port security) — port security violation modes
Q2.What does the switchport port-security mac-address sticky command do?
Explanation: Sticky learning lets the switch learn the MAC addresses of devices connected to the port from their incoming frames and automatically record them as secure addresses in the running configuration, saving the administrator from typing them in manually. Option B is wrong because sticky learning is a learning method, not a block on learning. Option C is wrong because MAC addresses are not encrypted in the table. Option D is wrong because sticky MAC has nothing to do with trunk mode.
Exam objective: 200-301 5.7: Configure and verify Layer 2 security features (DHCP snooping, dynamic ARP inspection, and port security) — port security
Q3.An attacker connects a rogue DHCP server to a client-facing switch port. Which feature prevents clients from receiving the attacker's DHCP offers?
Explanation: DHCP snooping classifies client-facing ports as untrusted and drops DHCP Offer and Acknowledgement messages arriving on them, so a rogue server's offers never reach clients. Option A is wrong because port security limits MAC addresses, not DHCP messages — the rogue server's own MAC address may be perfectly legitimate. Option B is wrong because DAI validates ARP packets, not DHCP traffic. Option C is wrong because BPDU guard deals with spanning tree messages, not DHCP.
Exam objective: 200-301 5.7: Configure and verify Layer 2 security features (DHCP snooping, dynamic ARP inspection, and port security) — DHCP snooping
Q4.How does dynamic ARP inspection (DAI) decide whether an ARP packet is legitimate?
Explanation: DAI validates ARP packets on untrusted ports by comparing the sender's MAC and IP address against the DHCP snooping binding table, which records the legitimate bindings learned from DHCP traffic; mismatches are dropped. Option A is wrong because the MAC address table only maps MAC addresses to ports — it says nothing about which IP address a device should have. Option C is wrong because ARP packets are not digitally signed. Option D is wrong because VLAN membership does not prove an ARP claim is genuine.
Exam objective: 200-301 5.7: Configure and verify Layer 2 security features (DHCP snooping, dynamic ARP inspection, and port security) — DAI
Q5.Which wireless security protocol is considered broken and should never be used?
Explanation: WEP uses RC4 encryption with short static keys and has fundamental cryptographic flaws that allow its keys to be recovered in minutes — it provides no real security and should never be deployed. Option A is wrong because WPA3 is the current, strongest standard. Option B is wrong because WPA2 with AES remains a sound baseline. Option D is wrong because WPA, while superseded by WPA2, is not broken in the way WEP is.
Exam objective: 200-301 5.9: Describe wireless security protocols (WPA, WPA2, and WPA3)
Q6.What is the main security improvement of WPA3 over WPA2?
Explanation: WPA3 replaces the WPA2 pre-shared key handshake with SAE (Simultaneous Authentication of Equals), which resists offline dictionary attacks against captured handshakes and provides forward secrecy, so past traffic stays protected even if the password is later discovered. Option B is wrong because SSID length has nothing to do with WPA3's improvements. Option C is wrong because WPA3 still requires authentication — Personal mode still uses a passphrase. Option D is wrong because WPA3 does not encrypt the SSID.
Exam objective: 200-301 5.9: Describe wireless security protocols (WPA, WPA2, and WPA3)
Q7.A company wants each wireless user to authenticate with individual credentials checked against a central server, rather than sharing one passphrase. Which wireless security mode should be used?
Explanation: Enterprise mode uses 802.1X authentication against a RADIUS server, giving each user individual credentials and unique encryption keys — the right choice for an organisation. Option A is wrong because Personal (PSK) mode shares one passphrase among all users, which is the opposite of what is asked. Option B is wrong because open authentication provides no encryption and MAC filtering is trivially spoofed. Option C is wrong because WEP is broken and also uses a shared key.
Exam objective: 200-301 5.9: Describe wireless security protocols (WPA, WPA2, and WPA3) — Enterprise vs Personal
Q8.In the WLC GUI, an engineer configures a WLAN with WPA2, AES encryption, and PSK authentication. What must also be provided for clients to connect?
Explanation: PSK (Pre-Shared Key) mode authenticates clients with a shared passphrase, which must be configured on the WLAN and entered by each client when it joins. Option B is wrong because a RADIUS server is needed for Enterprise mode, not PSK mode. Option C is wrong because certificates are used in some Enterprise (EAP-TLS) deployments, not in PSK mode. Option D is wrong because IP addressing is handled by DHCP and is unrelated to wireless authentication.
Exam objective: 200-301 5.10: Configure and verify WLAN within the GUI using WPA2 PSK
Q9.A switch port with port security configured in shutdown mode (the default) detects a violation and goes err-disabled. How does an administrator restore the port?
Explanation: An err-disabled port stays down until an administrator manually re-enables it with shutdown followed by no shutdown in interface configuration mode (unless errdisable recovery is configured). Option A is wrong because there is no automatic 30-second recovery by default. Option C is wrong because a reboot is unnecessary and disruptive. Option D is wrong because changing VLAN membership does not clear the err-disabled state.
Exam objective: 200-301 5.7: Configure and verify Layer 2 security features (DHCP snooping, dynamic ARP inspection, and port security) — port security recovery