How to enable and disable network interfaces in Ubuntu 20.04

s2 0

When we act as the Ubuntu administrator, we are responsible for managing the system’s network settings. If you make changes to the network card on a Linux system, the connection will be broken. The network interfaces appear to be either practical or virtual, and you can simply enable them in one of the ways. In this tutorial, you will learn how to enable and disable network interfaces in Ubuntu using various techniques. All instructions were executed on Ubuntu 20.04 LTS, which is the latest Ubuntu version. Let’s start with the specifics!

First of all, you need to install the network tools on your Ubuntu 20/04 Linux system if they are not already installed. So try the following apt install query in the shell and hit enter to run it. Add the user password to continue the installation process.

$ sudo apt install net-tools

Control network interfaces with the ifconfig command

After the network tools have been installed, we need to find out about our existing network interfaces that are integrated in our system. For this we have an “ip” command that can display the data on the network interface. Therefore execute the command “ip” followed by the variable “a” in the shell and press the Enter key.

$ ip a

You can take a look at the interface shown in the picture above, e.g. enp0s3. The interface is currently active and active. To disable it, we use the “ifconfig” command in the shell, followed by the interface name and the state to be used. Therefore we have mentioned the state in the following command as “down”.

$ sudo ifconfig enp0s3 down

Deactivate network interface

If you now check the status of interfaces, the status of an interface “enp0s3” has been changed to “down”.

$ ip a

NW interface has failed

You can also check the status of an interface “enp0s3” separately by using the “grep” flag below in the command as described below.

$ ip a | grep -A 1 "enp0s3"

Check the status of the network interface

Now if we want to change the status back to up, we use the same previously mentioned command in the shell, which states its status as “up” as shown below.

$ sudo ifconfig enp0s3 up

Activate network interfaceadvertising

If you now check the status of the “enp0s3” interface again, you will find that it is active again.

enp0s interface is active again

Control network interfaces using the systemctl command

Another possibility to disable the network service within the Ubuntu 20.04 Linux system is the “systemctl” repository or tool. Therefore, we must first check the network service status using the systemctl command followed by the “status” keyword as described below. The output indicates that the service is up and running properly.

$ sudo systemctl status NetworkManager.service

Network manager

To disable the service, we must first stop it. So that it does not have access to system resources. Hence we have to use the systemctl command twice. The first time we use it with the “stop” keyword to stop it. And the second time we use it with the keyword “disable” as shown in the following figure.

$ sudo systemctl stop NetworkManager.service
$ sudo systemctl disable NetworkManager.service

Stop and disable the network service with systemd

If you check the status again, you will get that the service has been disabled.

$ sudo systemctl status NetworkManager.service

Check the network status using the systemctl command

Let’s re-enable the network service in our Ubuntu 20.04 system with the following reboot and enable the keyword command as below. You can see that the system enabled this service by providing a resource path.

$ sudo systemctl restart NetworkManager.service
$ sudo systemctl enable NetworkManager.service

Activate the network service with systemd

We checked the network service again using the status command and found that it was successfully activated and activated.

$ sudo systemctl enable NetworkManager.service

Network service activated


We have discussed and implemented two simple methods of disabling and then enabling the network interfaces in the Ubuntu 20.04 Linux system. Make sure you don’t miss a single step while implementing these methods on your Ubuntu 20.04 Linux system for the best results.

How to enable and disable network interfaces in Ubuntu 20.04