DHCP Snooping is a Layer 2 security feature available on Cisco Catalyst switches that acts as a firewall between untrusted hosts and trusted DHCP servers. It filters untrusted DHCP messages and builds a binding database (DHCP snooping binding table) that maps client MAC addresses, IP addresses, VLAN IDs, and port information. This database becomes the foundation for other security features like Dynamic ARP Inspection (DAI) and IP Source Guard.
The primary purpose of DHCP Snooping is to prevent rogue DHCP servers from distributing incorrect IP addressing information to network clients. Rogue DHCP servers can be intentionally deployed by malicious users to intercept network traffic, redirect users to phishing sites, or perform man-in-the-middle attacks. They can also be accidentally introduced when users connect unauthorized devices like wireless routers to the network.
DHCP Snooping operates by designating switch ports as either trusted or untrusted. Trusted ports connect to legitimate DHCP servers or upstream switches, while untrusted ports connect to end-user devices. The switch inspects all DHCP messages on untrusted ports and drops packets from unauthorized sources, ensuring only legitimate DHCP servers can respond to client requests.
DHCP Snooping divides switch ports into two categories:
When DHCP Snooping is enabled, the switch performs several validation checks on DHCP messages received on untrusted ports:
The DHCP snooping binding table (also called the DHCP snooping database) stores information about successful DHCP transactions. Each entry includes:
This database serves as a trusted source of IP-to-MAC-to-port bindings and is used by complementary security features like Dynamic ARP Inspection and IP Source Guard to validate ARP packets and IP traffic respectively.
An attacker connects a device configured as a DHCP server to the network. Without DHCP Snooping, this rogue server could respond faster than the legitimate server, distributing incorrect IP configurations including:
DHCP Snooping prevents this by dropping DHCP server messages on untrusted ports.
An attacker floods the network with DHCP DISCOVER messages using spoofed MAC addresses, attempting to exhaust all available IP addresses in the DHCP pool. Once the pool is exhausted, legitimate clients cannot obtain IP addresses. DHCP Snooping's rate limiting feature prevents this by limiting the number of DHCP packets per second on untrusted ports.
Critical: Before enabling DHCP Snooping, you must configure trusted ports for all uplinks and ports connecting to legitimate DHCP servers. Failing to do so will prevent all DHCP traffic, causing all clients to lose network connectivity when their current leases expire.
Switch(config)# ip dhcp snooping Switch(config)# ip dhcp snooping vlan 10,20,30
This enables DHCP Snooping globally on the switch and activates it for VLANs 10, 20, and 30. You can specify individual VLANs or ranges (e.g., vlan 10-50).
! Configure uplink port as trusted Switch(config)# interface GigabitEthernet1/0/1 Switch(config-if)# description Uplink to Core Switch Switch(config-if)# ip dhcp snooping trust Switch(config-if)# exit ! Configure DHCP server port as trusted Switch(config)# interface GigabitEthernet1/0/24 Switch(config-if)# description DHCP Server Switch(config-if)# ip dhcp snooping trust Switch(config-if)# exit
Important: All ports connecting to legitimate DHCP servers or upstream switches must be configured as trusted. Access ports connecting to end-user devices should remain untrusted (the default state).
Switch(config)# ip dhcp snooping verify mac-address
This command enables verification that the source MAC address in the Ethernet header matches the client hardware address in the DHCP payload. This prevents MAC address spoofing attacks.
! Apply rate limiting to access ports Switch(config)# interface range GigabitEthernet1/0/2-23 Switch(config-if-range)# description Access Ports Switch(config-if-range)# ip dhcp snooping limit rate 10 Switch(config-if-range)# exit
This limits untrusted ports to 10 DHCP packets per second, preventing DHCP starvation attacks. The appropriate rate depends on your environment; 10-100 packets/second is typical for access ports.
! Enable DHCP Snooping Switch(config)# ip dhcp snooping Switch(config)# ip dhcp snooping vlan 10,20,30 Switch(config)# ip dhcp snooping verify mac-address ! Configure trusted uplink Switch(config)# interface GigabitEthernet1/0/1 Switch(config-if)# description Uplink to Distribution Switch(config-if)# ip dhcp snooping trust ! Configure trusted DHCP server port Switch(config)# interface GigabitEthernet1/0/24 Switch(config-if)# description DHCP Server Switch(config-if)# ip dhcp snooping trust ! Configure untrusted access ports with rate limiting Switch(config)# interface range GigabitEthernet1/0/2-23 Switch(config-if-range)# description Access Ports Switch(config-if-range)# ip dhcp snooping limit rate 15
By default, the DHCP snooping binding table exists only in RAM and is lost when the switch reboots. To maintain bindings across reboots, configure persistent storage:
Switch(config)# ip dhcp snooping database flash:dhcp-snooping.db Switch(config)# ip dhcp snooping database write-delay 300
This stores the database in flash memory with a write delay of 300 seconds (5 minutes). The write delay batches updates to reduce flash wear.
Switch(config)# ip dhcp snooping database tftp://192.168.1.100/dhcp-snooping.db Switch(config)# ip dhcp snooping database write-delay 300 Switch(config)# ip dhcp snooping database timeout 3600
This stores the database on a TFTP server. The timeout value (3600 seconds = 1 hour) specifies how long to wait for the TFTP server to respond before giving up.
DHCP Option 82 (Relay Agent Information Option) allows switches to insert information about the client's location in DHCP packets. This helps DHCP servers provide location-specific configurations.
! By default, DHCP Snooping drops packets with Option 82 ! Allow Option 82 packets Switch(config)# ip dhcp snooping information option allow-untrusted
! Configure switch to insert Option 82 information Switch(config)# ip dhcp snooping information option ! Specify custom format (optional) Switch(config)# ip dhcp snooping information option format remote-id string BUILDING-1-FLOOR-2
You can enable DHCP Snooping selectively on specific VLANs:
! Enable on multiple VLANs Switch(config)# ip dhcp snooping vlan 10,20,30-40 ! Add more VLANs later Switch(config)# ip dhcp snooping vlan 50 ! Remove VLANs from snooping Switch(config)# no ip dhcp snooping vlan 30
When using IP phones with PCs connected through the phone's switch port, both devices need DHCP. Configure appropriate rate limits:
! Ports with IP phones typically need higher rate limits Switch(config)# interface range GigabitEthernet1/0/5-20 Switch(config-if-range)# description IP Phone + PC Ports Switch(config-if-range)# ip dhcp snooping limit rate 20
Switch# show ip dhcp snooping Switch DHCP snooping is enabled DHCP snooping is configured on following VLANs: 10,20,30 DHCP snooping is operational on following VLANs: 10,20,30 DHCP snooping is configured on the following L3 Interfaces: Insertion of option 82 is enabled circuit-id default format: vlan-mod-port remote-id: 0cd0.f89a.2c00 (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) ----------------------- ------- ------------ ---------------- GigabitEthernet1/0/1 yes yes unlimited GigabitEthernet1/0/24 yes yes unlimited GigabitEthernet1/0/2 no no 15 GigabitEthernet1/0/3 no no 15
Switch# show ip dhcp snooping binding MacAddress IpAddress Lease(sec) Type VLAN Interface ------------------ --------------- ---------- ------------- ---- -------------------- 00:50:56:A1:2B:3C 192.168.10.100 86395 dhcp-snooping 10 GigabitEthernet1/0/5 00:50:56:A1:4D:5E 192.168.10.101 86398 dhcp-snooping 10 GigabitEthernet1/0/6 00:1A:2B:3C:4D:5E 192.168.20.50 86400 dhcp-snooping 20 GigabitEthernet1/0/10 Total number of bindings: 3
Switch# show ip dhcp snooping statistics Packets Forwarded = 1245 Packets Dropped = 15 Packets Dropped From untrusted port = 15
Switch# show ip dhcp snooping binding interface GigabitEthernet1/0/5 MacAddress IpAddress Lease(sec) Type VLAN Interface ------------------ --------------- ---------- ------------- ---- -------------------- 00:50:56:A1:2B:3C 192.168.10.100 86395 dhcp-snooping 10 GigabitEthernet1/0/5 Total number of bindings: 1
Switch# show ip dhcp snooping database Agent URL : flash:dhcp-snooping.db Write delay Timer : 300 seconds Abort Timer : 300 seconds Agent Running : No Delay Timer Expiry : Not Running Abort Timer Expiry : Not Running Last Succeeded Time : None Last Failed Time : None Last Failed Reason : No failure recorded. Total Attempts : 0 Startup Failures : 0 Successful Transfers : 0 Failed Transfers : 0 Successful Reads : 0 Failed Reads : 0 Successful Writes : 0 Failed Writes : 0 Media Failures : 0
Symptoms: After enabling DHCP Snooping, clients fail to get DHCP addresses
Common Causes and Solutions:
! Verify trusted ports Switch# show ip dhcp snooping | include Trusted ! If DHCP server port is not listed, configure it as trusted Switch(config)# interface GigabitEthernet1/0/24 Switch(config-if)# ip dhcp snooping trust
! Ensure uplink ports are trusted Switch(config)# interface GigabitEthernet1/0/1 Switch(config-if)# ip dhcp snooping trust
! Verify DHCP Snooping VLANs Switch# show ip dhcp snooping | include VLAN ! Add missing VLANs Switch(config)# ip dhcp snooping vlan 10
Symptoms: DHCP statistics show increasing dropped packets
! Check statistics Switch# show ip dhcp snooping statistics Packets Dropped = 450 Packets Dropped From untrusted port = 450
Solutions:
! Enable debug to see what's being dropped Switch# debug ip dhcp snooping packet ! Look for DHCP OFFER or ACK messages on untrusted ports ! These indicate rogue DHCP servers ! Find the port Switch# show ip dhcp snooping binding ! Investigate the device connected to the suspicious port
! Check if rate limiting is too restrictive Switch# show ip dhcp snooping | include rate ! Increase rate limit if legitimate traffic is being dropped Switch(config)# interface GigabitEthernet1/0/10 Switch(config-if)# ip dhcp snooping limit rate 20
Symptoms: DHCP requests fail with MAC verification errors
Solutions:
! Check if MAC verification is enabled Switch# show ip dhcp snooping | include hwaddr Verification of hwaddr field is enabled ! Some devices (like VMware VMs with certain network adapters) may have issues ! Disable MAC verification if necessary (reduces security) Switch(config)# no ip dhcp snooping verify mac-address ! Or configure specific ports to bypass verification ! (This is not a standard Cisco feature - consider alternative solutions)
Symptoms: DHCP fails when relay agents or certain servers are involved
Solutions:
! Allow Option 82 on untrusted ports if needed Switch(config)# ip dhcp snooping information option allow-untrusted ! Or disable Option 82 insertion entirely Switch(config)# no ip dhcp snooping information option
Symptoms: After switch reload, all clients must renew DHCP leases
Solutions:
! Configure database storage Switch(config)# ip dhcp snooping database flash:dhcp-snooping.db ! Verify database is being written Switch# show ip dhcp snooping database ! Check for write errors in logs Switch# show logging | include DHCP
! Enable DHCP Snooping debugging (use carefully in production) Switch# debug ip dhcp snooping packet Switch# debug ip dhcp snooping event Switch# debug ip dhcp snooping agent ! Disable debugging after troubleshooting Switch# undebug all
Warning: Debug commands generate significant output and CPU load. Use them sparingly in production environments and disable them immediately after troubleshooting.
DAI uses the DHCP snooping binding table to validate ARP packets. It prevents ARP spoofing attacks by verifying that ARP packets contain valid IP-to-MAC mappings.
! Enable DHCP Snooping first Switch(config)# ip dhcp snooping Switch(config)# ip dhcp snooping vlan 10 ! Configure trusted port Switch(config)# interface GigabitEthernet1/0/1 Switch(config-if)# ip dhcp snooping trust ! Enable Dynamic ARP Inspection Switch(config)# ip arp inspection vlan 10 ! Configure DAI trusted ports (usually same as DHCP Snooping trusted ports) Switch(config)# interface GigabitEthernet1/0/1 Switch(config-if)# ip arp inspection trust
IP Source Guard prevents IP address spoofing by filtering traffic based on the DHCP snooping binding table. It ensures devices can only send traffic using their legitimately assigned IP addresses.
! Enable DHCP Snooping first Switch(config)# ip dhcp snooping Switch(config)# ip dhcp snooping vlan 10 ! Enable IP Source Guard on access ports Switch(config)# interface range GigabitEthernet1/0/2-24 Switch(config-if-range)# ip verify source ! Or enable with MAC address verification Switch(config-if-range)# ip verify source port-security
DHCP Snooping works alongside Port Security to provide comprehensive access layer security:
! Configure Port Security Switch(config)# interface GigabitEthernet1/0/5 Switch(config-if)# switchport mode access Switch(config-if)# switchport port-security Switch(config-if)# switchport port-security maximum 2 Switch(config-if)# switchport port-security violation restrict Switch(config-if)# switchport port-security aging time 1440 ! DHCP Snooping rate limiting Switch(config-if)# ip dhcp snooping limit rate 15
ip dhcp snooping verify mac-address unless compatibility issues arise! ============================================ ! DHCP Snooping Configuration - Access Switch ! ============================================ ! Enable DHCP Snooping globally ip dhcp snooping ip dhcp snooping vlan 10,20,30 ! Enable MAC address verification ip dhcp snooping verify mac-address ! Configure Option 82 ip dhcp snooping information option ! Configure database persistence ip dhcp snooping database flash:dhcp-snooping.db ip dhcp snooping database write-delay 300 ! ============================================ ! Trusted Ports Configuration ! ============================================ ! Uplink to distribution switch (TRUSTED) interface GigabitEthernet1/0/1 description Uplink to Distribution Switch switchport mode trunk switchport trunk allowed vlan 10,20,30 ip dhcp snooping trust spanning-tree portfast trunk ! ! DHCP Server Port (TRUSTED) interface GigabitEthernet1/0/24 description DHCP Server switchport mode access switchport access vlan 10 ip dhcp snooping trust spanning-tree portfast ! ! ============================================ ! Access Ports Configuration (UNTRUSTED) ! ============================================ ! Standard access ports interface range GigabitEthernet1/0/2-12 description Standard User Ports switchport mode access switchport access vlan 10 switchport voice vlan 20 ip dhcp snooping limit rate 15 spanning-tree portfast spanning-tree bpduguard enable ! ! Guest network ports interface range GigabitEthernet1/0/13-20 description Guest Network Ports switchport mode access switchport access vlan 30 ip dhcp snooping limit rate 10 spanning-tree portfast spanning-tree bpduguard enable ! ! Conference room ports (higher rate limit for multiple devices) interface range GigabitEthernet1/0/21-23 description Conference Room Ports switchport mode access switchport access vlan 10 switchport voice vlan 20 ip dhcp snooping limit rate 25 spanning-tree portfast ! ! ============================================ ! Optional: Integration with DAI and IPSG ! ============================================ ! Enable Dynamic ARP Inspection ip arp inspection vlan 10,20,30 ip arp inspection validate src-mac dst-mac ip ! Trust DAI on uplink and server ports interface GigabitEthernet1/0/1 ip arp inspection trust ! interface GigabitEthernet1/0/24 ip arp inspection trust ! ! Enable IP Source Guard on access ports interface range GigabitEthernet1/0/2-23 ip verify source ! ! Save configuration end write memory
! Verify DHCP Snooping is enabled Switch# show ip dhcp snooping Switch DHCP snooping is enabled DHCP snooping is configured on following VLANs: 10,20,30 DHCP snooping is operational on following VLANs: 10,20,30 ! Check trusted ports Switch# show ip dhcp snooping | begin Interface Interface Trusted Allow option Rate limit (pps) ----------------------- ------- ------------ ---------------- GigabitEthernet1/0/1 yes yes unlimited GigabitEthernet1/0/24 yes yes unlimited GigabitEthernet1/0/2 no no 15 GigabitEthernet1/0/3 no no 15 ! View binding table Switch# show ip dhcp snooping binding MacAddress IpAddress Lease(sec) Type VLAN Interface ------------------ --------------- ---------- ------------- ---- -------------------- 00:50:56:A1:2B:3C 192.168.10.100 86395 dhcp-snooping 10 GigabitEthernet1/0/5 00:1A:2B:3C:4D:5E 192.168.10.101 86398 dhcp-snooping 10 GigabitEthernet1/0/6 00:0C:29:5F:6A:7B 192.168.20.50 86400 dhcp-snooping 20 GigabitEthernet1/0/8 ! Check statistics Switch# show ip dhcp snooping statistics Packets Forwarded = 3542 Packets Dropped = 0 Packets Dropped From untrusted port = 0
! Check for dropped packets (potential attacks or misconfigurations) Switch# show ip dhcp snooping statistics ! Review binding table size and entries Switch# show ip dhcp snooping binding | include Total Total number of bindings: 45 ! Check database status Switch# show ip dhcp snooping database | include Successful Successful Writes : 12
! Review full binding table for anomalies Switch# show ip dhcp snooping binding ! Check for excessive drops on specific interfaces Switch# show interfaces | include drops ! Verify trusted port configuration hasn't changed Switch# show ip dhcp snooping | include Trusted
Configure SNMP to monitor DHCP Snooping status and receive alerts:
! Enable SNMP traps for DHCP Snooping Switch(config)# snmp-server enable traps dhcp-snooping ! Configure SNMP community and trap destination Switch(config)# snmp-server community NetworkMonitor RO Switch(config)# snmp-server host 192.168.1.50 version 2c NetworkMonitor
! Configure syslog for DHCP Snooping events Switch(config)# logging host 192.168.1.100 Switch(config)# logging trap informational ! Review DHCP Snooping logs Switch# show logging | include DHCP Jan 31 14:23:45.123: %DHCP_SNOOPING-6-AGENT_OPERATION_SUCCEEDED: DHCP snooping database agent operation succeeded. Jan 31 14:25:10.456: %DHCP_SNOOPING-5-DHCP_SNOOPING_MATCH_MAC_FAIL: Packet with invalid source MAC on Gi1/0/15
Use EEM (Embedded Event Manager) to create custom alerts for DHCP Snooping events:
! Alert when DHCP packets are dropped event manager applet DHCP-DROP-ALERT event syslog pattern "DHCP_SNOOPING.*DROP" action 1.0 syslog msg "ALERT: DHCP Snooping dropped packets detected!" action 2.0 mail server "192.168.1.100" to "netadmin@company.com" from "switch@company.com" subject "DHCP Snooping Alert" ! ! Alert when rogue DHCP server detected event manager applet ROGUE-DHCP-ALERT event syslog pattern "DHCP_SNOOPING.*untrusted.*OFFER" action 1.0 syslog msg "CRITICAL: Rogue DHCP server detected!" action 2.0 mail server "192.168.1.100" to "security@company.com" from "switch@company.com" subject "SECURITY ALERT: Rogue DHCP Server"
Problem: After enabling DHCP Snooping, some users cannot obtain IP addresses while others can.
Switch# show ip dhcp snooping ! Check if DHCP Snooping is enabled ! Verify correct VLANs are configured
Switch# show ip dhcp snooping | include Interface ! Verify uplink and DHCP server ports are trusted ! If not, configure them: Switch(config)# interface GigabitEthernet1/0/1 Switch(config-if)# ip dhcp snooping trust
Switch# show ip dhcp snooping statistics Packets Forwarded = 150 Packets Dropped = 45 Packets Dropped From untrusted port = 45 ! High drop count indicates misconfiguration or attack
! Enable debug during maintenance window only Switch# debug ip dhcp snooping packet ! Observe output for dropped packets ! Look for messages like: ! "DHCP_SNOOPING: received OFFER on untrusted port Gi1/0/15" ! This indicates a rogue DHCP server on port Gi1/0/15
! Check what's connected to the problem port Switch# show mac address-table interface GigabitEthernet1/0/15 ! Check CDP neighbors Switch# show cdp neighbors GigabitEthernet1/0/15 ! Review port description Switch# show interface GigabitEthernet1/0/15 description
! If it's a legitimate DHCP server, trust the port Switch(config)# interface GigabitEthernet1/0/15 Switch(config-if)# ip dhcp snooping trust ! If it's a rogue server, shut down the port Switch(config)# interface GigabitEthernet1/0/15 Switch(config-if)# shutdown Switch(config-if)# description DISABLED - Rogue DHCP server detected ! Investigate the connected device ! Contact user or security team
! Check that drops have stopped Switch# show ip dhcp snooping statistics ! Verify clients are getting addresses Switch# show ip dhcp snooping binding ! Test from client devices ! Disable and re-enable network adapter or run: ! ipconfig /release ! ipconfig /renew
| Feature | DHCP Snooping | DHCP Relay Agent | Port Security |
|---|---|---|---|
| Primary Purpose | Prevent rogue DHCP servers | Forward DHCP across subnets | Limit MAC addresses per port |
| Security Level | High - Layer 2 filtering | Medium - forwarding control | Medium - access control |
| Trusted Ports | Yes - required configuration | N/A | N/A |
| Binding Table | Yes - IP/MAC/VLAN/Port | No | No - only MAC table |
| Integration | DAI, IPSG, Port Security | Works with DHCP Snooping | Works with DHCP Snooping |
| Complexity | Medium | Low | Low |
A: Yes, DHCP Snooping and DHCP relay work together. Configure the port connecting to the DHCP relay agent as trusted, and the relay agent will forward DHCP requests to the remote DHCP server normally.
A: DHCP Snooping only affects DHCP traffic. Devices with static IP addresses are not impacted. However, if using Dynamic ARP Inspection (which relies on DHCP Snooping bindings), you'll need to create static ARP ACLs for devices with static IPs.
A: Existing leases remain valid. The binding table populates as clients renew their leases. Clients don't need to release and renew immediately; the table builds over time as normal DHCP renewal occurs.
A: Each binding entry requires approximately 200-300 bytes. A network with 1,000 DHCP clients would use roughly 200-300 KB of memory, which is minimal on modern switches.
A: DHCP Snooping prevents rogue DHCP servers and DHCP starvation attacks (with rate limiting). However, it doesn't prevent all Layer 2 attacks. Combine it with DAI, IPSG, Port Security, and BPDU Guard for comprehensive Layer 2 security.
A: Modern Cisco switches perform DHCP Snooping in hardware (ASIC) with negligible performance impact. CPU impact is minimal as DHCP traffic represents a tiny fraction of overall network traffic.
A: Trunk ports connecting to other switches should be configured as trusted. The VLAN configuration applies to the VLANs traversing the trunk; DHCP Snooping processes DHCP packets for configured VLANs on trunk links.
DHCP Snooping is a fundamental Layer 2 security feature that protects networks from rogue DHCP servers and related attacks. By creating a trusted boundary between legitimate DHCP infrastructure and end-user devices, it prevents attackers from distributing malicious network configurations that could redirect traffic, enable man-in-the-middle attacks, or cause denial of service.
Successful DHCP Snooping deployment requires careful planning to identify and configure trusted ports, appropriate rate limiting to prevent DHCP starvation attacks, and integration with complementary security features like Dynamic ARP Inspection and IP Source Guard. The binding table created by DHCP Snooping becomes the foundation for these additional security layers, creating a comprehensive defense-in-depth strategy for Layer 2 security.
When implemented with proper testing, monitoring, and maintenance procedures, DHCP Snooping provides robust protection with minimal operational overhead. Regular monitoring of drop statistics, binding table review, and configuration audits ensure the feature continues protecting the network effectively. Combined with other Layer 2 security features and proper physical security, DHCP Snooping significantly strengthens network security posture against common access layer attacks.