User Tools

Site Tools


tips:netplan

Remove Netplan On Ubuntu 18.04

With Canonical's addition of netplan in Ubuntu 18.04 as the de-facto networking replacement, certain configurations can be quite cumbersome and time-consuming to sort-out on this new YAML fed system.

This guide will demonstrate how to revert back to the industry standard ifupdown system, implemented exactly as it was in Ubuntu 16.04.

Installing ifupdown

Reinstall the ifupdown package:

$ sudo apt-get update
$ sudo apt-get install ifupdown

Configuration

Configure your /etc/network/interfaces file with configuration stanzas such as:

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

Apply Configuration

Make the configuration effective (no reboot needed):

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

Remove Netplan Services

Disable and remove the unwanted services:

$ 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-get --assume-yes purge nplan netplan.io

Then you're done.

Note: You MUST, of course, adapt the values according to your system (network, interface name…).

DNS Resolver

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
DNS=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.

tips/netplan.txt · Last modified: 2021/06/18 16:36 by 127.0.0.1