Understanding and Using Dynamic ARP Inspection (DAI)
Dynamic ARP inspection (DAI) protects switching devices against Address Resolution Protocol (ARP) packet spoofing (also known as ARP poisoning or ARP cache poisoning).
DAI inspects ARPs on the LAN and uses the information in the DHCP snooping database on the switch to validate ARP packets and to protect against ARP spoofing. ARP requests and replies are compared against entries in the DHCP snooping database, and filtering decisions are made based on the results of those comparisons. When an attacker tries to use a forged ARP packet to spoof an address, the switch compares the address with entries in the database. If the media access control (MAC) address or IP address in the ARP packet does not match a valid entry in the DHCP snooping database, the packet is dropped
Understanding ARP Spoofing and Inspection
ARP packets are sent to the Routing Engine and are rate-limited to protect the switching device from CPU overload.
Address Resolution Protocol
Sending IP packets on a multi-access network requires mapping an IP address to an Ethernet MAC address.
Ethernet LANs use ARP to map MAC addresses to IP addresses.
The switching device maintains this mapping in a cache that it consults when forwarding packets to network devices. If the ARP cache does not contain an entry for the destination device, the host (the DHCP client) broadcasts an ARP request for that device's address and stores the response in the cache.
ARP Spoofing
ARP spoofing is one way to initiate man-in-the-middle attacks. The attacker sends an ARP packet that spoofs the MAC address of another device on the LAN. Instead of the switching device sending traffic to the proper network device, it sends the traffic to the device with the spoofed address that is impersonating the proper device. If the impersonating device is the attacker's machine, the attacker receives all the traffic from the switch that must have gone to another device. The result is that traffic from the switching device is misdirected and cannot reach its proper destination.
One type of ARP spoofing is gratuitous ARP, which is when a network device sends an ARP request to resolve its own IP address. In normal LAN operation, gratuitous ARP messages indicate that two devices have the same MAC address. They are also broadcast when a network interface card (NIC) in a device is changed and the device is rebooted, so that other devices on the LAN update their ARP caches. In malicious situations, an attacker can poison the ARP cache of a network device by sending an ARP response to the device that directs all packets destined for a certain IP address to go to a different MAC address instead.
To prevent MAC spoofing through gratuitous ARP and through other types of spoofing, the switches examine ARP responses through DAI.
Dynamic ARP Inspection
DAI examines ARP requests and responses on the LAN and validates ARP packets. The switch intercepts ARP packets from an access port and validates them against the DHCP snooping database. If no IP-MAC entry in the database corresponds to the information in the ARP packet, DAI drops the ARP packet and the local ARP cache is not updated with the information in that packet. DAI also drops ARP packets when the IP address in the packet is invalid. ARP probe packets are not subjected to dynamic ARP inspection. The switch always forwards such packets.
Junos OS for EX Series switches and the QFX Series uses DAI for ARP packets received on access ports because these ports are untrusted by default. Trunk ports are trusted by default, and therefore ARP packets bypass DAI on them.
You configure DAI for each VLAN, not for each interface (port). By default, DAI is disabled for all VLANs.
If you set an interface to be a DHCP trusted port, it is also trusted for ARP packets.
If your switching device is an EX Series switch and uses Junos OS with support for the Enhanced Layer 2 Software (ELS) configuration style, see Enabling a Trusted DHCP Server (ELS) for information about configuring an access interface to be a DHCP trusted port.
For packets directed to the switching device to which a network device is connected, ARP queries are broadcast on the VLAN. The ARP responses to those queries are subjected to the DAI check.
For DAI, all ARP packets are trapped to the Packet Forwarding Engine. To prevent CPU overloading, ARP packets destined for the Routing Engine are rate-limited.
If the DHCP server goes down and the lease time for an IP-MAC entry for a previously valid ARP packet runs out, that packet is blocked.
Prioritizing Inspected Packets
Prioritizing inspected packets is not supported on the QFX Series and the EX4600 switch.
You can use class-of-service (CoS) forwarding classes and queues to prioritize DAI packets for a specified VLAN. This type of configuration places inspected packets for that VLAN in the egress queue, that you specify, ensuring that the security procedure does not interfere with the transmission of high-priority traffic.
Enabling Dynamic ARP Inspection (ELS)
This task uses Junos OS for EX Series switches with support for the Enhanced Layer 2 Software (ELS) configuration style. If your switch runs software that does not support ELS, see Enabling Dynamic ARP Inspection (non-ELS).
Dynamic ARP inspection (DAI) protects switches against ARP spoofing. DAI inspects ARP packets on the LAN and uses the information in the DHCP snooping database on the switch to validate ARP packets and to protect against ARP cache poisoning.
Before you can enable DAI on a VLAN, you must configure the VLAN. See Configuring VLANs for EX Series Switches with ELS Support (CLI Procedure).
To enable DAI on a VLAN by using the CLI:
[edit vlans vlan-name forwarding-options dhcp-security] user@switch# set arp-inspection
See Also
Enabling Dynamic ARP Inspection (non-ELS)
This task uses Junos OS for EX Series switches that do not support the Enhanced Layer 2 Software (ELS) configuration style. If your switch runs software that does support ELS, see Enabling Dynamic ARP Inspection (ELS). For ELS details, see Using the Enhanced Layer 2 Software CLI.
Dynamic ARP inspection (DAI) protects switches against ARP spoofing. DAI inspects ARP packets on the LAN and uses the information in the DHCP snooping database on the switch to validate ARP packets and to protect against ARP cache poisoning.
Enabling DAI on a VLAN
You configure DAI for each VLAN, not for each interface (port). By default, DAI is disabled for all VLANs.
To enable DAI on a VLAN or all VLANs:
On a single VLAN:
[edit ethernet-switching-options secure-access-port] user@switch# set vlan vlan-name arp-inspection
On all VLANs:
[edit ethernet-switching-options secure-access-port] user@switch# set vlan all arp-inspection
Enabling DAI on a bridge domain
See Configuring a Bridge Domain to set up a bridge domain if necessary.
To enable DAI on a bridge domain:
[edit bridge-domains bridge-domain-name forwarding-options dhcp-security] user@device# set arp-inspection
Applying CoS Forwarding Classes to Prioritize Inspected Packets
You might need to use class of service (CoS) to protect packets from critical applications from being dropped during periods of network congestion and delay and you might also need the port security features of DHCP snooping on the same ports through which those critical packets are entering and leaving.
To apply CoS forwarding classes and queues to DAI packets:
Verifying That DAI Is Working Correctly
Purpose
Verify that dynamic ARP inspection (DAI) is working on the switch.
Action
Send some ARP requests from network devices connected to the switch.
Display the DAI information:
user@switch> show arp inspection statistics ARP inspection statistics: Interface Packets received ARP inspection pass ARP inspection failed --------------- --------------- -------------------- --------------------- ge-0/0/1.0 7 5 2 ge-0/0/2.0 10 10 0 ge-0/0/3.0 12 12 0
Meaning
The sample output shows the number of ARP packets received and inspected per interface, with a listing of how many packets passed and how many failed the inspection on each interface. The switch compares the ARP requests and replies against the entries in the DHCP snooping database. If a MAC address or IP address in the ARP packet does not match a valid entry in the database, the packet is dropped.