How to Restart the Network on Ubuntu

In this guide, we will be showing you how to restart the network on an Ubuntu system.

Ubuntu Restart Network

If you are experiencing issues with your connection, one of the first things you might want to try is restarting the network.

There are several ways to restart the networking on Ubuntu that we will be covering.

Restarting the network differs between the Desktop and Server flavors of Ubuntu as they use slightly different ways of handling the network.

Before proceeding, double-check what flavor of Ubuntu you are using, then skip to the corresponding section.

Restarting the Network on Ubuntu Desktop

In this section, we will be showing you how you can restart the network on Ubuntu Desktop. We cover how to use the GUI or terminal to restart the network.

Using the Desktop Interface to Restart the Network

Restarting a particular network interface is incredibly simple within the Ubuntu interface. You don’t have to leave the desktop or scramble through the settings.

The following screenshots were taken on Ubuntu 22.04 but should also work for restarting the network on older versions.

1. On the Ubuntu desktop, click the top-right of the screen to open the quick settings panel.

This panel will allow us to turn any connection off and on quickly.

Open Quick Settings Panel

2. With the quick setting panel, identify the Ubuntu connection you want to restart and click it (1.).

In the expanded network menu, click the “Turn Off” option to disable that connection (2.).

Restart Ubuntu Network Connection

3. Open the quick settings panel again, and find the network connection you disabled (1.).

This time you will need to click the “Connect” button to restart the connection (2.).

Re-connect Disabled Connection

4. You should now have successfully restarted the network on Ubuntu.

If you are still facing issues, it might be worth trying a complete restart of your system.

Using the Terminal to Restart the Network Interface

Restarting the Ubuntu network interface through the terminal is more of an involved process.

Over the several different releases of Ubuntu, these methods have changed slightly. If one command doesn’t work for you, please try one of the others mentioned within this section.

Before proceeding, open the terminal on your Ubuntu device. You can press CTRL + ALT + T on your keyboard to quickly open the terminal.

Using NMCLI to Restart the Network

In recent versions of Ubuntu, including Ubuntu 22.04, 20.04 and 18.04 you can use “nmcli” to restart the network.

Nmcli is a command-line tool that allows us to issue commands to NetworkManager, which handles the underlying network on Ubuntu desktop devices.

1. With the terminal open on your device, you will want to start by turning off the network connection.

To use “nmcli” to turn off your network connection, use the following command.

sudo nmcli networking off

2. To complete the network restart of your Ubuntu device, you will want to use “nmcli” again.

This time, however, we will use it to turn networking back on by using the command below.

sudo nmcli networking on

Restarting the NetworkManager Service

Another way of restarting the network on Ubuntu Desktop is to restart the NetworkManager service.

This service controls all networking on your device, so we restart the network state by restarting it.

Use the following command in the terminal to restart this service using “systemctl“.

sudo systemctl restart NetworkManager

Restarting the Network on Ubuntu Server

This section will show you how to restart the network on Ubuntu Server. These steps differ due to Ubuntu Server typically utilizing a different network management method.

It should be noted that you should not run the following commands over SSH. This is because you will switch off your network, breaking the SSH connection.

Restarting an Individual Network Interface

You can restart individual network interfaces within Ubuntu by utilizing the “ip” command within the terminal.

This section will show you how to identify your network interfaces and restart them.

1. We can utilize the ip command to list all network devices available on Ubuntu.

To list all of the network interfaces, run the command below.

ip addr show

After running the above command, you will see something like the following appear in the terminal. First, note the name of the interface you want to restart. For example, ours will be “enp2s0“.

You can safely ignore the “lo” interface as this is the loopback interface.

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:82:b5:b3 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.215/24 brd 192.168.0.255 scope global dynamic noprefixroute enp2s0
       valid_lft 81911sec preferred_lft 81911sec
    inet6 fe80::d941:4ce1:c6b4:52f6/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

2. Now that we have the name of a network interface, we can utilize it now to restart the network on Ubuntu.

Use the following two commands to bring the network down, and immediately back up again.

Make sure that you replace “NETWORKNAME” with the name of the network interface you want to restart.

sudo ip link set NETWORKNAME down
sudo ip link set NETWORKNAME up

Restarting the Network Service

You can also restart the network on Ubuntu server by restarting the entire service. This has risks, so be careful when doing it on a live server.

To restart the network service, you must use the following command within the terminal.

sudo systemctl restart systemd-networkd

Conclusion

In this tutorial we aimed to show you how you can restart the network on Ubuntu.

Please comment below if you have questions about restarting the network for the desktop or server variants.

You can learn more about Ubuntu by following our many other guides. We also have several Linux tutorials to help you learn the system better.

Leave a Reply

Your email address will not be published. Required fields are marked *