19.4. Finding Duplicate IP Addresses with arping
Problem
You want to know how to test an IP address on your LAN to see whether it is a duplicate.
Solution
Use arping, like this:
$ arping -D 192.168.1.76
ARPING 192.168.1.76 from 0.0.0.0 eth0
Unicast reply from 192.168.1.76 [00:14:2A:54:67:D6] for 192.168.1.76 [00:14:2A:54:67:
D6] 0.605ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s)Received 1 response(s) means
that this address is already in use, and arping
even gives you the MAC address. You may also test with a
hostname:
$ arping -D uberpc
ARPING 192.168.1.76 from 0.0.0.0 eth0
Unicast reply from 192.168.1.76 [00:14:2A:54:67:D6] for 192.168.1.76 [00:14:2A:54:67:
D6] 0.590ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s)You should set a time limit or count limit, or arping will keep running when it gets no response. This example sets a time limit of 10 seconds:
$ arping -w10 -D 192.168.1.100
ARPING 192.168.1.100 from 0.0.0.0 eth0
Sent 11 probes (11 broadcast(s))
Received 0 response(s)Use -c5 instead of -w10 to tell arping to
run for five counts.
Discussion
Of course, you may use any value for -c and -w
that you like.
This is a good test to run when you have mobile users with static IP addresses on their laptops that come and go a lot, or to use before assigning a static address to a new host. If you're having intermittent connectivity problems with a particular host, run arping to see if it has a duplicate address.
arping is also useful to see if a host is up when ping fails. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access