System loses static IP address

Recently I stumbled on this problem and after some investigation it turned out that /etc/dhcp/dhcp.conf needed a block to be added, (or uncommented,) similar to this:


alias {   interface "eth0";   
fixed-address 10.1.1.1;   
option subnet-mask 255.0.0.0; }

Hope this helps!

Regards, Glendon Gross


Hmmm, strange... I'm not sure it matters, but for neatness sake I would place the netmask parameter directly after "address" and not after "gateway". You should also uninstall/deactivate the (isc-)dhcp-client package from the host, and beware of ipv6 and the resolveconf package. Before that: A way to find out what's going on is to put in place a firewall rule that accepts & logs all traffic to and from the DHCP ports (server 67 UDP and client 68 UDP) or create logging for the devices state, the dhcp-client or sniff your traffic.

A workaround (or alternative solution) though is to configure DHCP reservations for some of your hosts or an infinite lease-time for their DHCP addresses. For me that works really well, and the advantage is centralized management. If your DHCP server is your modem/router you can probably configure it in the web-interface (either the lease-time or the reservation) and on some routers you can even check a "fixed address" checkbox. If you configured your own server (Ubuntu?) you need to edit the dhcpd.conf file adding some lines like this:

host Accountant {
  hardware ethernet 00:1F:6A:XX:XX:XX;
  fixed-address 192.168.124.104;
}

I know this is old, but I ran into a similar issue that I was struggling with. I also opened a case with Canonical to ask for help.

I've since resolved my issue and have come back to this post in the hope that this might prove useful to someone else who might stumble upon this. My issue in the end, turned out to be 'wicd-daemon'. I'm not sure how or why the package was installed, but it was the main contributor of dropping my static address and causing other networking issues for me.

A symptom of my problem was dhclient would startup if I unplugged the network cable and plugged it back in. Similar to the issue reported here I would then get a different IP address. If I set my NIC manually it was OK, but then some random time later it would get a different IP (due to dhclient running in the background it seems). Check if dhclient is running. As for why dhclient is even running that is another problem. Below I describe what resolved dhclient for me, which I ended up tracing down several paths (avahi, ntpd, ifup, ...). For my case it was wicd-daemon.

The issue originally came to light in testing as I was switching networks that required me to physically move my network cable. This caused networking issue for me which it shouldn't have. It also took a bit of time to discover the problem as well, as I was not expected my static IP to have dropped or changed.

In the end, purging wicd-daemon and python-wicd took care of the issue. My system now retains the static IP address even when the network cable has been unplugged. I've not seen dhclient start up either, so I'm thinking that issue has also resolved itself. I went down other paths as well, looking at avahi which seemed to play a roll in the issues I was having, I also looked at ntpd as well (weird I know, but it was showing up in the syslogs at the same time other issues did; NTPD probably didn't have anything to do with it but it was producing suspicious logs). I ran down several rabbit holes until by chance I stumbled on a wicd process running while doing other testing.

So long story short check if dhclient is running and if you have a network manager like wicd running on your system. It could be what is causing you problems with your static address.