DHCP snooping
| Port | Server messages (OFFER, ACK, NAK) | Client messages |
|---|---|---|
| Trusted | Accepted | Forwarded |
| Untrusted | Dropped | Checked and recorded in the table |
The binding table (show ip dhcp snooping binding) keeps the MAC, IP, lease, VLAN and port of each lease. DAI and IP Source Guard use it. So it is not lost on reboot, it can be saved to a file with ip dhcp snooping database.
Dynamic ARP Inspection (DAI)
| Check | What it verifies |
|---|---|
| Binding table | That the sender's IP–MAC pair exists on that port and VLAN |
| ARP ACL | Devices with static IPs (no DHCP entry) |
| validate src-mac | That the sender MAC matches the Ethernet source MAC |
| validate dst-mac | The same with the destination, in replies |
| validate ip | That there are no invalid IPs (0.0.0.0, broadcast, multicast) |
Trusted ports (ip arp inspection trust) are not checked: they are used toward routers and other switches.
How it works: from the lease to ARP inspection
Six steps: the DISCOVER, two OFFERs (one fake), the lease, a valid ARP, a fake ARP and an ARP flood.
Ana asks for an address
Ana plugs her laptop into Gi1/0/1 and sends a DISCOVER to 255.255.255.255. For SW1 it is a client message entering through an untrusted port: it checks it and forwards it like any broadcast, to every port in VLAN 10. R1, the legitimate server, receives it, but so does the home router someone plugged into Gi1/0/8, with its own DHCP server on, and the device on Gi1/0/9.
Two OFFERs: only R1's gets through
The home router immediately answers with its own OFFER: 192.168.0.100, with itself as gateway and DNS. If Ana accepted it, all her traffic would go through that device (or nowhere). With DHCP snooping, an OFFER or ACK that enters through an untrusted port is dropped: it is a server message where there cannot be a server, and SW1 logs it with %DHCP_SNOOPING-5-DHCP_SNOOPING_UNTRUSTED_PORT. R1's OFFER enters through Gi1/0/24, the only trusted port, and reaches Ana: 192.168.10.12.
Ana accepts and SW1 records the binding
Ana requests 192.168.10.12 and R1 confirms it with the ACK. When it sees the ACK, SW1 creates an entry in the DHCP snooping binding table: MAC 00:00:5E:00:53:10, IP 192.168.10.12, 86400 s, VLAN 10 and port Gi1/0/1. DAI and IP Source Guard use that table. Watch out for option 82: DHCP snooping adds it to client messages by default, and the IOS DHCP server drops those messages if they do not come through a relay. That is why no ip dhcp snooping information option is configured.
DAI lets Ana's ARP through
Ana needs her gateway's MAC and sends an ARP: who has 192.168.10.1? Since Gi1/0/1 is untrusted, DAI checks the sender pair (Sender MAC 00:00:5e:00:53:10, Sender IP 192.168.10.12) against the binding table: it matches, and the ARP goes through. R1's reply enters through Gi1/0/24, which is trusted for DAI (ip arp inspection trust), and is not checked. Devices with static IPs have no entry in the table: an ARP ACL is used for them.
An attacker claims to be the gateway
From Gi1/0/9, an attacker sends Ana a fake ARP reply: 192.168.10.1 is at 00:00:5e:00:53:66, its own MAC. This is ARP poisoning: if Ana believed it, she would send him everything going outside the network (a man-in-the-middle attack). DAI looks for the pair 192.168.10.1 / 00:00:5e:00:53:66 in the Gi1/0/9 bindings, does not find it and drops the ARP: %SW_DAI-4-DHCP_SNOOPING_DENY, with the frame details. Ana's ARP cache still points to R1.
An ARP flood shuts the port down
The attacker sweeps the network with ARPs (who has .2, .3, .4…?). Every ARP entering through an untrusted port goes to the switch CPU to be checked, so a flood could overload it. That is why DAI limits untrusted ports to 15 ARPs per second by default: the 16th ARP within the same second puts Gi1/0/9 in err-disabled (%SW_DAI-4-PACKET_RATE_EXCEEDED). The limit is changed with ip arp inspection limit rate; to recover the port, shutdown and no shutdown, or errdisable recovery cause arp-inspection.
The commands for topics 4.7.a and 4.7.b
| Command | What for |
|---|---|
ip dhcp snooping and ip dhcp snooping vlan 10 | Turns on DHCP snooping on VLAN 10 |
ip dhcp snooping trust | Trusted port (toward the server or relay) |
no ip dhcp snooping information option | Does not add option 82 (IOS server without a relay) |
ip dhcp snooping limit rate 10 | Limit of DHCP messages per second on a port |
ip arp inspection vlan 10 | Turns on DAI on VLAN 10 |
ip arp inspection trust | Trusted port for DAI |
ip arp inspection limit rate 15 | ARP limit per second (15 by default) |
To verify: show ip dhcp snooping, show ip dhcp snooping binding, show ip arp inspection vlan 10 and show ip arp inspection statistics.
The other defenses in topic 4.7
| Defense | Against what |
|---|---|
| Port security (4.7.e) | Too many MACs, or unknown MACs, on a port |
| Storm control (4.7.c) | Broadcast, multicast or unknown unicast storms |
| RA guard (4.7.d) | Fake IPv6 Router Advertisements |
| IP Source Guard | IP traffic with a source address that is not the binding's |
DHCP snooping is the foundation for several of them: its binding table says which address belongs to each port.
Frequently asked questions
Which ports should be trusted?
The ones leading to the DHCP server or relay: the link toward the router or the distribution switch. User ports, never.
Why disable option 82?
DHCP snooping adds option 82 (relay information) to client messages, with giaddr 0. An IOS DHCP server drops those messages unless ip dhcp relay information trusted is configured. If the server is in the same VLAN and there is no relay, the simplest fix is no ip dhcp snooping information option.
What about devices with static IPs, like a printer?
They have no entry in the binding table, so DAI would drop their ARPs. They are allowed with an ARP ACL (arp access-list) applied with ip arp inspection filter.
Does DAI check replies or requests too?
Both: every ARP that enters through an untrusted port, whether a request or a reply.
What happens if the switch reboots?
The binding table is lost and DAI would start dropping ARPs from devices that already had an address. That is why it is saved with ip dhcp snooping database (for example, to flash).
What you take away
- DHCP snooping separates trusted ports (toward the server) from untrusted ones (all the others).
- An OFFER or ACK entering through an untrusted port is dropped: that is how fake DHCP servers are stopped.
- Each lease is recorded in the binding table: MAC, IP, VLAN and port.
- DAI checks every ARP from an untrusted port against that table and drops the fake ones.
- DAI limits ARPs to 15 per second on untrusted ports; if exceeded, the port goes err-disabled.
- With an IOS DHCP server and no relay, disable option 82.
NEXT STEP
From this lesson to the CCNA 2.0 Course
Layer 2 security (topic 4.7) is part of The House of Routing's CCNA 2.0 Course, with the Canadá Logística lab. We will let you know when it opens.
Upcoming protocol lessons
Sources
- Cisco · IOS XE 17 configuration guides (Catalyst 9300 Security: DHCP snooping and Dynamic ARP Inspection)
- IETF · RFC 2131 · Dynamic Host Configuration Protocol
- IETF · RFC 3046 · DHCP Relay Agent Information Option (option 82)
- IETF · RFC 826 · An Ethernet Address Resolution Protocol
- Cisco · 200-301 CCNA v2.0 Exam Topics (4.7.a, 4.7.b)
Lesson prepared with AI assistance and checked against the sources cited. The bytes of every packet are generated according to the standard and verified with an independent tool.