Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Sometimes one of my Ubuntu 12.04 Server machines get into an IP conflict with another device on the network.

I can detect the IP conflict by disabling the nic, and accessing the ip from another machine, although I'm looking into a more autonomous way of detecting the ip conflict (using nmap or arp-scan).

Once an IP conflict has been confirmed, I can solve the IP conflict by running sudo dhclient -r; sudo dhclient, followed by a reboot or ifdown/up.

This approach is not ideal, and I would like a solution which automatically detects if the machine has an IP conflict and if so automatically renews the IP.

I could write one myself, but I was hoping such a thing already existed..

Is there an ubuntu program which will automatically detect & resolve ip conflicts?

share|improve this question
How is the other device getting that IP? DHCP or manual allocation? –  Andrew Jun 13 '13 at 0:56
@Andrew both DHCP. –  Dean Rather Jun 13 '13 at 1:03
@DeanRather If both devices are using DHCP, why is the DHCP server handing out duplicates? Is there more than one DHCP server? –  jscott Jun 13 '13 at 1:28

2 Answers 2

Dumb, but efficient way for servers:

while true; do 
    sleep 5
    ip=`ifconfig wlan0 | grep 'inet addr' | sed 's/^.*inet addr:\([0-9][0-9.]*\) .*$/\1/'`
    arping -qc 1 -I <interface> $ip && { 
        killall dhclient
        sleep 1
        dhclient <interface>
        sleep 20
done &

The idea is that your machine never will answer with ARP pong.

For desktop -- user IPwatchd, see http://ipwatchd.sourceforge.net/

share|improve this answer
the arping seems to check whether the IP is conflicted well enough, but killall dhclient says 'dhclient is not running' (dhclient3 is though). And dhclient <interface> says error: file already exists. Also did you mean put put <interface> in the ifconfig arg? I've also tried sudo dhclient -r and that's not solving the ip conflict any more either :( –  Dean Rather Jun 17 '13 at 2:35

Set a static DHCP allocation for the server that is outside of your normal DHCP range. No other device should never be allocated that address. Or, just set a static IP for the server.

share|improve this answer
Can't do that :(. We're building a unit which could be deployed on networks we have no control over. The machine itself has to do what it can to remain online. –  Dean Rather Jun 13 '13 at 5:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.