User Tools

Site Tools


ubuntu_desktop:network:use_etc_network_interfaces_instead_of_netplan

Ubuntu Desktop - Network - Use /etc/network/interfaces instead of netplan

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.


Reinstall the ifupdown package

sudo apt update
sudo apt install ifupdown

Configure your /etc/network/interfaces file with configuration stanzas

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

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

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

Adjust 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:

/etc/systemd/resolved.conf
....
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.


References

ubuntu_desktop/network/use_etc_network_interfaces_instead_of_netplan.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki