Week 10 · Lesson 9

Layer 2 Security Configuration

Routers and firewalls patrol the network edge, but most attackers are already inside the building — plugged into a wall port. Layer 2 security is what protects the switch itself: port security against rogue devices, DHCP snooping against fake DHCP servers, DAI against ARP poisoning, BPDU guard against rogue switches, and storm control against broadcast floods. Each is a small feature with one precise job, and each maps to exam questions.

CCNA 200-301 Domain 5.0 Security Fundamentals Verified 2026-10-11
Learning objectives
Part 1

Why the access layer needs security

A switch forwards frames based on MAC addresses and believes whatever it hears. Attackers exploit that trust: a rogue device can feed the switch bogus MACs (MAC flooding), impersonate another host (ARP poisoning), or offer its own DHCP service and redirect clients. Each Layer 2 attack is cheap to run and totally invisible to an edge router, so the defence must live on the switch itself.

Layer 2 security tools divide into two families: port-based controls (port security, BPDU guard, spanning-tree protection) and protocol-based validation (DHCP snooping, DAI, 802.1X). A complete access-layer design uses several at once because they defend different threats. The table below is the whole map:

FeatureAttack it mitigatesHow
Port securityRogue device / MAC floodingLimits MACs per port
DHCP snoopingRogue DHCP serverTrusts only designated ports
DAIARP poisoning / man-in-the-middleValidates ARP against the DHCP binding
802.1XUnauthorised endpointAuthenticates devices at the port
Root guardRogue root bridge takeoverStops STP root election changes
BPDU guardLayer 2 loop / rogue switchShuts ports that send BPDUs
Storm controlBroadcast/multicast floodCaps traffic rate per port
In this lesson · select a part to jump

Reference table · select a row

Part 2

Port security configuration

Port security applies to access ports only, so the port must first be switched to access mode. The feature tracks how many MAC addresses the port may learn and what happens when the limit is exceeded:

S1(config)# interface fastethernet0/1
S1(config-if)# switchport mode access
S1(config-if)# switchport port-security
S1(config-if)# switchport port-security maximum 1
S1(config-if)# switchport port-security mac-address sticky
S1(config-if)# switchport port-security violation restrict
S1(config-if)# end
S1# show port-security interface fastethernet0/1

Round trip through the syntax:

When to use sticky Sticky is perfect for desk ports where you do not know the device’s MAC ahead of time: after the first boot the address is “stuck” into the configuration, so a later rogue device triggers a violation. A user who legitimately swaps hardware is the cost — you must clear and relearn.
Key ideas & exam traps · select one

Part 3

Violation modes: protect, restrict, shutdown

When an unknown MAC arrives on a secured port, the mode decides the response. Remember these in order of severity and exactly what each one does:

ModeBehaviour on violationLogs / counter
protectSilently drops unknown frames. Existing secure addresses keep working.No syslog, no SNMP trap
restrictDrops unknown frames like protect, but also notifies.Syslog + SNMP trap + SecurityViolation counter
shutdownThe whole port enters the err-disabled state; all traffic stops.Log generated; port dead until recovered
Exam tip — mode recognition The question practically writes itself: mention silence → protect; mention logging or a counter → restrict; mention err-disable → shutdown (which is also the default). Severity order: protect → restrict → shutdown.
Part 4

err-disable and recovery

When a port is err-disabled, the interface state reads err-disabled and the switch has stopped forwarding on it completely. Recovery is manual by default:

! Manual recovery: bounce the port
S1(config)# interface fastethernet0/1
S1(config-if)# shutdown
S1(config-if)# no shutdown
S1(config-if)# exit

! Automatic recovery after 300 seconds
S1(config)# errdisable recovery cause psecure-violation
S1(config)# errdisable recovery interval 300

Why the shutdown/recovery dance? IOS leaves the port dead until an administrator fixes the real problem (a new attacker or a misconfigured NIC), so a malicious device cannot simply re-trigger traffic forever. Use show errdisable detect and show interface status to confirm the cause; the reason string (for example psecure-violation) tells you which feature disabled the port.

Note The phrase err-disable is specific to the shutdown violation mode. A port in protect or restrict mode keeps running and simply drops the offending MACs.
Part 5

DHCP snooping

DHCP snooping protects against a rogue DHCP server handing out wrong addresses. The switch builds a DHCP snooping binding table (MAC → IP → port → VLAN) as it watches legitimate DORA exchanges, then filters DHCP offer/ack frames: they are only accepted from trusted ports (the ports facing a real DHCP server or between switches). Client ports are untrusted and may only send DHCP discover/request messages; a rogue DHCP offer from a client port is dropped on arrival.

! Enable snooping globally and for the VLAN, then trust the uplink
S1(config)# ip dhcp snooping
S1(config)# ip dhcp snooping vlan 10
S1(config)# interface gigabitethernet0/1
S1(config-if)# ip dhcp snooping trust
S1(config-if)# exit

! Optionally bound the rate on untrusted ports
S1(config)# interface fastethernet0/2
S1(config-if)# ip dhcp snooping limit rate 10
S1(config-if)# exit

