How To

Configure Cisco DHCP Snooping to Block Rogue Servers

When a PC boots, it trusts the first DHCP server that answers. It cannot tell the company’s real server from a cheap router someone plugged into a wall jack, so whichever replies first hands out the IP address, the subnet mask, and the default gateway. Point that gateway at an attacker’s machine and every packet the victim sends to the internet runs through it. DHCP snooping is the switch feature that ends the race.

Original content from computingforgeeks.com - post 169495

DHCP snooping makes the switch inspect every DHCP message and decide which ports may send server replies. The port facing the real server is trusted, every other port is untrusted, and an offer arriving on an untrusted port is dropped before it reaches a client. It also records every lease in a binding table that dynamic ARP inspection and IP source guard depend on.

In our lab we enable snooping, trust the uplink to the real server, read the binding table, then plant a rogue DHCP server on an untrusted port and watch its offers disappear. IPv6 has the same weakness through router advertisements, so a later section adds RA guard. The snooping and RA guard commands ran on a Cisco IOS 15.2 lab switch, the router-port policy follows Cisco’s Catalyst 9300 guide, and the whole page was rechecked against that guide in December 2026.

How DHCP snooping works

Snooping splits the switch ports into two camps, and the camp decides which DHCP messages a port may carry:

  • Trusted: any DHCP message, including the server replies (OFFER, ACK, NAK) that hand out addresses.
  • Untrusted: only the client messages (DISCOVER, REQUEST) a normal host sends. A server reply arriving on an untrusted port is dropped, which is exactly how a rogue server goes quiet.

Only the links to legitimate DHCP servers and the uplinks toward them should be trusted. Every access port facing a user is left untrusted, because a user device has no business answering DHCP. While snooping watches the real handshakes complete, it records each lease in the DHCP snooping binding table: the client MAC, the leased IP, the VLAN, the port, and the lease time. That table is the durable record other network security features read.

The lab topology

Our lab has a switch, a real DHCP server, a client, and a rogue server. SW1 runs DHCP snooping on its VLAN. Gi0/1 to the real server is the only trusted port. The client on Gi0/2 and the rogue server on Gi0/3 are both untrusted, which is what lets the switch drop the rogue’s offers while the client still gets a real lease.

DHCP snooping topology where SW1 trusts only the real DHCP server port Gi0/1 and drops rogue DHCP offers from the untrusted Gi0/3

The same four nodes built in GNS3, where the configuration below was applied and tested on real Cisco IOS:

GNS3 canvas with a client, SW1, a legitimate DHCP server, and a rogue DHCP server for the DHCP snooping lab

With the topology in place, turn snooping on.

Configure DHCP snooping

Snooping is enabled globally and then armed per VLAN. Nothing is inspected until you name the VLANs to watch:

ip dhcp snooping
ip dhcp snooping vlan 1

At this point every port is untrusted, including the one facing your real server, so DHCP would break for everyone until you fix it. Trust the link toward the legitimate server, and only that link:

interface GigabitEthernet0/1
 ip dhcp snooping trust
 exit

One more line saves a confusing failure on a flat access switch. By default the snooping switch inserts DHCP option 82 into the requests it forwards. A Cisco IOS DHCP server or relay that receives a request carrying option 82 with a zero giaddr treats it as suspect and discards it, so leases fail even though snooping itself did nothing wrong. On a simple Layer 2 segment with no relay, turn the insertion off on the switch:

no ip dhcp snooping information option

That completes the configuration, with snooping armed on the VLAN, the server port trusted and option 82 out of the way. Confirm it took before relying on it.

Verify DHCP snooping is on

The summary command confirms snooping is enabled, which VLANs it is operating on, and which ports are trusted, all in one screen.

Cisco IOS show ip dhcp snooping output: snooping enabled and operational on VLAN 1 with GigabitEthernet0/1 trusted

Snooping is enabled and operational on VLAN 1, option 82 insertion is off, and the trust table lists a single trusted interface, Gi0/1. Every other port, including the rogue’s Gi0/3, is untrusted by default and never appears in that list. That one trusted entry is the whole policy.

