A home router on a desk socket
On Monday morning half the users on VLAN 10 can't reach the internet. Their PCs have addresses, but from the wrong range: 192.168.0.x with a gateway of 192.168.0.1. Someone has plugged a home wireless router into a desk socket (Gi1/0/5). Its built-in DHCP server is answering requests faster than R1, and every PC that takes its offer now sends traffic to a box that goes nowhere. An attacker could do the same thing on purpose and advertise itself as the gateway. A client that accepts those settings may send its off-subnet traffic towards the wrong device. Client offer-selection behaviour varies; we should not rely on the legitimate server winning a race.
DHCP (Dynamic Host Configuration Protocol) supplies settings such as an IPv4 address, mask and default gateway. DHCP snooping inspects DHCP traffic on selected switch VLANs and rejects server messages entering untrusted ports. It also records observed client leases. This is a port-direction policy, not cryptographic server authentication.
| Device | Switch port | Role and addressing |
|---|---|---|
| PC A | SW1 Gi1/0/1, untrusted | VLAN 10 DHCP client; MAC 0011.2233.4455; example lease 192.168.10.20/24 |
| R1 Gi0/1 | SW1 Gi1/0/24, DHCP-snooping trusted | 192.168.10.1/24; legitimate DHCP server and default gateway |
| Unauthorised server | SW1 Gi1/0/5, untrusted | Desk-side device offering the wrong 192.168.0.0/24 settings |
All three ports are access ports in VLAN 10 in this small lab; no relay or trunk is required. The /24 mask is 255.255.255.0. Gi1/0/1 is a physical switch-interface name, while DHCP uses UDP transport ports 68 at the client and 67 at the server. The IP addresses are not website URLs.
Device key: R1 (DHCP server) (router) · SW1 (switch) · PC A (computer) · Rogue DHCP server (home router)
Lines show the example’s network connections. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.
Reading the addresses
IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.
An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.
- R1 (DHCP server): Gi0/1 192.168.10.1
- SW1: VLAN 10
- PC A: Gi1/0/1 · untrusted
- Rogue DHCP server: Gi1/0/5 · untrusted
- 1. PC A asks for an address. The Discover is a broadcast, so SW1 floods it out of every port in VLAN 10, including Gi1/0/5.
- 2. The rogue answers first. The home router is close and not busy, so its Offer arrives before R1's.
- 3. A legitimate offer also arrives. This client selects the rogue settings in our example. Offer selection varies, so arrival order is not a security boundary.
What DHCP snooping is
DHCP snooping is a switch feature that inspects DHCP messages and decides which ports may act as DHCP servers. (For how DHCP itself works, see the DHCP lesson.) It does three jobs:
- Blocks rogue servers. Server messages are only accepted on trusted ports.
- Records who got which address. It builds the DHCP snooping binding table: one entry per lease, with the client's MAC address, IP address, VLAN, port and lease time.
- Limits DHCP floods. It can cap how many DHCP messages per second a port may send.
Every port is untrusted by default. You mark as trusted only the ports that lead to a legitimate DHCP server.
Why the switch trusts ports, not servers
Ordinary DHCP offer exchange in this lab does not authenticate the server. The switch knows something the client doesn't: which port each message came in on. Real servers normally sit behind the uplink, not behind a desk socket. So the switch can apply a simple rule based on direction:
| Message | Sent by | On an untrusted port |
|---|---|---|
| DISCOVER, REQUEST | Client | Allowed (and checked) |
| RELEASE, DECLINE | Client | Allowed only from the port in the binding for that address |
| OFFER, ACK, NAK | Server | Dropped |
The RELEASE and DECLINE check stops a different trick: an attacker sending a fake RELEASE on behalf of a victim to cancel the victim's lease. The switch also checks by default that the frame's source MAC matches the client MAC inside the DHCP message. That catches a mismatch; a source capable of forging both consistently is not authenticated by this check.
Accepted lease exchanges for clients on untrusted interfaces let the switch learn an observed MAC/IP/VLAN/interface relationship. That binding table is useful evidence, not proof that the endpoint can be trusted for every purpose. Dynamic ARP Inspection (DAI) can validate ARP claims on its untrusted ports using bindings or ARP ACL policy. IP Source Guard is another separately configured consumer; snooping alone does not filter all user IP traffic.
A normal lease, seen by the switch
Here is a normal lease through SW1, with snooping on for VLAN 10. Tap a message to see what the switch checks.
- MAC:
- 0011.2233.4455
- IP:
- 192.168.10.20
- VLAN:
- 10
- Interface:
- Gi1/0/1
Device key: PC A (computer) · SW1 (switch) · R1 (router)
Arrows run from each message's sender to its receiver. Rows show message order, not separate cables or elapsed time to scale. Port numbers identify services or conversations, not physical switch sockets.
This diagram follows a fresh dynamic lease. Lease expiry, valid release and platform-specific interface or database handling affect entry lifetime; verify the current table rather than assuming persistence.
And here is what happens to the rogue server once snooping is on:
Device key: R1 (DHCP server) (router) · SW1 (switch) · PC A (computer) · Rogue DHCP server (home router)
Lines show the example’s network connections. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.
Reading the addresses
IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.
An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.
- R1 (DHCP server): Gi0/1 192.168.10.1
- SW1: VLAN 10
- PC A: Gi1/0/1 · untrusted
- Rogue DHCP server: Gi1/0/5 · untrusted
- 1. PC A asks again. The allowed client request is forwarded towards the trusted server-facing interface.
- 2. An unsolicited rogue offer is dropped. A server message entering untrusted Gi1/0/5 is discarded at SW1; inspect supported counters or logging for the drop.
- 3. Only R1 is heard. R1's messages arrive on the trusted port, so PC A gets the right address and gateway, and SW1 records the binding.
Turning on snooping for VLAN 10
Based on Cisco IOS / IOS XE documentation, not run on a lab device. Configure the trusted uplink before or together with enabling snooping, or clients lose their leases at renewal time.
ip dhcp snooping
ip dhcp snooping vlan 10Apply after preparing the intended trust policy below. Both scopes are needed: globally enable DHCP snooping and select VLAN 10. This does not create the VLAN or configure the client access ports.
interface GigabitEthernet1/0/24
description Uplink to R1 Gi0/1
ip dhcp snooping trustThe port toward the real DHCP server. All other ports stay untrusted.
interface range GigabitEthernet1/0/1 - 23
ip dhcp snooping limit rate 15Optional lab rate limit of 15 DHCP packets per second on the stated user interfaces. Choose production limits from legitimate client behaviour; a burst above the configured threshold can err-disable a port. The reference platform has no snooping rate limit configured by default.
no ip dhcp snooping information optionFor this direct-server lab, disable option 82 insertion to avoid the untrusted zero-relay-address compatibility case described below. This is a lab choice, not a recommendation to remove option 82 from every network.
Option 82 in one paragraph
Option 82 (the relay agent information option) is a field the switch can add to client requests, saying which switch and port the request came from. A server can use it to pick an address. Cisco switches add it by default when snooping is on. The catch: the switch is not a real relay, so the packet has option 82 but an empty relay address (giaddr 0.0.0.0). A Cisco IOS DHCP server can reject that combination when it is not configured to trust the inserted information, and clients then get no address. Check the server's actual policy and drop evidence. Either disable insertion on the switch (as above) or, on the router, accept it with ip dhcp relay information trusted on the LAN interface.
Full example for SW1 and R1
! R1: global configuration, isolated lab
interface GigabitEthernet0/1
ip address 192.168.10.1 255.255.255.0
no shutdown
exit
ip dhcp excluded-address 192.168.10.1 192.168.10.19
ip dhcp pool VLAN10
network 192.168.10.0 255.255.255.0
default-router 192.168.10.1
lease 1R1 supplies available leases in the VLAN 10 /24, with itself as gateway. The example binding uses .20, but allocation order is not a security guarantee. lease 1 is one day. DNS is omitted because this lab tests IP addressing and gateway reachability, not name resolution.
! SW1: global configuration, prepare ports before enabling
vlan 10
interface range GigabitEthernet1/0/1 - 5
switchport mode access
switchport access vlan 10
no shutdown
interface GigabitEthernet1/0/24
switchport mode access
switchport access vlan 10
no shutdown
ip dhcp snooping trust
exit
no ip dhcp snooping information option
interface range GigabitEthernet1/0/1 - 23
no ip dhcp snooping trust
ip dhcp snooping limit rate 15
exit
ip dhcp snooping
ip dhcp snooping vlan 10
ip dhcp snooping database flash:dhcp-snooping.dbSW1 stages the known server-facing trust path, enables global and VLAN inspection, then configures the database destination. The filename requests supported local persistence; inspect show ip dhcp snooping database for successful writes and recovery. Other user ports remain untrusted. No automatic err-disable recovery is enabled by this example.
Configuration order reference: Catalyst 9200 IOS XE 17.14.x database command. Enable snooping before configuring the database agent. A configured destination alone does not prove that current bindings have been written.
These commands assume an isolated Catalyst IOS XE 17.x-style access-switch lab and an IOS/IOS XE DHCP-server router. Start in global configuration mode after configure terminal. Confirm the original VLAN and DHCP service work before adding inspection. The database URL and flash support vary by image; use only a supported writable lab location and verify the agent's status.
Reading the trust settings and binding table
SW1#show ip dhcp snooping Switch DHCP snooping is enabled DHCP snooping is configured on following VLANs: 10 DHCP snooping is operational on following VLANs: 10 ... Insertion of option 82 is disabled ... Verification of hwaddr field is enabled ... Interface Trusted Allow option Rate limit (pps) ----------------------- ------- ------------ ---------------- GigabitEthernet1/0/1 no no 15 GigabitEthernet1/0/2 no no 15 GigabitEthernet1/0/24 yes yes unlimited
SW1#show ip dhcp snooping binding MacAddress IpAddress Lease(sec) Type VLAN Interface ------------------ --------------- ---------- ------------- ---- -------------------- 00:11:22:33:44:55 192.168.10.20 86012 dhcp-snooping 10 GigabitEthernet1/0/1 00:11:22:33:66:77 192.168.10.21 85377 dhcp-snooping 10 GigabitEthernet1/0/2 Total number of bindings: 2
A supported logging configuration may report an event like this; exact messages and default logging vary:
%DHCP_SNOOPING-5-DHCP_SNOOPING_UNTRUSTED_PORT: DHCP_SNOOPING drop message on untrusted port, message type: DHCPOFFER, MAC sa: 00aa.bbcc.0005
When clients stop getting addresses
If clients lose their addresses right after snooping is switched on, the usual suspects are an uplink left untrusted and option 82 being rejected by an IOS DHCP server. Check those two before anything else.
| Symptom | Likely cause | Check / fix |
|---|---|---|
| No client gets an address | Uplink not trusted, so every Offer is dropped | show ip dhcp snooping; add ip dhcp snooping trust on the uplink |
| No client gets an address, uplink is trusted | Option 82 added and rejected by an IOS DHCP server | no ip dhcp snooping information option, or trust option 82 on the server |
| Snooping configured but does nothing | Global ip dhcp snooping missing, or the VLAN doesn't exist | Look for "operational on following VLANs" |
| A user port goes err-disabled | Possible DHCP rate-limit event | Check the err-disable reason and log; stop the cause or adjust a justified limit before recovery |
| DAI blocks hosts after a switch reload | Possible missing or stale binding database | Inspect bindings and database-agent status; renew the isolated test lease or restore valid records |
%PM-4-ERR_DISABLE: dhcp-rate-limit error detected on Gi1/0/5, putting Gi1/0/5 in err-disable state
Trust and VLAN mistakes
- Trusting user ports "to be safe". A trusted port can host a rogue server; trust only the path to the real one.
- Ignoring direction across several switches. Each snooping switch must deliberately allow legitimate server messages on the interface where they enter; do not trust every inter-switch port just because it is a trunk.
- Enabling snooping globally but not per VLAN (or the reverse).
- Setting a rate limit on the trusted uplink as low as on user ports. The uplink carries replies for everyone.
- Turning on Dynamic ARP Inspection before the binding table has filled up, which blocks legitimate hosts.
Exam tip: know that all ports are untrusted by default, that untrusted ports drop server messages (OFFER, ACK, NAK), and that you trust the port toward the real server. Expect a question linking DHCP snooping to DAI: DAI validates ARP against the DHCP snooping binding table. Also remember that ip dhcp snooping vlan is needed as well as the global command, and that exceeding ip dhcp snooping limit rate err-disables the port.
What to remember about DHCP snooping
- DHCP snooping blocks DHCP server messages on untrusted ports, which is every port by default.
- Trust only ports that lead to a legitimate DHCP server.
- It builds a binding table (MAC, IP, VLAN, port, lease) from ACKs it sees.
- Dynamic ARP Inspection can use that table or approved ARP ACL policy; IP Source Guard has its own supported binding policy.
- Rate limiting can contain excessive traffic on a port, but it does not authenticate hosts or stop every starvation pattern.
Short lab: verify the lease, then a wrong trust policy
- With only R1's approved service active, request a fresh DHCP lease on PC A. Record its actual address, /24 mask and gateway. Check the matching SW1 binding, including Gi1/0/1 and VLAN 10, then ping 192.168.10.1.
- In a separate isolated fault snapshot, apply
no ip dhcp snooping trustunder SW1 Gi1/0/24. Request a new test lease after releasing the old one using the lab client's controls. An existing valid lease can keep working until renewal; it does not prove new server messages are accepted. - Inspect the trust output and supported drop counters or logs. Restore
ip dhcp snooping truston Gi1/0/24, renew the client lease and recheck the binding and gateway ping. Leave user ports untrusted.
Technical reference: Cisco Catalyst DHCP snooping, binding database and option 82. All output is illustrative; no hardware validation or attack-blocking guarantee is claimed.
Test yourself on DHCP snooping
DHCP snooping is enabled for VLAN 10 on SW1. A DHCPOFFER arrives on Gi1/0/5, an untrusted user port. What does SW1 do?
After enabling DHCP snooping, no client gets an address. show ip dhcp snooping shows Gi1/0/24 (the uplink to the server) as Trusted: no. What fixes it?
Which information does a DHCP snooping binding contain?
A tool on one PC sends thousands of DHCPDISCOVER messages with random MACs. Which DHCP snooping setting stops it?
SW1 inserts option 82 and R1's DHCP-server logs confirm it rejects option 82 with giaddr 0.0.0.0 under its current trust policy. Why do clients get no lease?