Categories: LinuxShellUbuntu

How to Restart Network on Ubuntu 22.04

Whenever a problem occurs with the system, the main solution is to perform a restart or reboot the system. Similarly, if a problem occurs with the network, then its easy treatment is to restart the network. There are many scenarios where you may need to restart the network on Ubuntu like settings of the network were changed or the active network connection not working properly. Restarting the network services is equally important for all Linux systems.

In this article, we will check how to restart the network on Ubuntu 22.04 and Ubuntu 20.04 systems.

Using the following different methods, you can restart the network on Ubuntu.

  1. Restart network using GUI
  2. Restart network using the command line

Depending on your ease, you can choose one that suits you.

Prerequisites

We are assuming that you are using the Gnome desktop on your Linux system. You should be logged in as a root user or you have sudo privileges to run all commands.

Method 1: Restart Network using GUI

When you restart the network using the GUI, then you can follow the following two different options.

Restart Network from the Desktop

In this method, you can restart the network from the Desktop. To do that, right-click on the top right corner on the network icon, and the following drop-down list will display on the right corner:

Click on the ‘wired connected’ option from the list and select ‘Turn off’ that will disable the network connection.

Now, follow the above-mentioned process and again enable the network by clicking the connect option as follows:

The network connection has been re-establish now.

Network Restart using Gnome Settings

Click on the arrow sign located at the top right corner and then choose ‘Settings’.

You can also go into the Settings by using the application search bar as follows:

You will see the following window on the desktop. Select the ‘network’ option from the left sidebar and here you can enable or disable the connected network connection.

Method 2: Restart network using the command line

Using this method, you can restart the network using the following different ways:

Restart Network using the service manager

The most simple and easiest way to restart the network using the network service manager. Launch the terminal and type the following command on it:

$ sudo service network-manager restart

Verify

Use Systemd to Restart Network

Systemd has an array of system components that can also handle network services. Restart network service using systemd, directly restart the network services instead of going through any other hoops.

$ sudo systemctl restart NetworkManager.service

verify

Restart Network through the Nmcli

Nmcli is the most commonly used tool for managing network connections. You can turn off the connect using the following command:

$ sudo nmcli networking off

Use the command below to turn on the network connection.

$ sudo nmcli networking on

Verify

Using ifdown and ifup commands Restart Network

The ifdown and ifup commands are used to handle the different network interfaces on Linux.

These two packages are not preinstalled on Ubuntu. Therefore, you need to install these packages by using the following command:

$ sudo apt update && sudo apt install ifupdown -y

To turn off the network, use the ifdown and turn it on by using the ifup command as follows:

$ sudo ifdown -a && sudo ifup -a

Restart Network using the nmtui

Nmtui is another tool for managing network connections and provides an interactive environment. This tool comes pre-installed by default on Ubuntu. Therefore, just launch it using the following command:

$ sudo nmtui

The following interface will display on the terminal:

Choose ‘Activate a connection’ using the downward arrow key and then hit ‘Enter’.Now, deactivate this connection by selecting the ‘deactivate’ option and hitting ‘Enter’.

Once the connection is deactivated, again ‘Activate’ this connection as follows:

Once the network is restarted, quit this application as follows:

Restart network using the IP command

The IP command is one more alternative that you can use in managing the network connections on Linux.

First, you will find your target network interface by using the following command:

$ ip link show

Here, enp0s3 is our target network. Start the network by typing the following command:

$ sudo ip link set enp0s3 down

$ sudo ip link set enp0s3 up

Conclusion

Restarting the network is a good solution for solving a network problem. If you still have the same problem then you can also reboot or restart your system. From the above all mentioned ways, I hope you have learned a lot.  But, in case of any issue, you can send us your feedback.

Karim Buzdar

About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn

Recent Posts

How to Install Magento 2 on AlmaLinux

Magento is a free and open-source e-commerce platform written in PHP. It is simple, easy…

1 year ago

How to Install ISPConfig Hosting Control Panel with Apache Web Server on Ubuntu 24.04

ISPConfig is an open-source control panel that allows users to manage multiple servers from a…

1 year ago

How to Test your Email Server (SMTP) Using the Telnet Command

As a Linux administrator, you may find it necessary to troubleshoot or test your Simple…

1 year ago

Managing Network Interfaces and Settings on Ubuntu 24.04 with nmcli

Ubuntu 24.04, like many modern Linux distributions, relies on the NetworkManager for managing network connections.…

2 years ago

Using Restic Backup on Ubuntu 24.04

Restic is a modern, open-source backup program designed for efficiency, security, and simplicity. It enables…

2 years ago

Installing phpMyAdmin on Rocky Linux 9 and Securing it with Let’s Encrypt SSL

phpMyAdmin is a popular free tool written in PHP intended to administer MySQL and MariaDB…

2 years ago