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.

This article was posted by Matty on 2011-03-26 08:44:00 -0400 EDT