Securing Cisco Access Switches with DHCP Snooping and Dynamic ARP Inspection (DAI)

In enterprise campus and data center Layer-2 domains, rogue DHCP servers and ARP spoofing / poisoning attacks remain two of the most disruptive internal threats. A rogue DHCP server hijacks client gateway assignment, while forged ARP frames enable man-in-the-middle interception and widespread outage.

In this hands-on guide, we eliminate both attack vectors at the access layer using Cisco DHCP Snooping and Dynamic ARP Inspection (DAI) in a spine-leaf lab topology.

How DHCP Snooping & Dynamic ARP Inspection (DAI) Work Together

Cisco’s documentation summarizes the tight dependency between these two access-layer controls:

  • Dynamic ARP inspection depends on the entries in the DHCP snooping binding database to verify IP-to-MAC address bindings in incoming ARP requests and ARP responses. Make sure to enable DHCP snooping to permit ARP packets that have dynamically assigned IP addresses.
  • DHCP snooping is a security feature that acts like a firewall between untrusted hosts and trusted DHCP servers.

In practice, DHCP Snooping inspects DHCP handshakes on untrusted access ports—blocking unauthorized DHCP OFFER/ACK replies while building a MAC ↔ IP ↔ VLAN ↔ Port binding table. DAI then validates every incoming ARP request and reply against that binding table.

Consequently, enabling dynamic ARP inspection requires DHCP snooping to be active first. Both features only need to be enabled on access-layer (leaf) switches; spine and core switches do not need them.

Lab Topology & IP Addressing Plan

Spine-leaf Cisco access security topology showing ISP_Customer (100.70.0.2), Switch-RE core gateway (VLAN 100: 10.100.0.254/24), MikroTik DHCP-Server, access switches A and B, and Client1-Client4 (10.100.0.1-4/24)
Figure 1: Spine-leaf lab topology with Switch-RE DHCP relay and Cisco access switches A & B (VLAN 100).

In this classic spine-leaf design, Switch-RE acts as the core L3 gateway and DHCP relay, DHCP-Server (MikroTik RouterOS) connects off-path to assign addresses, and Switch A / Switch B serve as access switches:

  • VLAN ID: 100 (Gateway: 10.100.0.254/24)
  • Client 1: 10.100.0.1/24 (MAC: 50:01:00:04:00:00)
  • Client 2: 10.100.0.2/24 (MAC: 50:01:00:05:00:00)
  • Client 3: 10.100.0.3/24 (MAC: 50:01:00:06:00:00)
  • Client 4: 10.100.0.4/24 (MAC: 50:01:00:07:00:00)
  • ISP_Customer (test target isp): 100.70.0.2

Deployment Caveats & Pre-Configured DHCP Server

  1. Control-Plane Overhead: Enabling DAI causes the switch CPU to inspect incoming ARP packets on untrusted ports.
  2. Binding Database Persistence: Always configure ip dhcp snooping database (local flash or TFTP) so bindings survive unexpected switch reloads—otherwise active DHCP clients lose connectivity until lease renewal.

Equivalent configurations exist on Huawei and Juniper switches (omitted here due to virtual lab image limitations). Below is the pre-configured MikroTik DHCP server lease table:

[admin@MikroTik] > ip dhcp-server export
# mar/14/2021 13:45:34 by RouterOS 6.45.9
# software id =
#
#
#
/ip dhcp-server
add disabled=no interface=ether1 name=dhcp1 relay=10.100.0.254
/ip dhcp-server lease
add address=10.100.0.1 mac-address=50:01:00:04:00:00
add address=10.100.0.2 mac-address=50:01:00:05:00:00
add address=10.100.0.3 mac-address=50:01:00:06:00:00
add address=10.100.0.4 mac-address=50:01:00:07:00:00
/ip dhcp-server network
add address=10.100.0.0/24 dns-server=8.8.8.8 gateway=10.100.0.254

Configuring DHCP Snooping & DAI on Access Switch B

Enable DHCP Snooping and DAI for VLAN 100 on Switch B, configure flash persistence and errdisable recovery, and trust uplink port Gi0/0:

B(config)#ip dhcp snooping // Enable DHCP Snooping globally
B(config)#ip dhcp snooping vlan 100 // Enable DHCP Snooping on VLAN 100 (populates binding DB for DAI)
B(config)#no ip dhcp snooping information option // Disable Option 82 insertion (avoids relay/giaddr=0.0.0.0 drops)
B(config)#ip dhcp snooping database write-delay 60 // Persist binding DB to flash/TFTP 60s after updates
B(config)#ip dhcp snooping database flash:dhcp_snooping.db // Local flash binding database path
*Mar 14 12:51:53.901: %DHCP_SNOOPING-6-AGENT_OPERATION_SUCCEEDED: DHCP snooping database Write succeeded.
B(config)#ip dhcp snooping database timeout 60 // Retry timeout if DB write fails
B(config)#errdisable recovery cause dhcp-rate-limit // Auto-recover ports err-disabled by DHCP rate limiting
B(config)#errdisable recovery interval 30 // Wait 30 seconds before re-enabling err-disabled port
B(config)# ip arp inspection vlan 100 // Enable Dynamic ARP Inspection (DAI) on VLAN 100
B(config)#int g0/0
B(config-if)#ip dhcp snooping trust // Mark uplink Gi0/0 trusted for DHCP server replies
B(config-if)#ip arp inspection trust // Mark uplink Gi0/0 trusted for ARP traffic
B(config-if)#end
B#wr
*Mar 14 12:55:08.490: %GRUB-5-CONFIG_WRITING: GRUB configuration is being updated on disk. Please wait...
*Mar 14 12:55:09.226: %GRUB-5-CONFIG_WRITTEN: GRUB configuration was written to disk successfully.

Why Uplink Gi0/0 Must Be Marked Trusted

DHCP OFFER return path diagram showing packets flowing from DHCP-Server through Switch-RE into Switch B trusted uplink Gi0/0, populating flash:dhcp_snooping.db, while untrusted Gi0/2 blocks static IP and spoofed MAC ARP attacks
Figure 2: DHCP OFFER return path, trusted uplink Gi0/0, and untrusted port DAI enforcement on Gi0/2.

Once DHCP Snooping and DAI are enabled, Cisco switches treat every port as untrusted by default. Marking Gi0/0 with both ip dhcp snooping trust and ip arp inspection trust allows legitimate relayed DHCP OFFER responses and upstream ARP traffic from Switch-RE to pass, while client-facing ports remain strictly inspected.

Inspecting the Binding Table & Initial DAI Counters

B# show ip dhcp snooping binding
MacAddress          IpAddress        Lease(sec)  Type           VLAN  Interface
------------------  ---------------  ----------  -------------  ----  --------------------
50:01:00:04:00:00   10.100.0.1       579         dhcp-snooping   100   GigabitEthernet0/2
Total number of bindings: 1

B# show ip arp inspection statistics

 Vlan      Forwarded        Dropped     DHCP Drops      ACL Drops
 ----      ---------        -------     ----------      ---------
  100              6              0              0              0

 Vlan   DHCP Permits    ACL Permits  Probe Permits   Source MAC Failures
 ----   ------------    -----------  -------------   -------------------
  100              3              0              0                     0

 Vlan   Dest MAC Failures   IP Validation Failures   Invalid Protocol Data
 ----   -----------------   ----------------------   ---------------------
  100                   0                        0                       0

Client1 (50:01:00:04:00:00 ↔ 10.100.0.1) is bound on GigabitEthernet0/2 and DAI counters confirm clean operation.

Live Attack Simulation & Mitigation Verification

Attack Test 1: Unauthorized Static IP Address

Manually assign an unallocated static address (10.100.0.100/24) on Client1 and attempt to ping isp (100.70.0.2):

root@localhost:~# ip addr add 10.100.0.100/24 dev ens3
root@localhost:~# ip ro add default via 10.100.0.254
root@localhost:~# ping isp
PING isp (100.70.0.2) 56(84) bytes of data.
From 10.100.0.100 icmp_seq=1 Destination Host Unreachable
From 10.100.0.100 icmp_seq=2 Destination Host Unreachable
From 10.100.0.100 icmp_seq=3 Destination Host Unreachable

--- isp ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 29ms

Inspect the console syslog and DAI drop counters on Switch B:

