What is Gratuitous ARP
Gratuitous ARP is a special ARP (Address Resolution Protocol) reply that is not a response to an ARP request. A Gratuitous ARP reply is a reply to without a ARP request. No reply is expected for a Gratuitous ARP . A Gratuitous ARP packet has the following characteristics.
- The source and destination IP Addresses are both set to the IP of the machine sending the Gratuitous ARP packet.
- Destination MAC address is the broadcast MAC address ff:ff:ff:ff:ff:ff.
Gratuitous ARP packets are generated by network devices for some of the reasons listed below.
- To detect duplicate IPv4 addresses. When a reply to a gratuitous ARP request is received, computers can detect IPv4 address conflict in the network.
- To update ARP table after a IPv4 address or MAC address change.
For example, let us consider below topology.
Let us assume that for some technical requirement, the IPv4 address of the top left side computer is changed to 172.16.10.150/16 from 172.16.10.155/16.
The change in IPv4 address must be informed to all other devices in the Local Area Network (LAN), because there may be MAC address to incorrect previous IPv4 address mappings inside the ARP table of other network devices. Gratuitous ARP is mainly used by a TCP/IP device to inform other devices in the Local Area Network (LAN), any change in its MAC address or IPv4 address.
Since the destination MAC address is the broadcast MAC address, the switch will flood the Gratuitous ARP packet to all its connected ports.
Following Wireshark capture screenshot shows a Gratuitous ARP packet.