arping: send ARP REQUEST to a neighbour host.
arping comamnd pings the destination on device interface by ARP packets, using source address. This command is similar to the ping command, except that the "arping" command performs the action at the Ethernet layer. Another difference between "ping" and "arping" is that, the ping command tests the reachability of an IP address, whereas "arping" reports the reachability and round-trip time of an IP address hosted on the local network. The "arping" command could be used to display the reachability of an IP on the local Ethernet.
|-A||The same as -U, but ARP REPLY packets used instead of ARP REQUEST.|
|-b||Send only MAC level broadcasts. Normally arping starts from sending broadcast, and switch to unicast after reply received.|
|-c count||Stop after sending count ARP REQUEST packets. With deadline option, arping waits for count ARP REPLY packets, until the timeout expires.|
|-D||Duplicate address detection mode (DAD). See RFC2131, 4.4.1. Returns 0, if DAD succeeded i.e. no replies are received.|
|-f||Finish after the first reply confirming that target is alive.|
|-I Interface||Name of network device where to send ARP REQUEST packets..|
|-h||Print help page and exit.|
|-q||Quiet output. Nothing is displayed.|
|-s source||IP source address to use in ARP packets. If this option is absent, source address is:
In DAD mode (with option -D) set to 0.0.0.0.
In Unsolicited ARP mode (with options -U or -A) set to destination.
Otherwise, it is calculated from routing tables.
|-U||Unsolicited ARP mode to update neighbours' ARP caches. No replies are expected.|
|-V||Print version of the program and exit.|
|-w deadline||Specify a timeout, in seconds, before arping exits regardless of how many packets have been sent or received. In this case arping does not stop after count packet are sent, it waits either for deadline expire or until count probes are answered.|
* To display reachability of an IP on the local Ethernet with arping:
# arping -I eth0 -c 2 192.168.0.4
ARPING 192.168.0.4 from 192.168.0.254 eth0 Unicast reply from 192.168.0.4 [00:80:C8:E8:4B:8E] 8.419ms Unicast reply from 192.168.0.4 [00:80:C8:E8:4B:8E] 2.095ms Sent 2 probes (1 broadcast(s)) Received 2 response(s)
To detect Duplicate Address with arping
Syntax- sudo arping -D -I <interface-name> -c 2 <IP-ADDRESS-TO-TEST>
#arping -D -q -I eth0 -c 2 192.168.0.4
If 192.168.1.4 duplicated you should see zero exit status.
(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.)