Block the rogue server and read the binding table

With both servers powered on, the client boots and broadcasts a DISCOVER. Both servers answer, but the rogue’s offer arrives on the untrusted Gi0/3 and the switch drops it, so the client only ever sees the real server’s reply. The client ends up with an address from the legitimate 192.168.10.0/24 pool, not the rogue’s 10.6.6.0/24:

Cisco client show ip interface brief and show dhcp lease confirming it leased 192.168.10.2 from the real server, not the rogue 10.6.6.0 pool

Its lease is bound to 192.168.10.1, the real server. On the switch, the binding table records that lease and the statistics counter proves the rogue was stopped:

Cisco IOS show ip dhcp snooping binding table with one client lease and statistics showing 2 packets dropped from untrusted ports

One binding exists, the client’s real lease on the untrusted Gi0/2, exactly the entry dynamic ARP inspection will later check ARP replies against. The statistics line is the proof of the block: two packets dropped, both from untrusted ports, which are server replies from the rogue that never reached the client. The attack failed silently, and the user never knew there was a second server on the wire.

RA guard: block rogue IPv6 routers

DHCP snooping only reads IPv4 DHCP. An IPv6 host using SLAAC does not ask a server for its gateway at all; it builds an address from the prefix in a router advertisement (an ICMPv6 message) and takes the sender as its default router. Any device that sends RAs, a laptop running a virtual router or a home router plugged in backwards, becomes the default router for every SLAAC host that hears it. That is the rogue DHCP attack again, and snooping cannot see it. RA guard is the IPv6 first hop security feature that closes it: a policy with device-role host drops every router advertisement and redirect arriving on the ports it is attached to.

For this part we built a second small topology with a fresh switch on the same IOSvL2 image, and the ports swap roles compared with the DHCP lab. A rogue router on Gi0/2 runs ipv6 unicast-routing with ipv6 address 2001:db8:bad::1/64 and ipv6 nd ra interval 4, so it announces 2001:db8:bad::/64 every 4 seconds. A host on Gi0/3 builds its address with ipv6 address autoconfig default. Create a host-role policy and attach it to the rogue’s port:

ipv6 nd raguard policy HOSTS
 device-role host
 exit
interface GigabitEthernet0/2
 ipv6 nd raguard attach-policy HOSTS
 end

Read the policy back to see its role and every port it is attached to, the first thing to check when RA guard seems to do nothing:

show ipv6 nd raguard policy HOSTS

IOSvL2 accepted the policy and reports it on Gi0/2 for all VLANs:

Policy HOSTS configuration:
  device-role host
Policy HOSTS is applied on the following targets:
Target               Type  Policy               Feature        Target range
Gi0/2                PORT  HOSTS                RA guard       vlan all

In production nobody knows which port a rogue will appear on, so the host policy goes on every access port with interface range (or on the VLAN), with the uplink kept out of that range. On a Catalyst access switch running the IPv6-enabled SDM template Cisco lists as a prerequisite, a host-role port drops the RA before any client sees it. The virtual switch told a different story. After the policy went on, the host’s interface was shut, its autoconfig removed and re-added, and the port brought back up, and the host came back with the rogue as its default router. A later read of the router list on the host:

show ipv6 routers

Our rogue was still there, a fresh advertisement with its 2001:db8:bad::/64 prefix marked for autoconfig:

Router FE80::C803:12FF:FEFC:8 on GigabitEthernet0/0, last update 0 min
  Hops 64, Lifetime 1800 sec, AddrFlag=0, OtherFlag=0, MTU=1500
  HomeAgentFlag=0, Preference=Medium
  Reachable time 0 (unspecified), Retransmit time 0 (unspecified)
  Prefix 2001:DB8:BAD::/64 onlink autoconfig
    Valid lifetime 2592000, preferred lifetime 604800

