Ubuntu 18.04 stopped using the classic /etc/init.d/networking and /etc/network/interfaces method of configuring the network and switched to some thing called netplan.
sudo apt update sudo apt install ifupdown
Example:
source /etc/network/interfaces.d/*
# The loopback network interface auto lo iface lo inet loopback allow-hotplug enp0s3 auto enp0s3 iface enp0s3 inet static address 192.168.1.133 netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.1 # Only relevant if you make use of RESOLVCONF(8) # or similar... dns-nameservers 1.1.1.1 1.0.0.1
sudo ifdown --force enp0s3 lo && ifup -a sudo systemctl unmask networking sudo systemctl enable networking sudo systemctl restart networking
sudo systemctl stop systemd-networkd.socket systemd-networkd \ networkd-dispatcher systemd-networkd-wait-online sudo systemctl disable systemd-networkd.socket systemd-networkd \ networkd-dispatcher systemd-networkd-wait-online sudo systemctl mask systemd-networkd.socket systemd-networkd \ networkd-dispatcher systemd-networkd-wait-online sudo apt --assume-yes purge nplan netplan.io
Adjust the values according to your system (network, interface nameā¦).
Because Ubuntu Bionic Beaver (18.04) make use of the DNS stub resolver as provided by SYSTEMD-RESOLVED.SERVICE(8), you SHOULD also add the DNS to contact into the /etc/systemd/resolved.conf file. For instance:
....
DNS=1.1.1.1 1.0.0.1
....
and then restart the systemd-resolved service once done:
sudo systemctl restart systemd-resolved
The DNS entries in the ifupdown INTERFACES(5) file, as shown above, are only relevant if you make use of RESOLVCONF(8) or similar.