S1# show ip dhcp snooping binding
MacAddress          IpAddress        Lease(sec)  Type           VLAN  Interface
------------------  ---------------  ----------  -------------  ----  -----------------
00:50:79:66:68:00   192.168.10.50    86215       dhcp-snooping  10    FastEthernet0/2

The binding table is the crown: every other Layer-2 security feature reuses it. DAI checks ARP responses against it, and IP Source Guard (a related feature) filters data packets using it. Because DAI needs the table, DAI is effectively a downstream consumer of DHCP snooping — on the exam, a question that turns on DAI quietly assumes snooping is already on.

Trust direction The most common mistake is marking the wrong port trusted. The port toward the DHCP server (or toward the core) is trusted; the ports that face clients stay untrusted. Reverse it and snooping protects nothing.
Part 6

Dynamic ARP Inspection (DAI)

ARP is stateless and unauthenticated, which allows ARP poisoning: an attacker replies to a victim’s ARP request claiming “I am the gateway”, redirecting traffic through their device — a classic man-in-the-middle. DAI validates every ARP packet against the DHCP snooping binding table. If the sender’s MAC and IP in the ARP frame disagree with the binding entry for that port and VLAN, the packet is dropped (and optionally logged).

S1(config)# ip arp inspection vlan 10
S1(config)# interface gigabitethernet0/1
S1(config-if)# ip arp inspection trust
S1(config-if)# exit
S1# show ip arp inspection interfaces

Like DHCP snooping, DAI uses trusted vs untrusted ports: trusted ports (toward the core/gateway) are assumed to send valid ARP; untrusted ports (client-facing) get full validation (source and destination MAC/IP checks). A poisoned ARP reply arriving on an untrusted port never reaches the victim, so the impersonation fails at the wire.

Part 7

802.1X port-based authentication

802.1X authenticates the device before the port will pass traffic. Three roles cooperate:

Definition — EAP Extensible Authentication Protocol: the framework the supplicant and the authentication server use to exchange credentials (password, certificate, or token). The switch simply forwards EAP frames between them and lets the RADIUS verdict decide access.

Installing 802.1X makes the network port behave like a door with an ID check: no valid credential, no traffic — not even DHCP. Guests without 802.1X software typically land in a segregated guest VLAN instead, so the feature is about enforcement, not just authentication. On the exam, remember which device is which (supplicant = client, authenticator = switch, server = RADIUS) and that the port stays blocked until the server says accept.

Part 8

BPDU guard and root guard

Spanning Tree Protocol trusts any switch that sends BPDUs, which lets a rogue device become the root bridge and pull the whole topology through it. Two protections are port-level and closely related but not identical:

FeatureWhat it blocksDefault action
BPDU guardAny BPDUs on an access port (indicating a rogue/bridged device or loop)Port is err-disabled (usually via spanning-tree bpduguard)
Root guardA port becoming / propagating a better rootPort is put into root-inconsistent state; traffic still flows but BPDUs from that port are ignored
! BPDU guard: shutdown a port that receives any BPDU (access ports)
S1(config)# interface fastethernet0/24
S1(config-if)# spanning-tree bpduguard enable
S1(config-if)# exit

! Root guard: never let this port become (or forward) a superior root
S1(config)# interface fastethernet0/23
S1(config-if)# spanning-tree guard root
S1(config-if)# exit
Exam tip — BPDU guard vs root guard Two exam one-liners: BPDU guard err-disables a port that receives any BPDU; root guard prevents the port from becoming root or forwarding root-advertisement BPDUs and moves it to the root-inconsistent state (the port stays up). Also remember the classic pairing: enable portfast for immediate access-port forwarding, and BPDU guard to defend those fast ports.
Part 9

Storm control

A broadcast storm — runaway broadcast/multicast frames caused by a loop or a broken driver — can saturate a link and starve legitimate traffic. Storm control sets a ceiling (as a percentage of bandwidth or a rate of packets-per-second) on broadcast, multicast, and unknown-unicast traffic per port. Traffic above the ceiling is dropped, and the switch can be told to log or even shut the port down.

S1(config)# interface fastethernet0/24
S1(config-if)# storm-control broadcast level 50
S1(config-if)# storm-control multicast level 50
S1(config-if)# storm-control action shutdown
S1(config-if)# end
S1# show storm-control broadcast

The threshold is a percentage of the link speed. Dropping frames above the ceiling is the normal operation; the shutdown action escalates a sustained storm to err-disable, forcing attention. In a design sense, storm control is the documentation that loops are a Layer 2 hygiene problem — it contains the damage while you fix the root cause.

S1 switch DHCP server trusted (Gi0/1) Client Attacker DHCP offer? dropped untrusted ports
The trust model in one picture: the DHCP server port is trusted; client ports are untrusted. Any DHCP offer appearing from the attacker’s side is invalid and dropped before it reaches the client.
Key terms

The vocabulary you need

Every term below appears in the lesson text above. Select one to read its definition, then use the quiz at the end to check what stuck.

Key terms · select a term

Part 10 · Your turn

Review

Check what you have learned with these review questions.

Review · 5 questions

Sources

Sources & references

  1. Cisco. CCNA (200-301) Exam Topics. cisco.com.
  2. IETF. Request for Comments (RFCs). rfc-editor.org.
  3. IANA. Internet Assigned Numbers Authority registries. iana.org.

Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.