My Ubuntu server will not accept my static IP assignment. Instead, I keep getting a DHCP lease. Network Manager is not installed. Below is the output of cat /etc/network/interfaces

# The primary network interface
auto eth0
iface eth0 inet static
dns-domain mynetwork.local
dns-search mynetwork.local

Output of ip addr


  1. Why doesn't Ubuntu accept the static IP assignment? The Interfaces file seems to be ignored.

  2. What is allowing a DHCP lease to be assigned?


The package ifupdown and so /etc/network/interfaces are no longer used. Ubuntu 17.10 Server uses the package netplan instead, which configures systemd-networkd.

Make sure you use the default content for the config file /etc/network/interfaces

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# Generated by debian-installer.
# The loopback interface
auto lo
iface lo inet loopback

And create this netplan config file for a static IPV4 address (works for me): /etc/netplan/01-netcfg.yaml.

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
  version: 2
  renderer: networkd
      dhcp4: no
      dhcp6: no
      addresses: []
        addresses: [,]

Make sure you use the correct network interface name ("ens3" in this example).

Make sure you use the correct DNS servers (nameservers->addresses) for your network environment.

Once this file has been created, run the following commands as root to test & activate the configuration:

sudo netplan --debug generate
sudo netplan apply
  • 1
    Can also stick to eth0 naming conventions(needed by some scripts/programs) by adding the quoted section to your /etc/defaults/grub and running update-grub. GRUB_CMDLINE_LINUX="biosdevname=0 net.ifnames=0" – m_krsic Nov 3 '17 at 18:18
  • @m_krsic No. You can change the interface name via netplan by using set-name. More info is here. – Andrejs Cainikovs Nov 8 '17 at 14:33
  • 1
    @AndrejsCainikovs Many wish to disable PNIN all together, hence the official upstream method I posted freedesktop.org/wiki/Software/systemd/… – m_krsic Nov 8 '17 at 17:15
  • Or just apt-get install ifupdown and /etc/network/interfaces will continue to work like in the past – Chris Mar 25 '18 at 19:17

protected by Community Nov 3 '17 at 22:01

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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