Every counter for Gi0/2 under show ipv6 snooping counters interface GigabitEthernet0/2 stayed empty, received as well as dropped, so first hop security never even saw the advertisements. In our lab IOSvL2 parsed RA guard, stored it and displayed it, but did not inspect a single RA, so this lab can teach the configuration and not the enforcement. The lesson carries over to real gear: a policy listed as applied is not proof that rogue RAs are being dropped. Check from a host on the protected VLAN, with show ipv6 routers on a Cisco client or ip -6 route show default on Linux, and make sure only your real router appears.

Three policy settings decide what a port does with advertisements, and getting them wrong either lets rogues through or cuts off the real router:

  • device-role host, the default role: every RA and redirect arriving on the port is dropped. It belongs on access ports facing end devices.
  • device-role router: RAs from the port are allowed. It belongs on the port facing your real IPv6 router.
  • trusted-port: everything behind the port is trusted and nothing is verified. On a trunk to a switch that runs no RA guard of its own, that switch’s rogues pass straight through.

A production rollout needs a second policy. Cisco’s Catalyst 9300 IPv6 first hop security guide makes a router-role policy mandatory on router-facing ports whenever host-role policies sit on the access ports. Leave the uplink on the host policy, or attach the host policy to a whole port range that includes it, and your real router’s advertisements are dropped too, so new hosts end up with link-local addresses and no default route. Skip the router policy altogether and onboarding slows down instead, because the switch forwards router solicitations only toward ports that carry a router-role policy, and a new host has to wait for the router’s next periodic advertisement. On a Catalyst 9300, where the uplink to the router is Gi1/0/48:

ipv6 nd raguard policy ROUTERS
 device-role router
 exit
interface GigabitEthernet1/0/48
 ipv6 nd raguard attach-policy ROUTERS
 end

RA guard has the same blind spot as every feature on this page: it only filters what crosses the switch running it. A rogue RA sent between two PCs on an unmanaged desk switch never reaches the policy, which is one more reason access ports should face end devices and not other switches.

Practice DHCP snooping

Run the questions to lock in trusted versus untrusted ports, what the binding table holds, and the messages an untrusted port may carry, then use the flashcards for quick recall.

Free practice

CCNA practice: Domain 4: Network Services and Security

10 questions drawn fresh from 130 in the bank, with the answer and explanation after each one.

Start 10 questions

Flip through the deck until the trust rule, the binding table fields, and the option 82 gotcha are automatic, or grab the Anki pack to review them anywhere:

Loading flashcards...

When DHCP stops working after you enable snooping

Most DHCP snooping failures are self-inflicted. You enable it, every address lease across the switch stops, and the cause is a port that should be trusted but is not. The uplink toward the DHCP server, or any inter-switch trunk that carries DHCP toward it, has to be trusted, or the server’s replies are dropped exactly like a rogue’s would be. If DHCP dies the moment you turn snooping on, look for one missing ip dhcp snooping trust on the path to the server, plus the option 82 line on a flat segment.

Snooping is the foundation the rest of Layer 2 security builds on. Its binding table feeds dynamic ARP inspection and IP source guard, and it sits alongside port security and access control lists as the access-layer defenses every switched VLAN should carry. The CCNA 200-301 study roadmap shows where each of these features fits in the bigger picture.

Keep reading

Free CCNA Practice Test: 600+ Questions for 200-301 v2.0 Networking Free CCNA Practice Test: 600+ Questions for 200-301 v2.0 Install Samba on Debian 13 / 12 and Create a File Share Debian Install Samba on Debian 13 / 12 and Create a File Share Configure Samba File Sharing on Linux Mint 22 Networking Configure Samba File Sharing on Linux Mint 22 Agentic AI in Network Operations: Tested on Cisco IOS Networking Agentic AI in Network Operations: Tested on Cisco IOS Cisco Switch Port Configuration for Phones, APs and Servers Networking Cisco Switch Port Configuration for Phones, APs and Servers Install GNS3 on Ubuntu 26.04 / 24.04 (GUI, Server + Web UI) Networking Install GNS3 on Ubuntu 26.04 / 24.04 (GUI, Server + Web UI)

Leave a Comment

Press ESC to close