Using the Linux arping utility to send out gratuitious ARPs

I managed a number of Redhat and Heartbeat clusters. On a couple of occassions the services that manage the virtual IPs have misbehaved, and the storage has ended up on one node and the virtual IP on another. To fix this I need to manually move the virtual IP to the host it belongs on, and then issue a gratuitous ARP so other hosts on the network clear their ARP cache and use the MAC address associated with the device the virtual IP now resides on.

The Linux arping utility can be used to send out a gratuitious ARP (an “ARP Request” or “ARP Response” is the actual item sent) to update hosts on your network . To use arping to update the ARP cache on all of the devices on the local layer-3 network, you can run arping with the -U option (unsolicited ARP mode), the “-I” option (interface to send the gratuitious ARP out on) and the IP that is assigned to the interface you want the ARP cache entry updated for:

$ arping -U -I eth0 186.168.86.100

Once executed, the arping command will cause a layer-2 broadcast message to be sent, which should cause the ARP caches to be updated on all of the hosts on the local network (ARP replies are sent to the layer-2 broadcast address, so all hosts on your network should receive these). This assumes that your hosts aren’t configured to ignore unsolicited ARP requests. ;) Arping can also be used to detect duplicate IPs when run with the “-D” (duplicate address detection mode) option. This is a handy tool that everyone should be aware of.

4 thoughts on “Using the Linux arping utility to send out gratuitious ARPs”

  1. for things like this the pacemaker/crm cluster ressource manager is also quite handy!

    and for just moving ip’s with services the config is tiny and non-intrusive.

    a BIG plus is that the ocf ressource agents (those scripts that acutally start the daemons) are MUCH more trustworthy than any init-script (at least on debian)

  2. If the arping command does not work as expected (unknown parameters), make sure you have installed arping from the iputils package.

    Debian calls this arping-iputils

Leave a Reply

Your email address will not be published. Required fields are marked *