Ubuntu – static network setup still using DHCP

dhcplinux-networkingstatic-ipUbuntu

I'm configuring an Ubuntu 14.04LTS server on our internal network. Everything works and runs as expected. Its assigned a static IP, here's /etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.10.250
        netmask 255.255.0.0
        dns-nameservers 192.168.10.1
        gateway 192.168.10.1

But when our router restarts and/or network goes down the server pulls a DHCP address and ignores the static IP. I tried removing "auto eth0" but it didn't change the situation.

If I reboot the server then the static IP always comes back. How can I force it to always use the static IP?

EDIT with answers to questions:

  • Not a virtual machine
  • dhclient is running (twice?)
  • No VPNs on this box
  • Nothing in the log about eth0 but wlan0 seems to be reconnecting to an access point on a fairly regular basis.

Best Answer

Kevin Sadler's answer will work, but it's quite heavy handed. Here is how you can disable an interface from being managed by Network Manager without uninstalling it.

# network manager cli
$ sudo nmcli d
DEVICE  TYPE      STATE      CONNECTION         
eth1    ethernet  connected  Wired connection 1 
lo      loopback  unmanaged  --   

You can see eth1 is managed by network manager.

In Ubuntu/debian flavors edit /etc/NetworkManager/NetworkManager.conf.

$ sudo vi /etc/NetworkManager/NetworkManager.conf
[ifupdown]
managed=false
unmanaged-devices=interface-name:eth1  # <--- Add this line

Then restart the service.

$ sudo service network-manager restart

Verify.

$ sudo nmcli d
DEVICE  TYPE      STATE      CONNECTION 
eth1    ethernet  unmanaged  --           # <--- it's now unmanaged.
lo      loopback  unmanaged  --