Switch back to ifupdown – /etc/network/interfaces in Ubuntu

Netplan is a network configuration tool. It was first introduced in the Ubuntu 17.10. Prior to that, Ubuntu had ifupdown package to configure and manage networks. There are still many users who would prefer ifupdown package for managing their networks for various reasons. In this article, we would discuss how desktop users can switch back to ifupdown package and manage their networks through /etc/network/interfaces configuration file. Furthermore, they can also use command-line utilities like nmcli, nmtui or GUI based network-manager-gnome to manage their networks.

Install ifupdown package

Superuser privilege is a prerequisite before making any changes, if you don’t have one then contact your System Administrator for assistance.

You need to install ifupdown package. To do so, run the following –

sudo apt update
sudo apt install ifupdown

Also, if you plan on to Install GUI version of Network Manager – various other tools like nmcli, nmtui are also there.

sudo apt install network-manager-gnome

Remove Netplan package

If you don’t want to keep configuration and other related files of Netplan package installed,

sudo apt purge netplan.io

To remove associated folders –

sudo rm -rf /usr/share/netplan 
sudo rm -rf /etc/netplan

So far, we have installed ifupdown package and subsequently removed Netplan package. Now, we will be editing /etc/network/interfaces file.

Make necessary changes to /etc/network/interfaces

sudo nano /etc/network/interfaces

We have used nano text editor, you may choose one of your choice. In /etc/network/interfaces configuration file, make the following entries –

auto lo
iface lo inet loopback

Now, we are have got two options available with us. Either we configure /etc/network/interfaces file manually or, let any of the network-manager tools do that for us. We will discuss both the available options in brief next.

Option 1. Configure /etc/network/interfaces file.

Use the following command to identify the network interfaces –

ip a

For instance, one interface could be – enp2s0 and the most basic IPv4 DHCP configuration may resemble –

auto lo
iface lo inet loopback

auto enp2s0
iface enp2s0 inet dhcp

Note: You need to identify the interface which you are trying to connect with. Also, the above code just resemble the most common configuration. For advanced configurations, you are advised to refer to man pages for network interface configuration of ifup and ifdown packages. These can be accessed by running the following command –

man 5 interfaces

After making relevant changes mentioned in the man pages do,

sudo systemctl restart networking

Option 2. Use network-manager tools.

Edit the following configuration file –

sudo nano /etc/NetworkManager/NetworkManager.conf

In the configuration file, you need to edit – managed=false and update it with managed=true

Also, we need to make an empty file by using the touch command.

sudo touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf

The above steps are being advised to get rid of the error – “devices not managed” that comes up during network configuration.

Now, we have got three commonly used tools available to us – nmcli, nmtui, or graphical version: network-manager-gnome.

If you are an advanced user, go for nmcli else either run nmtui in terminal or use network-manager-gnome. The changes you make would be according to your requirements.

Conclusion, in this article we have discussed the ways to manage your network configuration if you are planning to switch back to ifupdown package.