3

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.
  • Is this computer a VM? Do you the dhcp client running in your process table? Do you have any unusual VPNs on this box? Does anything show up in your system logs the the IP changes? – Zoredache Jun 08 '16 at 16:46
  • Check to make sure network manger is at least disabled if not uninstalled. – BillThor Jun 09 '16 at 06:08
  • @Zoredache, looks like dhclient is running, I've edited the question with answers to your questions – scottinthebooth Jun 09 '16 at 22:43
  • @BillThor network manager was running, I shut it off. We'll see what happens tonight – scottinthebooth Jun 09 '16 at 22:44
  • Well the server still defaulted to DHCP. The funny thing though, when I log in it says the IP is 192.168.10.250 (what its supposed to be) but its answering on a DHCP assigned address elsewhere instead. I'm currently uninstalling (rather than just disabling) network manager to make sure that's not causing a problem. – scottinthebooth Jun 14 '16 at 15:32

2 Answers2

2

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  --    
James
  • 185
  • 1
  • 7
1

I had a similar problem. I had installed a desktop on the server which had included the network manager and this was running the dhclient at startup. Uninstalling the network manager and rebooting solved the problem.

sudo apt-get remove network-manager
sudo reboot
Kevin Sadler
  • 201
  • 2
  • 3