TechKnowSurge
Cisco CCNA 5.7 CompTIA Network+ 4.2 CompTIA Network+ 4.3 Cisco CCNA 2.2 Cisco CCNA 4.3
InteractiveNetworkFree

Layer 2 Attack-to-Defense Matcher

Match nine Layer 2 attacks to the switch feature that stops each one.

Complete this interactive to capture a CTF flag worth 5 points.

About this interactive

Every Layer 2 hardening feature on a Cisco switch was invented in response to a specific attack, and the fastest way to remember the feature set is to remember what each one was built to stop. That is the whole design of this matcher: nine attacks, nine countermeasures, one pairing each. MAC address flooding pairs with port security. The attack fills the MAC address table with forged source addresses until the switch has nowhere left to record real ones and begins flooding every unknown frame out every port, turning it into a hub an attacker can sniff. Port security ends the attack at its input by limiting how many MAC addresses a single port may learn; the violation modes (protect, restrict, shutdown) differ only in how loudly the switch reacts. DHCP starvation pairs with DHCP snooping. An attacker leases every address in the pool by flooding requests with spoofed client identifiers, and legitimate hosts then get nothing. DHCP snooping rate-limits DHCP messages on untrusted ports, which is what stops starvation, and it also drops server replies arriving from untrusted ports, which is what stops the rogue-server half of the DHCP attack family. Note the side effect that matters more than the feature itself: snooping builds a binding table of valid IP-to-MAC-to-port mappings. ARP spoofing pairs with Dynamic ARP Inspection, and IP address spoofing pairs with IP Source Guard, and both of those features read that same binding table. This is the one structural insight worth carrying out of the module. DAI validates the IP-to-MAC claim inside an ARP message; IP Source Guard validates the source address of ordinary data frames. Neither can work until DHCP snooping is enabled first, because neither has any notion of a legitimate mapping without it. If a lab shows DAI dropping everything, the usual cause is not DAI. VLAN hopping appears twice, deliberately, because the two variants have completely different fixes and the exam separates them. Switch spoofing is the attacker's host pretending to be a switch: it sends DTP frames, the port negotiates a trunk, and the attacker now receives traffic from every VLAN. The fix is to stop negotiating at all, which means switchport mode access and switchport nonegotiate on every user-facing port. Double-tagging is a different trick, and it does not need a trunk. The attacker sends a frame carrying two 802.1Q tags; the first switch strips the outer tag because it matches the native VLAN, and forwards the frame with the inner tag still attached, which the second switch obeys. The fix is not about DTP at all - it is to make the native VLAN an unused VLAN with no hosts in it, so no attacker sits in the VLAN the outer tag has to match. Read the mitigation and you can name the variant. STP root bridge takeover pairs with BPDU Guard. A rogue switch advertising a very low bridge priority wins the root election, and the resulting topology recalculation drags traffic through the attacker's device. BPDU Guard is deliberately blunt: an access port configured with PortFast should never see a BPDU, so receiving one puts the port straight into err-disabled state. That bluntness is the point, and it is also the reason it belongs on edge ports rather than uplinks. An unauthorized device on an access port pairs with 802.1X. Port security keys on MAC address, which an attacker can copy from any label or sticky-learned entry; 802.1X keys on an identity proven to a RADIUS server, and holds the port closed to everything but authentication traffic until that happens. The distinction between the two is a common exam target: port security counts devices, 802.1X authenticates them. CDP and LLDP reconnaissance pairs with disabling those protocols on untrusted ports. Nothing is exploited here - the switch simply announces its model, software version, native VLAN, and port identity to anything that plugs in, and that is a reconnaissance gift that shortens the attacker's path to a working exploit. CDP is Cisco proprietary and on by default, which is why it is the one to remember. Two habits will serve you past this activity. First, when you meet a new Layer 2 feature, ask which attack it was written for; the answer is almost always a single specific one, and the pair is far easier to hold than either half alone. Second, when you build a real access-port template, apply these in dependency order - DHCP snooping first, then DAI and IP Source Guard on top of it, then port security, BPDU Guard, and 802.1X, which stand on their own.

What you'll learn

Aligned to

Cisco CCNA
5.7 Configure and verify Layer 2 security features
2.2 Configure and verify interswitch connectivity
4.3 Explain the role of DHCP and DNS within the network
CompTIA Network+
4.2 Summarize various types of attacks and their impact to the network.
4.3 Given a scenario, apply network security features, defense techniques, and solutions.

Key terms

MAC Address Flooding
An attack in which an attacker overwhelms a switch's MAC address table with spoofed addresses, causing the switch to behave like a hub and broadcast traffic to all ports.
DHCP Starvation
An attack in which an attacker exhausts all available IP addresses in a DHCP pool by sending excessive requests, preventing legitimate devices from obtaining network configuration.
ARP Spoofing
An attack technique in which a threat actor sends forged ARP reply messages to associate their MAC address with a legitimate IP address, redirecting traffic to their device.
VLAN Hopping
An attack in which traffic reaches a VLAN it should not, either by negotiating a trunk on a port left in dynamic mode or by double-tagging a frame so the outer tag is stripped as the native VLAN and the inner tag carries it into another VLAN.
Switch Spoofing
A VLAN hopping attack where an attacker mimics a switch by sending Dynamic Trunking Protocol messages to establish a trunk link and gain access to all VLANs.
Port Security
A Cisco switch feature that restricts which devices can connect to a port by limiting the number of allowed MAC addresses or requiring specific MAC addresses to be present. When a violation occurs, the port can be configured to shut down, restrict traffic, or send an alert.
DHCP Snooping
A switch security feature that classifies ports as trusted (connected to legitimate DHCP servers) or untrusted (connected to end devices) and drops DHCP server responses received on untrusted ports. It builds a binding database of valid IP-to-MAC-to-port mappings used by other Layer 2 security features like Dynamic ARP Inspection.
Dynamic ARP Inspection
DAI
A security feature on managed switches that validates ARP messages against the DHCP snooping binding database, dropping packets with invalid IP-to-MAC address mappings.
IP Source Guard
A Layer 2 security feature on switches that filters traffic by validating source IP and MAC addresses against the DHCP snooping binding database to prevent IP and MAC address spoofing.
BPDU Guard
A Cisco STP security feature applied to PortFast-enabled ports that immediately shuts down the port if a BPDU is received, preventing an unauthorized switch from being connected and disrupting the spanning tree topology. It protects access-layer ports that should only connect to end devices, not other switches.
802.1X
An IEEE standard for port-based network access control that requires devices to authenticate before gaining access to a wired or wireless network, using a supplicant, authenticator, and authentication server (typically RADIUS). It is the foundation of enterprise Wi-Fi security and wired port security using EAP methods.
Native VLAN
The one VLAN on an 802.1Q trunk whose frames are sent untagged. Any untagged frame received on the trunk is assigned to it. Both ends of a trunk must be configured with the same native VLAN.

Topics

Interactive Matching

About TechKnowSurge

TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.

Explore free tools and programs →