How can I determine if there are two machines on the subnet with the same IP?

1

1

Is there a command in Ubuntu or OSX which will tell me if there are two machines on the subnet with the same IP address? So I can fix the problem.

Perhaps, there is a tool that generates a table of IP addresses/machine names on the subnet?

ANSWER

I found a good solution through this link:

When I tried:

sudo arp-scan -I eth0 -l

I found that an internet printer had the same IP as my new machine.

On Ubuntu, you can install using this command:

sudo apt-get install arp-scan

In my particular case, I was getting flaky ssh behavior - sometimes, I would get connection refused. Other times, I would connect fine, but the connection would get dropped after some random period of time. Given that two devices had the same static IP on the subnet, this behavior actually made sense.

kfmfe04

Posted 2013-04-24T10:51:07.317

Reputation: 645

Did you know that you can actually answer your own question on superuser.com? Might be worth posting your "edit" as answer, since that seems a really neat tool. – Stefan Seidel – 2013-04-24T19:29:55.173

Answers

3

You can list the currently known machines in the ARP cache by running

arp -n | sort -n

This will print the IP address and the MAC address of the machines. You'll also know the MAC addresses of the machines in question, so you can identify them. You can check for duplicates by hand or use this handy line:

arp -n | sort -n | uniq -cw15

and watch out for lines not having a 1 in the first column.

It's probably helpful to run a ping -bc3 192.168.1.255 (or whatever your broadcast address of your network is) beforehand so that more machines will be known to your machine.

Stefan Seidel

Posted 2013-04-24T10:51:07.317

Reputation: 8 812

2

Assuming this is a home network you could download and use nmap. It will scan the network and create a report for all the machines on the network. If this a work network you need to get permission from IT before running a scanning tool.

Brad Patton

Posted 2013-04-24T10:51:07.317

Reputation: 9 939