Ubuntu: bring back to /etc/network/interfaces

Starting from Ubuntu 18.04 network configuration goes via systemd using netplan application, main network config placed in the /etc/netplan/*.yml. Some peoples dislike netplan because some things are hard to proper configuration and want to bring back classic /etc/network/interfaces.

1. Install ifupdown

apt-get update
apt-get install ifupdown

2. Configure your /etc/network/interfaces

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug ens160 
auto ens160
iface ens160 inet static
        address 192.168.1.2
        netmask 24
        network 192.168.1.0
        gateway 192.168.1.1
        broadcast 192.168.1.255
        dns-nameservers 1.1.1.1

3. Apply changes

ifdown --force enp0s3 lo && ifup -a
systemctl unmask networking
systemctl enable networking
systemctl restart networking

4. Disable and uninstall netplan stuff

systemctl stop systemd-networkd.socket systemd-networkd networkd-dispatcher systemd-networkd-wait-online
systemctl disable systemd-networkd.socket systemd-networkd networkd-dispatcher systemd-networkd-wait-online
systemctl mask systemd-networkd.socket systemd-networkd networkd-dispatcher systemd-networkd-wait-online
apt-get --assume-yes purge nplan netplan.io