*Mar 14 13:41:13.577: %SW_DAI-4-DHCP_SNOOPING_DENY: 1 Invalid ARPs (Req) on Gi0/2, vlan 100.([5001.0004.0000/10.100.0.100/0000.0000.0000/10.100.0.254/13:41:13 UTC Sun Mar 14 2021])
*Mar 14 13:41:14.579: %SW_DAI-4-DHCP_SNOOPING_DENY: 1 Invalid ARPs (Req) on Gi0/2, vlan 100.([5001.0004.0000/10.100.0.100/0000.0000.0000/10.100.0.254/13:41:14 UTC Sun Mar 14 2021])
*Mar 14 13:41:15.601: %SW_DAI-4-DHCP_SNOOPING_DENY: 1 Invalid ARPs (Req) on Gi0/2, vlan 100.([5001.0004.0000/10.100.0.100/0000.0000.0000/10.100.0.254/13:41:15 UTC Sun Mar 14 2021])
B#show ip arp inspection stati

 Vlan      Forwarded        Dropped     DHCP Drops      ACL Drops
 ----      ---------        -------     ----------      ---------
  100             68             33             33              0

 Vlan   DHCP Permits    ACL Permits  Probe Permits   Source MAC Failures
 ----   ------------    -----------  -------------   -------------------
  100             34              0              0                     0

 Vlan   Dest MAC Failures   IP Validation Failures   Invalid Protocol Data
 ----   -----------------   ----------------------   ---------------------
  100                   0                        0                       0

The switch immediately logs %SW_DAI-4-DHCP_SNOOPING_DENY identifying port Gi0/2, MAC 5001.0004.0000, and unauthorized IP 10.100.0.100, dropping all 33 ARP requests.

Attack Test 2: Forged MAC Address (MAC Spoofing / ARP Poisoning)

Next, allow Client1 to acquire 10.100.0.1/24 legitimately via dhclient, spoof the interface MAC from 50:01:00:04:00:00 to 50:01:00:04:00:01, observe total traffic loss, and restore the original MAC:

root@localhost:~# dhclient -i ens3
root@localhost:~# ip a
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq state UP group def0
    link/ether 50:01:00:04:00:00 brd ff:ff:ff:ff:ff:ff
    inet 10.100.0.1/24 brd 10.100.0.255 scope global dynamic ens3
       valid_lft 599sec preferred_lft 599sec
    inet6 fe80::5201:ff:fe04:0/64 scope link
       valid_lft forever preferred_lft forever

root@localhost:~# ip link set dev ens3 address 50:01:00:04:00:01
root@localhost:~# ip a
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq state UP group def0
    link/ether 50:01:00:04:00:01 brd ff:ff:ff:ff:ff:ff
    inet 10.100.0.1/24 brd 10.100.0.255 scope global dynamic ens3
       valid_lft 535sec preferred_lft 535sec
    inet6 fe80::5201:ff:fe04:0/64 scope link
       valid_lft forever preferred_lft forever

root@localhost:~# ping isp
PING isp (100.70.0.2) 56(84) bytes of data.
From 10.100.0.1 icmp_seq=1 Destination Host Unreachable
From 10.100.0.1 icmp_seq=2 Destination Host Unreachable
From 10.100.0.1 icmp_seq=3 Destination Host Unreachable

--- isp ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 47ms

root@localhost:~# ip link set dev ens3 address 50:01:00:04:00:00
root@localhost:~# ping isp
PING isp (100.70.0.2) 56(84) bytes of data.
64 bytes from isp (100.70.0.2): icmp_seq=1 ttl=61 time=21.4 ms
--- isp ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 21.440/21.440/21.440/0.000 ms

Check the syslog alert captured on Switch B during the MAC spoof attempt:

*Mar 14 13:48:55.235: %SW_DAI-4-DHCP_SNOOPING_DENY: 1 Invalid ARPs (Req) on Gi0/2, vlan 100.([5001.0004.0001/10.100.0.1/0000.0000.0000/10.100.0.254/13:48:54 UTC Sun Mar 14 2021])
*Mar 14 13:48:56.262: %SW_DAI-4-DHCP_SNOOPING_DENY: 1 Invalid ARPs (Req) on Gi0/2, vlan 100.([5001.0004.0001/10.100.0.1/0000.0000.0000/10.100.0.254/13:48:55 UTC Sun Mar 14 2021])
B#

Any ARP frame whose source MAC–IP pair diverges from dhcp_snooping.db is dropped instantly and logged; restoring the authentic MAC restores connectivity immediately.

Summary & Official References

Deploying DHCP Snooping + DAI at the access edge shuts down rogue DHCP servers, unauthorized static IPs, and ARP spoofing in one cohesive architecture.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.