Why dhclient is still running when I choose static IP?

Solution 1:

  1. You first have to shutdown the interface (in dhcp mode) sudo ifdown eth0
  2. Then edit the config nano /etc/network/interfaces

    # The primary network interface
    auto eth0
    iface eth0 inet static
    netmask 255.255.0.0
    address 10.10.130.128
    gateway 10.10.1.1
    
  3. Bring the interface back up sudo ifup eth0

Otherwise dhclient doesn't correctly shuts down,

Solution 2:

I had the same issue (Ubuntu 16.04). However, this was a cloud instance and I could not ifdown the interface that easily.

Short answer: I removed the file /etc/network/interfaces.d/50-cloud-init.cfg ifup was triggered by that specific file.

Long answer: I configured the interface using the /etc/network/interfaces with a static IP address, but I still found in the daemon.log that dhclient was still requesting IP's from the DHCP and dhclient was started through systemd. Specifically, systemd called the networking.service unit, which called ifup, which read both the interfaces file and the 50-cloud-init.cfg file. Resulting in some conflicts, but still a functional network.

Solution 3:

I found for me, this was due to gnome's NetworkManager still running and thinking it was in charge of the device. In hindsight this should have been obvious as ps showed dhclient was being launched by NetworkManager.

Once I restarted my system the device went to "unmanaged" in NetworkManager and it stopped trying to configure it. Perhaps I could have achieved the same thing just by stopping/restarting NetworkManager, I'm not sure.