Ubuntu – Why is the network configuration I set in /etc/network/interfaces ignored on Ubuntu 17.10


I've just installed ubuntu server 17.10. During installation, it suggested me to connect to the network through wifi, and so i did. After installation was finished and system was rebooted, computer connected to the wifi automatically (which means, it saved the connection creds somewhere). But in /etc/network/interfaces i found nothing. I need my computer connect to wifi network with static ip, so I've put configuration into the /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

iface wlp2s0b1 inet static
        wpa-driver wext
        wpa-ssid *****
        wpa-psk **********
auto wlp2s0b1

When system starts, it doesn't connect using my configuration. It does only after

sudo ifdown wlp2s0b1 && sudo ifup -v wlp2s0b1

and after this command, system getting a SECOND IP! Server is still available by the ip it gets from DHCP, and in the same time, it is available by the static ip!

Best Answer

Networking is handled by netplan by default in Ubuntu Server 17.10 and later. I suggest that you edit the /etc/netplan/01-netcfg.yaml file to read:

# 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: [,]
          password: "**********"

Exit and save your changes by running the command:

sudo netplan generate
sudo netplan apply

Please note and follow the spacing and indentation. Also note that the SSID and password are in between quotes ".

Comment out all the wlp2s0b1 stanzas in /etc/network/interfaces and reboot.

Any improvement?

NOTE: The exact method to set a static IP address for a server with netplan and wifi is hard to find. We may need to tweak the settings a bit.

Related Question