Gratuitous ARP is an Address Resolution Protocol message that a host sends about its own IPv4 address without having been asked, either to announce its current MAC address or to test whether another device already uses that address. In networking, and especially in address configuration, it is the tool that keeps neighbor caches accurate when an address appears, moves or changes hardware.
The word gratuitous means that no host requested the information. An ordinary ARP request asks who owns a target address; a gratuitous ARP states or probes the sender’s own binding, typically as a broadcast to every device on the local segment, so all listeners can refresh or reject the mapping in a single step.
How a gratuitous ARP message is built
A gratuitous ARP uses the normal ARP packet format defined in RFC 826, but it fills the address fields in a distinctive way. The sender protocol address and target protocol address are identical, both set to the host’s own IPv4 address, and the Ethernet frame is usually sent to the broadcast address ff:ff:ff:ff:ff:ff.
Implementations send the message either as an ARP request (opcode 1) or as an ARP reply (opcode 2). Both forms are accepted by most operating systems, and RFC 5227 recommends the request form for announcements because some older stacks ignore unsolicited replies. The table compares the field values of the main variants.
| Field | Announcement | ARP probe |
|---|---|---|
| Opcode | 1 (request) or 2 (reply) | 1 (request) |
| Sender MAC address | Host MAC address | Host MAC address |
| Sender IP address | Host IPv4 address | 0.0.0.0 |
| Target MAC address | Zero or broadcast | Zero |
| Target IP address | Host IPv4 address | Address being tested |
Strictly speaking, the ARP probe with a zero sender address is not always called gratuitous, because it does not claim the address yet. In practice, vendors and administrators group both messages under the same name, since they share the same purpose of managing ownership of a single address.
Purposes of gratuitous ARP in address configuration
Gratuitous ARP serves four distinct purposes, and each one appears at a different moment in the life of an address. The table summarizes when each use occurs and what result it produces on the segment.
| Use | When it is sent | Result |
|---|---|---|
| Duplicate address detection | Before an address is put into use | Host learns whether the address is taken |
| Address announcement | After an interface comes up | Neighbors and switches learn the binding |
| Cache update after failover | When an address moves to new hardware | Traffic shifts to the new MAC address |
| Switch table refresh | After a link or virtual machine moves | Switches relearn the port for the MAC |
IPv4 address conflict detection, standardized in RFC 5227, uses the probe sequence: a host sends three ARP probes spaced one to two seconds apart and listens for any answer. If no reply or competing probe arrives, it sends two announcements about two seconds apart and starts using the address. Windows, macOS and many Linux distributions perform this check after DHCP assigns a lease, and a detected conflict leads to a DHCPDECLINE message to the server.
Failover and high availability
The most important operational role of gratuitous ARP is moving a shared IP address between devices without waiting for caches to expire. ARP cache entries often live for minutes, and a client with a stale entry would keep sending frames to a failed node. A gratuitous announcement from the new owner rewrites every cache on the segment almost immediately.
First-hop redundancy and clustering protocols rely on this behavior. VRRP uses a virtual MAC address, so the new master sends gratuitous ARP mainly to update switch forwarding tables, while cluster software that moves a service address between servers with different physical MAC addresses depends on the message to redirect clients. Hypervisors also send gratuitous ARP or reverse ARP frames after live migration so the physical switches learn the new port of a virtual machine.
The choice of mechanism depends on whether the MAC address moves along with the IP address, as the table shows.
| Scenario | Does the MAC address change | Role of gratuitous ARP |
|---|---|---|
| VRRP or HSRP gateway failover | No, virtual MAC is shared | Refreshes switch MAC tables |
| Server cluster IP takeover | Yes, new physical MAC | Updates host and router ARP caches |
| Virtual machine live migration | No, but switch port changes | Teaches switches the new location |
| Network interface card replacement | Yes | Replaces stale cache entries |
Gratuitous ARP compared with related mechanisms
Gratuitous ARP belongs to IPv4 only. In IPv6, the Neighbor Discovery Protocol provides equivalent functions with different messages: duplicate address detection uses neighbor solicitations from the unspecified address, and unsolicited neighbor advertisements play the role of gratuitous announcements. APIPA and other link-local configuration schemes reuse the same RFC 5227 probe logic to claim an address in the 169.254.0.0/16 range.
Ordinary ARP, by contrast, is demand-driven resolution: a host asks only when it needs to send to an address whose MAC it does not know. Gratuitous ARP is supply-driven, pushing information before anyone asks.
Security risks and operational pitfalls
Because ARP has no authentication, any host on the segment can send a gratuitous ARP claiming someone else’s address. This is the basis of ARP spoofing and ARP cache poisoning, which attackers use to place themselves between a victim and the default gateway. Enterprise switches counter it with Dynamic ARP Inspection, which checks ARP packets against the DHCP snooping binding table and drops bindings that do not match.
- Some hosts ignore unsolicited ARP for security reasons; on Linux, the
arp_acceptsetting controls whether new entries are created from gratuitous messages. - Rate limits can drop failover announcements, so redundancy designs often send several gratuitous ARPs in sequence.
- Firewalls and routers may cache entries longer than expected, delaying failover when announcements are filtered.
- A detected conflict is only reported, not resolved; an administrator or DHCP server still has to correct the duplicate assignment.
The simple explanation
Every device on a local network keeps a small address book that links network addresses to physical network cards. Gratuitous ARP is a device calling out its own entry to everyone without being asked: this address is mine, and here is where to reach me.
It is like a coworker moving to a new desk and announcing the change to the whole office, so nobody keeps leaving notes at the old desk. A device can also ask the room first whether anyone already uses an address. In short, gratuitous ARP keeps everyone’s address book correct and helps avoid two devices claiming the same address.
How it is used in practice
A hospital runs its patient records database on a two-node cluster, with clients connecting to a shared service address of 10.20.5.50. One night the active server suffers a power supply failure. The cluster software on the standby node detects the missing heartbeat within about five seconds, brings up 10.20.5.50 on its own network card and sends three gratuitous ARP announcements one second apart.
The core switch, the application servers and the nursing workstations update their ARP caches as soon as the announcements arrive, replacing the failed node’s MAC address with the standby node’s. Clients reconnect within seconds instead of waiting several minutes for stale cache entries to expire. The outcome is a failover measured in seconds, not minutes, with no change to any client configuration.