DHCP Snooping – Concepts & Operation
1. What Is DHCP Snooping and Why Is It Needed?
DHCP Snooping is a Layer 2 security feature implemented on a switch that acts as a firewall between untrusted hosts and trusted DHCP servers. It inspects DHCP messages passing through the switch and filters those that could be used to attack or disrupt the network, preventing unauthorised devices from acting as DHCP servers or exhausting the address pool.
Without DHCP Snooping, any device connected to the network can respond to DHCP requests — either accidentally (a misconfigured router or VM) or maliciously (an attacker running a rogue DHCP server). The consequences range from users receiving wrong IP addresses and gateway information (leading to a man-in-the-middle attack) to complete denial of service.
| Threat | What Happens | How DHCP Snooping Helps |
|---|---|---|
| Rogue DHCP Server | An unauthorised device responds to DHCP Discover messages, assigning clients a false gateway IP — routing all their traffic through the attacker | DHCP Offers and Acks arriving on untrusted ports are dropped; only the legitimate server on the trusted port can respond |
| DHCP Starvation / Exhaustion | An attacker sends thousands of DHCP Discover messages with spoofed MAC addresses, exhausting the server's address pool so legitimate clients cannot get an IP | Rate limiting on untrusted ports caps the number of DHCP messages per second, triggering an err-disable if exceeded |
| DHCP Spoofing | A client sends a DHCP Release with a spoofed IP to force another client offline | The binding table validates that Release and Decline messages match the known client IP, MAC, port, and VLAN before allowing them |
Related pages: DHCP Overview | How DHCP Works | DHCP Relay | Dynamic ARP Inspection (DAI) | Port Security | VLANs Overview | CAM / MAC Address Table | DHCP Snooping & DAI Lab | DHCP Relay Agent Lab
2. How DHCP Snooping Works — Core Concepts
DHCP Snooping operates by classifying every switch port as either trusted or untrusted, then applying different validation rules to DHCP messages based on which type of port they arrive on.
2.1 Trusted vs Untrusted Ports
| Port Type | Connected To | Messages Allowed | Messages Dropped |
|---|---|---|---|
| Trusted | Legitimate DHCP server, uplink to another switch or router, DHCP relay agent | All DHCP messages — both client (Discover, Request) and server (Offer, Ack, Nak) | Nothing — trusted ports are not filtered |
| Untrusted (default) | End-user devices, PCs, printers, phones, wireless APs | Client-originated messages only: DHCP Discover, Request, Release, Decline, Inform | Server-originated messages: DHCP Offer and Ack — these should never come from an end device |
2.2 The DHCP Message Types — Which Direction?
DHCP Message Flow (DORA Process):
Client Switch Server
| | |
|── DHCP Discover ───>|── (forwarded) ─────>| Client → server (untrusted OK)
| |<── DHCP Offer ───────| Server → client (trusted port only)
|── DHCP Request ────>|── (forwarded) ─────>| Client → server (untrusted OK)
| |<── DHCP Ack ─────────| Server → client (trusted port only)
DHCP Snooping rule:
┌─────────────────────────────────────────────────────────────────┐
│ If DHCP Offer or Ack arrives on an UNTRUSTED port → DROP IT │
│ Only a legitimate server on a TRUSTED port may send Offers │
└─────────────────────────────────────────────────────────────────┘
3. The DHCP Snooping Binding Table
The DHCP Snooping Binding Table (also called the DHCP binding database) is a dynamic table maintained by the switch that records a verified mapping of:
Binding Table Entry Format: ┌────────────────┬─────────────────────┬──────────────┬────────┬──────────────┐ │ MAC Address │ IP Address │ Lease Time │ VLAN │ Interface │ ├────────────────┼─────────────────────┼──────────────┼────────┼──────────────┤ │ 00:1A:2B:3C:4D │ 192.168.10.10 │ 86400 sec │ 10 │ Fa0/1 │ │ 00:5E:6F:7A:8B │ 192.168.10.15 │ 86400 sec │ 10 │ Fa0/3 │ │ AA:BB:CC:DD:EE │ 192.168.20.50 │ 43200 sec │ 20 │ Fa0/7 │ └────────────────┴─────────────────────┴──────────────┴────────┴──────────────┘ Verify with: Switch# show ip dhcp snooping binding
3.1 How the Binding Table Is Populated
Step 1: Client sends DHCP Discover out Fa0/1 (untrusted port, VLAN 10)
Switch inspects the message — it is a client message (Discover) — ALLOWED
Switch forwards the frame toward the trusted uplink
Step 2: Legitimate DHCP server responds with DHCP Offer on the trusted port
Switch allows the Offer through (trusted port) — forwards to client
Step 3: Client sends DHCP Request — Switch allows (client message on untrusted port)
Step 4: Server sends DHCP Ack — Switch allows (arrived on trusted port)
★ At this moment, the switch extracts from the Ack:
- Client MAC address
- Assigned IP address
- Lease time
- VLAN
- Switch port (Fa0/1)
Switch writes a new entry into the Binding Table
Step 5: Future validation — any subsequent messages (Release, Decline) arriving
on Fa0/1 claiming IP 192.168.10.10 are checked against the binding table
If the MAC/IP/port/VLAN do not match → packet is DROPPED
3.2 Why the Binding Table Matters Beyond DHCP
The DHCP Snooping Binding Table is not just used by DHCP Snooping itself. It serves as the foundation for two other important Layer 2 security features:
| Feature | How It Uses the Binding Table |
|---|---|
| Dynamic ARP Inspection (DAI) | Validates ARP packets by checking that the sender's IP-to-MAC mapping matches a binding table entry — prevents ARP spoofing and man-in-the-middle attacks |
| IP Source Guard | Filters IP packets on untrusted ports, only allowing traffic from IP/MAC combinations that are present in the binding table — prevents IP address spoofing |
ip dhcp snooping database <url> to write the table to a
TFTP server, flash, or NVRAM so clients do not lose connectivity after a switch reload.
4. Topology – DHCP Snooping in Action
TOPOLOGY — DHCP Snooping Deployment
[ DHCP Server ]
192.168.10.1
|
Gi0/1 ← TRUSTED (server uplink)
|
┌─────────────────────┐
│ Access Switch │
│ (DHCP Snooping ON) │
└──┬──────┬──────┬───┘
| | |
Fa0/1 Fa0/2 Fa0/3
UNTRUSTED UNTRUSTED UNTRUSTED
| | |
PC-A PC-B [! Rogue DHCP Server]
(legit) (legit) (attacker device)
─────────────────────────────────────────────────────────────
What happens when the rogue device sends a DHCP Offer on Fa0/3:
→ DHCP Offer arrives on Fa0/3 (UNTRUSTED port)
→ Switch detects server-originated message on untrusted port
→ Switch DROPS the frame immediately
→ Log message generated: %DHCP_SNOOPING-5-DHCP_SNOOPING_MATCH_MAC_FAIL
─────────────────────────────────────────────────────────────
Uplink to distribution switch:
[ Access Switch ]
|
Gi0/2 ← TRUSTED (uplink trunk to distribution)
|
[ Distribution Switch ]
(also running DHCP Snooping)
5. DHCP Starvation Attack and Rate Limiting
A DHCP Starvation attack (also called DHCP exhaustion) does not require a rogue server. Instead, the attacker floods the network with DHCP Discover messages, each using a different spoofed source MAC address. The legitimate DHCP server allocates an IP address for each spoofed MAC until its entire address pool is exhausted. Legitimate clients then receive no IP address when they request one.
DHCP Starvation Attack Flow:
[Attacker Tool - e.g. Yersinia]
|
|── DHCP Discover (src MAC: AA:AA:AA:AA:AA:01) ──→ Switch → Server assigns .1
|── DHCP Discover (src MAC: AA:AA:AA:AA:AA:02) ──→ Switch → Server assigns .2
|── DHCP Discover (src MAC: AA:AA:AA:AA:AA:03) ──→ Switch → Server assigns .3
| ... (hundreds per second) ...
|── DHCP Discover (src MAC: AA:AA:AA:AA:AA:FE) ──→ Server: POOL EXHAUSTED
[ Legitimate PC ]── DHCP Discover ──→ Server: "No addresses available" → No IP
5.1 Rate Limiting — The Defence
DHCP Snooping can enforce a per-port rate limit on DHCP messages. If any
untrusted port exceeds the configured threshold (messages per second), the switch
automatically places the port into err-disabled state, shutting it down and
logging the event. The port must then be manually re-enabled (or recovered with
errdisable recovery).
Rate Limit Configuration: Switch(config-if)# ip dhcp snooping limit rate 15 ! Drops any port sending more than 15 DHCP packets/second into err-disable Automatic recovery (optional): Switch(config)# errdisable recovery cause dhcp-rate-limit Switch(config)# errdisable recovery interval 300 ! Automatically re-enables err-disabled ports after 300 seconds Verify err-disabled ports: Switch# show interfaces status err-disabled Switch# show errdisable recovery
| Rate Limit Setting | Recommended For | Notes |
|---|---|---|
| 1–15 packets/sec | End-user access ports (single PC, printer, phone) | A single legitimate client rarely sends more than 1–2 DHCP messages at boot |
| 100+ packets/sec | Ports connecting to DHCP relay agents or downstream switches | Higher limit needed as these ports aggregate traffic from many clients |
| No limit (trusted) | Trusted ports toward DHCP server or uplinks | Rate limiting is typically applied to untrusted ports only |
6. Configuration – Enabling DHCP Snooping
DHCP Snooping is configured globally and then per-VLAN. Ports are untrusted by default; only uplinks and server connections need explicit trust configuration.
! ── Step 1: Enable DHCP Snooping globally ── Switch(config)# ip dhcp snooping ! ── Step 2: Enable DHCP Snooping on specific VLANs ── Switch(config)# ip dhcp snooping vlan 10 Switch(config)# ip dhcp snooping vlan 20 Switch(config)# ip dhcp snooping vlan 10,20,30 ! comma-separated or range ! ── Step 3: Trust the uplink/server port(s) ── Switch(config)# interface GigabitEthernet0/1 Switch(config-if)# ip dhcp snooping trust ! Repeat for any other uplinks or server-facing ports ! ── Step 4: Apply rate limiting on untrusted access ports ── Switch(config)# interface range FastEthernet0/1 - 24 Switch(config-if-range)# ip dhcp snooping limit rate 15 ! ── Step 5 (optional): Persist the binding table to flash ── Switch(config)# ip dhcp snooping database flash:dhcp-snooping.db Switch(config)# ip dhcp snooping database write-delay 300 ! ── Step 6 (optional): Disable Option 82 insertion if causing issues ── ! By default, Cisco switches insert DHCP Option 82 (relay agent info) ! Some DHCP servers reject Option 82 from untrusted relays — disable if needed: Switch(config)# no ip dhcp snooping information option
no ip dhcp snooping information option command disables Option 82 insertion.
This is a very common cause of DHCP failures after enabling snooping.
6.1 Full Configuration Example
! ════════════════════════════════════════════ ! Access Switch — DHCP Snooping Full Config ! ════════════════════════════════════════════ ip dhcp snooping ip dhcp snooping vlan 10,20 ! Trusted uplink to distribution switch (trunk) interface GigabitEthernet0/1 description Uplink-to-Distribution ip dhcp snooping trust ! Trusted port directly connected to DHCP server interface GigabitEthernet0/2 description DHCP-Server ip dhcp snooping trust ! Untrusted access ports — rate limited interface range FastEthernet0/1 - 20 description Access-Port-End-Users ip dhcp snooping limit rate 15 ! Persist binding table ip dhcp snooping database flash:dhcp-snooping-binding.db ip dhcp snooping database write-delay 300 ! Disable Option 82 if DHCP server does not support it no ip dhcp snooping information option
7. Verification Commands
| Command | What It Shows |
|---|---|
show ip dhcp snooping |
Global DHCP Snooping status, enabled VLANs, Option 82 state, and database URL |
show ip dhcp snooping binding |
The full binding table: MAC, IP, lease time, VLAN, and interface for each entry |
show ip dhcp snooping statistics |
Per-port counters: forwarded, dropped, and rate-limited DHCP messages — useful for spotting attacks |
show ip dhcp snooping database |
Status of the binding table database file (last write time, URL, entries written) |
show interfaces status err-disabled |
Ports shut down due to rate limit violations — identifies attack source ports |
show errdisable recovery |
Shows which err-disable causes have automatic recovery enabled and the timer interval |
show ip dhcp snooping binding | include Fa0/5 |
Filters binding table to show only entries for a specific interface |
7.1 Sample Output – show ip dhcp snooping
Switch# show ip dhcp snooping Switch DHCP snooping is enabled DHCP snooping is configured on following VLANs: 10,20 DHCP snooping is operational on following VLANs: 10,20 DHCP snooping is configured on the following L3 Interfaces: Insertion of option 82 is disabled circuit-id default format: vlan-mod-port remote-id: 001a.2b3c.4d5e (MAC) Option 82 on untrusted port is not allowed Verification of hwaddr field is enabled Verification of giaddr field is enabled DHCP snooping trust/rate is configured on the following Interfaces: Interface Trusted Allow option Rate limit (pps) ----------------- ------- ------------ ---------------- GigabitEthernet0/1 yes yes unlimited GigabitEthernet0/2 yes yes unlimited FastEthernet0/1 no no 15 FastEthernet0/2 no no 15
7.2 Sample Output – show ip dhcp snooping binding
Switch# show ip dhcp snooping binding MacAddress IpAddress Lease(sec) Type VLAN Interface ------------------ --------------- ---------- ------------- ---- -------------------- 00:1A:2B:3C:4D:5E 192.168.10.10 86394 dhcp-snooping 10 FastEthernet0/1 00:AA:BB:CC:DD:EE 192.168.10.15 86388 dhcp-snooping 10 FastEthernet0/3 00:11:22:33:44:55 192.168.20.50 43190 dhcp-snooping 20 FastEthernet0/7 Total number of bindings: 3
8. Troubleshooting DHCP Snooping
| Symptom | Likely Cause | Fix |
|---|---|---|
| Clients cannot get an IP address after DHCP Snooping is enabled | The uplink or server port was not configured as trusted — DHCP Offers are being dropped | Add ip dhcp snooping trust to the uplink and DHCP server port |
| DHCP requests fail with Option 82 errors in server logs | DHCP Snooping is inserting Option 82 but the server rejects it | Run no ip dhcp snooping information option on the switch |
| Port goes err-disabled repeatedly | Rate limit is too low for the device (e.g., a downstream switch or DHCP relay) | Raise the rate limit or trust the port if it is a legitimate aggregation link |
| Binding table empty after switch reboot — clients lose connectivity | Binding table was not persisted; clients must re-acquire leases before DAI or IP Source Guard passes their traffic | Configure ip dhcp snooping database flash:filename.db for persistence |
| Legitimate DHCP server responses dropped on trunk port | Trunk uplink to another switch not marked as trusted — DHCP Offers dropped in transit | Ensure all inter-switch trunk ports carrying DHCP traffic are trusted |
show ip dhcp snooping shows no operational VLANs |
Global ip dhcp snooping is enabled but no VLANs specified with
ip dhcp snooping vlan |
Add ip dhcp snooping vlan <id> for each required VLAN |
See also: Troubleshooting DHCP Clients | DHCP Snooping & DAI Lab | Debug Commands | show ip interface brief
9. DHCP Snooping vs Related Security Features
| Feature | Layer | What It Prevents | Dependency |
|---|---|---|---|
| DHCP Snooping | Layer 2 | Rogue DHCP servers, DHCP starvation, DHCP spoofing | None — base feature; provides the binding table for others |
| Dynamic ARP Inspection (DAI) | Layer 2 | ARP spoofing, ARP poisoning, man-in-the-middle attacks | Requires DHCP Snooping binding table to validate ARP entries |
| IP Source Guard | Layer 3 | IP address spoofing by untrusted hosts | Requires DHCP Snooping binding table to permit valid IP/MAC pairs |
| Port Security | Layer 2 | Unauthorised devices connecting to the network, MAC flooding | Independent of DHCP Snooping; complements it at the physical access layer |
| 802.1X (Port-Based Auth) | Layer 2 | Unauthenticated devices gaining network access | Independent; works at EAP/RADIUS level before IP is assigned |
10. Key Terms Quick Reference
| Term | Definition |
|---|---|
| DHCP Snooping | A Layer 2 switch security feature that inspects DHCP messages, filters rogue server responses, and builds a binding table of valid IP/MAC/port mappings |
| Trusted Port | A switch port configured to allow all DHCP messages including server Offers and Acks; used for uplinks and DHCP server connections |
| Untrusted Port | The default state of all ports; only client-originated DHCP messages are allowed; server messages (Offer, Ack) arriving here are dropped |
| DHCP Binding Table | A dynamic database on the switch mapping each client's MAC address, IP address, lease time, VLAN, and switch port — built from successful DHCP exchanges |
| Rogue DHCP Server | An unauthorised device responding to DHCP requests — may be accidental (misconfigured host) or malicious (man-in-the-middle attack) |
| DHCP Starvation | An attack that floods the network with DHCP Discovers using spoofed MACs to exhaust the server's address pool, denying service to legitimate clients |
| Rate Limiting | A DHCP Snooping per-port control that drops a port into err-disable if it exceeds a configured number of DHCP messages per second |
| Err-Disable | A Cisco switch port state that automatically shuts down a port when a violation (such as a rate-limit breach) is detected |
| Option 82 | DHCP relay agent information option; inserted by the switch when snooping is active — may need to be disabled if the DHCP server rejects it |
| DORA | The four-step DHCP process: Discover → Offer → Request → Acknowledge |