Dealing with Duplicate IP addresses

Duplicate IP's on a network is an interesting problem that has no completely satisfactory solution, especially when malicious intent is involved. Let's leave those intentional conditions for another day; here we'll look at what happens when an IP gets duped accidentally.

The "accident" can be from a human assignment of a static ip that was already in use. It can come from setting up two DHCP servers with overlapping ranges. It can come from a machine that legally obtained a DHCP address at some time in the past but has been shut off for sometime since then and that IP has been reused for some more active machine.

The cause can also be a smart switch or incorrect assigment of MAC addresses.

Whatever the reason, there is the very important question of how this affects other machines on the network. Ideally, a machine that starts up with an address already in use elsewhere should notice that and shut its network down. Unfortunately, not all network software is so friendly and polite.

However, being polite can be frustrating if the machine demurring to use an address is the machine that is supposed to have that ip. Maybe it's a server or printer that was down for maintenance and upon its return to the live network some squatter has stolen what used to belong to it.

Finding a squatter

In that case, you need to track down and nullify the impersonator before you can get the rightful device back in service. One way is to look at its MAC address as shown in the arp cache. If you are really lucky, looking up that MAC will point to something that you can easily identify. If not, "nbtstat" (Windows) or "nmblookup" (Samba) could give you a machine name. If it doesn't, or if machines are named in the haphazard fashion most typically done, your best option (assuming you don't have a smart switch that can help) is to start unplugging things at the switch to track it down - when the ping stops, you've found the wire. Start by disconnecting whole switches to isolate where it is and then zero in on it. Unfortunately, in places that never bothered to number jacks, you may still find yourself running around with a probe even after you have found one end of the wire. At least you know you can ignore the folks still browsing the Internet..

Speaking of finding the offending machine: I've seen a Windows server get confused by itself. That is, for some reason it sometimes thought it was seeing its own self on the network and would complain about the "duplicate" IP. I think this happened because of a name change, but I never did get to the bottom of it and a new server replaced it soon after..

Which device gets the traffic?

If neither OS is willing to play nice and not use the IP in conflict, the question then becomes which of these two devices will be seen by the rest of the network? A machine that has previously cached the MAC address of one of the devices will continue to talk to that, but otherwise its a coin flip: who answered the arp request first?

That leads to one way to prevent IP confusion: hard code the arp cache for machines that simply must not be confused. If you have a client box that has a really critical need to talk to ServerOne at its ordained IP address, hard coding the arp cache on the client with the server's MAC address will keep it faithful - well, at least from most accidental impersonations. Something still could spoof the MAC, but that's usually going to be purposeful rather than accidental.

That hard coding of the MAC can also be done at an intelligent switch. Some switches allow port-ip binding - locking an ip to a specific port on the switch. Doing both of those things would go a long way to ensuring that packets are going to the right device, but of course would also make your network harder to maintain. No more just plug and play, there'd be procedures and paperwork for that. The extra trouble might be well worth it in some scenarios but nothing and an annoyance in others.

In some situations you might need to bring together whole networks with overlapping IP's - that's a job for a NAT router.

You can't really prevent duplicate IP's. You can detect duplicates, block them, perhaps even mask them, but there's always a price to pay somewhere.

Some links you might find useful:

Mysterious Duplicate IP problem solved
New Dell machine kills server
Detection of duplicate IP addresses by Microsoft TCP/IP
How to Troubleshoot Duplicate Media Access Control Address Conflicts
Configure Port-IP Binding
Use DHCP Snooping and ARP Security to Block ARP Poisoning Attacks
Layer 2, Mac Addresses, ARP, and Duplicate IP Detection (Linux Kernel Patch)



Got something to add? Send me email.





(OLDER) <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> Manage duplicate ip address conflict

9 comments



Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Anthony Lawrence







Sat Apr 4 14:51:59 2009: 5985   TonyLawrence

gravatar
I forget to mention that some smart switches can show what is in use on each port. It probably will only show MAC addresses, but you can use arp to convert that back and at least find the right wire.







Mon Apr 6 21:48:01 2009: 6026   TonyLawrence

gravatar
A customer mentions that he uses



arping -D -I eth0 192.168.1.10; echo $?



Mon Apr 6 21:54:28 2009: 6027   TonyLawrence

gravatar
Also someone asked HOW you hard code the arp cache. It's just

arp -s hostname_or_ip mac_address pub



Thu Apr 30 03:55:36 2009: 6290   Andreas

gravatar
Helo,
i have a question:
in Windows, if someone is trying to use same IP adress (if i connected first and another user enters it in hes TCP/IP config), i can see warning about duplicate IP.
Mac OS X 10.5.6 has some warning also, or just stays online and i cant even know if someone (eg. some angry neigbour) is trying to steal my IP?
And if its unable to get any warning, can You recommend some software for monitoring it?
Thanks



Thu Apr 30 11:53:08 2009: 6291   TonyLawrence

gravatar
Angry neighbor?

You are confused about something. Unless your neighbor is hacking into your network, it doesn't matter what they use - nothing to do with you.



Sat May 7 06:52:54 2011: 9486   Amal

gravatar


My problem is that i am using xp and when i'm using some ip on lan, someone enters the same ip and then ip conflicts and I become unable to use the internet. Tell me saome way or software so that one can not use my ip while i'm using it on xp...help me as soon as possible..



Sat May 7 09:31:06 2011: 9487   TonyLawrence

gravatar


Set everyone to use DHCP and lock them out of any ability to change that.

And re-read the first sentence of this article.



Sun Nov 13 19:59:21 2011: 10170   TonyLawrence

gravatar


I did find why the Windows machine saw a duplicate IP..

A Unix machine had done a manual arp entry for the address in question. Apparently that IP had once been a printer.

When the Windows started up, the Unix machine would helpfully answer the "who has?" broadcast. As the printer was long gone, it was impossible to find it on the network.

It took a while to find that :-)



Sun Nov 13 20:04:47 2011: 10171   TonyLawrence

gravatar


The really odd thing about it was that Windows would show its own mac as the duplicate rather than what the Unix box had..

------------------------
Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us





Anyone even peripherally involved with computers agrees that object-oriented programming (OOP) is the wave of the future. Maybe one in 50 of them has actually tried to use OOP – which has a lot to do with its popularity (Steve Steinberg)





This post tagged: