An almost unknown command (mostly because it is not frequently necessary), the arping utility performs an action similar to ping, but at the Ethernet layer. Where ping tests the reachability of an IP address, arping reports the reachability and round-trip time of an IP address hosted on the local network.
There are several modes of operation for this utility. Under normal operation, arping displays the Ethernet and IP address of the target as well as the time elapsed between the arp request and the arp reply.
Example B.4. Displaying reachability of an IP on the local Ethernet with arping
| 
 | 
Other options to the arping utility include the ability to send a broadcast arp using the -U option and the ability to send a gratuitous reply using the -A option. A kernel with support for non-local bind can be used with arping for the nefarious purpose of wreaking havoc on an otherwise properly configured Ethernet. By performing gratuitous arp and broadcasting incorrect arp information, arp tables in poorly designed IP stacks can become quite confused.
arping can detect if an IP address is currently in use on an Ethernet. Called duplicate address detection, this use of arping is increasingly common in networking scripts.
        For a practical example, let's assume a laptop named
        dietrich is normally
        connected to a home network with the same IP address as
        tristan of
        our main office network.  In the boot scripts,
        dietrich
        might make good use of
        arping by testing reachability of the IP it wants
        to use before bringing up the IP layer.
      
Example B.5. Duplicate Address Detection with arping
| 
 | 
        First, dietrich tests
        reachability of its preferred IP (192.168.99.35).  Because the IP
        address is in use by
        tristan, 
        dietrich receives a
        response.  Any response by a device on the Ethernet indicating that an
        IP address is in use will cause the arping command
        to exit with a non-zero exit code (specifically, exit code 1).
      
Note, that the Ethernet device must already be in an UP state (see Section B.3, “ip link”). If the Ethernet device has not been brought up, the arping utility will exit with a non-zero exit code (specifically, exit code 2).