When a problem occurs with your computer system, one commonly used solution is to restart or reboot it. Similarly, when you encounter issues with your Internet connection, a quick fix to this problem is to restart the network.
You may find several situations where you might need to do this on an Ubuntu server, such as when you try to change your network settings or your Internet isn't working properly. So, restarting the network is an important step for all Linux systems.
In this tutorial, we will explain how to restart the network on an Ubuntu 22.04 system. Namely, we will show you different methods to restart the Network Manager or network services using the command line and GUI on the Ubuntu distribution.
Before starting the restart process, make sure your system has the following prerequisites:
- An Ubuntu Server should be running on your system or inside VMWare.
- You should log in as a root user or have “sudo” privileges.
Methods to Restart the Network in Ubuntu
You can restart Network Manager on Ubuntu 22.04 using two different methods:
- Restart the Network Service on Ubuntu using the Command Line.
- Restart the Network Service on Ubuntu using the GUI.
Method 1: Restart the Network Service on Ubuntu using the Command Line
You can restart the Network Services in Ubuntu using “Terminal.” but this is a somewhat tricky process. There are several commands available to restart the network manager on Ubuntu. You can also use these commands for other Linux distributions like Debian.
Restarting network methods may vary slightly in different Ubuntu versions. Therefore, if you find that one command doesn’t work, you can execute another. Most of the commands that we have listed in this article are effective on both Ubuntu 22.04 and Ubuntu 20.04 versions.
To restart the network manager using the command line, launch the terminal on the Ubuntu machine using the shortcut “Ctrl+Alt+t.”
Now, let’s discuss how to restart the network in Ubuntu using different commands:
1. Ubuntu Restart Network Using the Network Manager Service Command
The most straightforward method to restart the network in Ubuntu is by using the network service manager command:
$ sudo service network-manager restart
2. Restart the Network Service Using the “systemd” Command
Systemd offers various system components capable of managing network services efficiently. When you restart the network services using the “systemd” command, it allows for a direct and uncomplicated restart without any unnecessary steps. To restart a network in Ubuntu using systemd, type the following command:
$ sudo systemctl restart NetworkManager
3. Restart the Network Using the “ifup” and “ifdown” Commands
In Ubuntu, the “ifup” and “ifdown” commands help to handle network interfaces. However, these two packages are not installed by default on an Ubuntu system. You can install these packages using the following command:
$ sudo apt update
$ sudo apt install ifupdown
You can use both commands combined. To deactivate the network, use the “ifdown” command, and to re-activate it, type the “ifup” command as shown below:
$ sudo ifdown -a && sudo ifup -a
4. Restart the Network Manager Using the “nmcli” Command
If you're using the most recent editions of Ubuntu 18.04 or the newest, you can utilize the “nmcli” command to reset the network configurations. This serves as another robust and useful tool for managing Linux networks. It's user-friendly, which is why it's a favorite choice for many Linux network administrators. The “nmcli” command works in two steps. Initially, turn off the network using the following command:
$ sudo nmcli networking off
Now, type the above command again to turn on the network connection.
$ sudo nmcli networking on
5. Ubuntu Restart Network Using the “nmtui” Command
Nmtui is another popular tool that offers an interactive interface and is designed for managing network connections. This tool is installed by default on the Ubuntu 22.04 system. You can access this tool by executing the following command:
$ sudo nmtui
After executing the above command, an interface will appear inside the terminal window. Here, you need to navigate through the following steps:
- Select “Activate a connection” using the downward arrow key and press “Enter.”
- To deactivate the connection, choose the “deactivate” option and press “Enter.”
- After deactivation, select “Activate a Connection” to re-activate the connection.
- Once the network is restarted, exit or “Quit” the application.
6. Restart Ubuntu Network Manager Using the IP Command
In Ubuntu distributions, you can also manage the network connections using the IP command. First, check the target network interface by using the following command:
$ ip link show
As you can see, the “enp0s3” is the target network interface. Now, you can manage network connections using the following command:
$ sudo ip link set enp0s3 down
$ sudo ip link set enp0s3 up
Method 2: Restart the Network Service on Ubuntu using the GUI
You can easily restart the network from the desktop interface. Follow the below-listed steps to restart the Network Manager using GUI:
- Right-click on the network icon located in the top right corner of your screen. A drop-down list will appear in the same corner.
- From the drop-down list, choose “Wired connected” and then select “Turn off” to disable the network connection.
- Now, repeat the previous steps and re-enable the network by clicking on the “Connect” option.
Restart the Network Manager Using Gnome Settings
To access the Settings, you have two options:
- Click on the arrow sign located in the top right corner, then select “Settings.”
- Alternatively, you can use the application search bar.
After accessing the “Settings,” a window will appear on the desktop. Navigate to the “network” option in the left sidebar to enable or disable the connected network connection.
You will see the above window on the desktop.
Select the “network” option from the left sidebar, and here, you can enable or disable the connected network connection.
Now, your network connection has been re-established on your Ubuntu 22.04 system.
In this article, we demonstrated different approaches to effectively manage and restart network services on your Ubuntu 22.04 system. Whether you prefer command-line utilities, interactive tools like Nmtui, or the user-friendly desktop interface, Ubuntu offers a range of options to cater to your network management needs.
With these powerful tools at your disposal, you can ensure a smooth and uninterrupted network experience on your Ubuntu machine. However, if you encounter any further issues or have feedback to share, please don't hesitate to let us know. Thanks!