Cisco Catalyst DHCP Snooping Configuration
Protect local network clients against unauthorized DHCP servers and starvation attacks using Cisco Catalyst DHCP snooping.
In our previous switching lessons, we explored how switches forward Ethernet frames based strictly on MAC address tables. Switches operate on total trust: whatever frame enters an access port is happily switched toward its destination.
However, what happens when an unauthorized machine connects to an open wall jack and begins acting like critical network infrastructure? Well, that is where default Layer 2 operations turn into a dangerous security vulnerability.
The Dynamic Host Configuration Protocol (DHCP) was created for seamless client onboarding, not for security. Because standard DHCP messages lack cryptographic authentication, an attacker can spin up a rogue DHCP server in seconds, hand out poisoned default gateways, and hijack every byte of corporate traffic. That is why Cisco developed DHCP Snooping.
The Rogue DHCP Hazard: Man-in-the-Middle Gateway Hijacking
When an employee powers on a workstation, the computer broadcasts a DHCPDISCOVER message across the entire local VLAN, desperately asking: "Is there a DHCP server out there that can give me an IP address?"
Under normal conditions, authorized router R1 (192.168.1.1) answers with a legitimate DHCPOFFER. But what if a disgruntled employee or external intruder plugs a rogue laptop into switch SW2 on port FastEthernet0/2?
Figure 1. The Rogue DHCP Hazard: Man-in-the-Middle Gateway Hijack
As illustrated in Figure 1 above, this creates an immediate race condition. Notice the severe consequences of an unprotected access switch:
- The Response Race: The rogue server sits locally on switch SW2 and often responds faster than the genuine router R1 across the network backbone.
- The Gateway Poison: The rogue server offers a valid IP address, but injects a rogue Default Gateway (such as
192.168.1.99) pointing directly to the attacker's laptop. - Silent Man-in-the-Middle: The client workstation accepts the bogus lease. From that second forward, all web searches, credentials, and confidential files flow through the attacker's laptop before reaching the true internet.
How DHCP Snooping Works: Trusted vs Untrusted Ports
Cisco DHCP Snooping converts the Catalyst access switch into an active Layer 2 inspection firewall. Instead of blindly forwarding broadcast frames, the switch inspects every passing DHCP packet.
To enforce security, the switch divides all physical interfaces into two distinct administrative categories:
Figure 2. Trusted vs Untrusted Architecture: Switchport Firewall
Notice the vital distinction shown in Figure 2:
- Trusted Ports (Uplinks & Server Links): Configured explicitly by the administrator using
ip dhcp snooping trust. On SW1, GigabitEthernet0/2 connects to legitimate router R1; on SW2, GigabitEthernet0/1 connects to the distribution uplink. Server responses (DHCPOFFER,DHCPACK) are strictly permitted to enter through these interfaces. - Untrusted Ports (Edge Workstations): All client-facing access ports (FastEthernet0/1 through 0/3) are untrusted by default. Clients may send requests (
DHCPDISCOVER,DHCPREQUEST), but if any server response arrives on an untrusted port, the switch drops the packet instantly and logs a security violation.
The Option 82 Trap: Why Clients Fail Without Bypass
Network engineers frequently encounter a perplexing issue during their first DHCP snooping deployment: they configure trusted ports correctly, yet workstations suddenly stop receiving IP addresses completely.
This failure is caused by an architectural feature called Cisco DHCP Option 82 (also known as the Relay Agent Information Option):
Figure 3. The Option 82 Trap: Information Option Discard vs Bypass
Notice what occurs behind the wire in Figure 3:
- Default Option 82 Insertion: When DHCP snooping is enabled, Cisco switches automatically insert Option 82 metadata (switch MAC, module, and port ID) into outgoing client discover packets with Gateway IP Address (
giaddr = 0.0.0.0). - The Router Discard: When Cisco IOS router R1 receives a packet containing Option 82 on a directly connected Ethernet link without a relay agent, it treats the packet as untrusted and drops it immediately.
- The Remediation: In standard Layer 2 broadcast domains where switches do not act as relay agents, apply
no ip dhcp snooping information optionglobally across all switches to disable Option 82 insertion and restore smooth lease negotiation.
Network Addressing Plan
Review the authoritative network addressing plan and switchport trust assignments before configuring the devices:
| Device | Interface | IP Address | Snooping Role | Description |
|---|---|---|---|---|
| R1 | GigabitEthernet0/0 | 192.168.1.1/24 | N/A | Authorized DHCP Server & Gateway |
| SW1 | GigabitEthernet0/2 | Switchport | TRUSTED | Uplink to Legitimate DHCP Server R1 |
| SW1 | GigabitEthernet0/1 | Switchport | TRUSTED | Inter-Switch Trunk to SW2 |
| SW2 | GigabitEthernet0/1 | Switchport | TRUSTED | Uplink from Distribution Switch SW1 |
| SW2 | FastEthernet0/1 - 0/3 | Switchports | UNTRUSTED | Edge Access Ports (PC1, PC2, PC3) |
| PC1 | FastEthernet0 | 192.168.1.11 (DHCP) | Untrusted Client | Campus Workstation 1 |
| PC2 | FastEthernet0 | 192.168.1.12 (DHCP) | Untrusted Client | Campus Workstation 2 |
| PC3 | FastEthernet0 | 192.168.1.13 (DHCP) | Untrusted Client | Campus Workstation 3 |
Configuring DHCP Snooping: Step-by-Step
Follow this systematic four-step workflow to lock down the Layer 2 access layer across Catalyst switches SW1 and SW2.
Step 1. Enable DHCP Snooping Globally and Target Active VLANs
First, activate the snooping engine globally on switch SW1 and switch SW2, and enable inspection specifically for VLAN 1:
SW1# configure terminal
SW1(config)# ip dhcp snooping
SW1(config)# ip dhcp snooping vlan 1
SW1(config)# exit
SW2# configure terminal
SW2(config)# ip dhcp snooping
SW2(config)# ip dhcp snooping vlan 1
SW2(config)# exit
Remember: simply entering ip dhcp snooping activates the feature, but the switch does not inspect traffic until you explicitly bind it to a VLAN using ip dhcp snooping vlan 1.
Step 2. Designate Authorized Server Uplinks as Trusted Ports
Next, define the trusted paths that carry legitimate DHCP server replies toward client workstations:
SW1(config)# interface GigabitEthernet0/2
SW1(config-if)# ip dhcp snooping trust
SW1(config-if)# exit
SW2(config)# interface GigabitEthernet0/1
SW2(config-if)# ip dhcp snooping trust
SW2(config-if)# exit
Notice that we leave ports FastEthernet0/1 through 0/3 untouched on SW2. By default, unconfigured switchports remain untrusted, ensuring any rogue server attached to an access port is blocked instantly.
Step 3. Disable Option 82 Insertion on Both Switches
To prevent Cisco router R1 from discarding client discover packets with zero GIADDR, disable the information option insertion on both switches:
SW1(config)# no ip dhcp snooping information option
SW1(config)# exit
SW2(config)# no ip dhcp snooping information option
SW2(config)# exit
Step 4. Renew Workstation Leases and Verify the Binding Database
Trigger lease renewal on all client workstations to populate the active binding database:
PC1> ipconfig /renew
IP Address......................: 192.168.1.11
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.1.1
SW2# show ip dhcp snooping binding
MacAddress IpAddress Lease(sec) Type VLAN Interface
------------------ --------------- ---------- ------------ ---- --------------------
0001.4211.abcd 192.168.1.11 86400 dhcp-snooping 1 FastEthernet0/1
0002.1634.5678 192.168.1.12 86400 dhcp-snooping 1 FastEthernet0/2
0003.789a.bcde 192.168.1.13 86400 dhcp-snooping 1 FastEthernet0/3
Figure 4. The Defense Database: DHCP Snooping Binding Table & Secure Delivery
As confirmed in Figure 4 above, the Catalyst switch actively tracks client MAC addresses, assigned IP addresses, lease durations, VLANs, and physical port numbers. This binding table forms the essential security foundation for subsequent defense features such as Dynamic ARP Inspection (DAI) and IP Source Guard (IPSG).
Key Takeaways
- The Rogue Server Threat: Without Layer 2 protection, unauthorized DHCP servers can poison client gateways and execute seamless Man-in-the-Middle traffic interception.
- Trusted vs Untrusted Ports: Only trusted ports may receive server responses (
DHCPOFFER,DHCPACK). Any server message entering an untrusted port is dropped immediately. - Option 82 Bypass: On pure Layer 2 networks without DHCP relay, always apply
no ip dhcp snooping information optionso routers do not drop discover packets with zero GIADDR. - The Security Bedrock: The
DHCP Snooping Binding Databasedynamically binds MAC, IP, VLAN, and port, serving as the required database for Dynamic ARP Inspection and IP Source Guard.
Discussion & Community Notes
Ask questions, share configuration solutions, or discuss this practice lab.
