Network restart is one of the most common system administration activities. Let us show you GUI and command line ways to do this on older and newer versions of Ubuntu.
Sometimes resetting your Ubuntu network is required to implement several network configurations such as changing your IP from DHCP Automatic to a static one. Restarting is not a big problem, but must be done carefully.
It is strongly recommended not to perform such actions remotely using SSH because once you stop the network, your SSH connectivity will be lost. In rare cases, you will not be able to start a connection via SSH. You only need to connect to the Ubuntu machine directly.
Restart Network on Ubuntu
In this guide, we will show you how to restart your Ubuntu machine network using the following techniques:
- Graphical user interface or (GUI) tool
- Command line method or (Terminal)
Now let’s start discussing each method separately.
Method 1: Restart the Ubuntu Network Using the Graphical User Interface (GUI)
In general, using any graphics tool is considered the easiest method to do whatever you need. In our tutorial, we will use the NM applet, which is a built-in applet for the Ubuntu network manager, and is found in the system tray. Below you can find detailed steps to restart the network connection using the NM applet.
Stop the Network
Step 1. First, let’s open the NM-applet; from the top panel, you can find the symbol for your network icon, indicating that you are connected to the internet. Now click the down arrow.
Step 2. Select the “Wired Connected” option.
Step 3. Next, select the “Turn off” option to stop the network manager.
As you can see, the network icon will disappear from the top panel, indicating that you are offline.
To start the network again, click the down arrow from the top panel. Then click the “Connect” option. You can now find the network icon appearing in the top panel again.
Method 2: Restart the Ubuntu Network Using Command-Line
In addition to the NM-applet graphics tool discussed in the above method, you can easily restart a network connection using the command line. Some of the commands will make the network icon disappear from the top panel, and some will not affect its appearance. Because of this, sometimes you can stop the network while the network icon is still in the top panel, but in the meantime, you will be disconnected and will not be able to use the internet.
Restart Network Services using init.d
Stop the network service using the next init.d command. Make sure you have sudo rights to run this command.
sudo /etc/init.d/networking stop or sudo service networking stop
To start the network service again.
sudo /etc/init.d/networking start or sudo service networking start
The previous four commands can be used with Ubuntu 14.04 LTS and earlier versions. However, for newer versions of Ubuntu you can use the command below:
sudo systemctl restart networking.service
or the following command as well:
sudo systemctl restart networking
Restart Network Manager Service
Using the command below will stop and start the network manager immediately, so the network icon might not disappear. To restart the network manager service, use the following command:
sudo service network-manager restart
Restart the Network Using the Commands Tool
This command is widely used by Linux administrators to restart a network. Once again you need to make sure you have sudo rights.
sudo nmcli networking off
Restart the Network Using the ifdown / ifup command
Additionally, you can immediately restart the network interface using the ifdown and ifup commands. To stop the network interface use the following command:
sudo ifdown -a
To start the network interface again, use the following command:
sudo ifup -a
That’s all for now. I hope you enjoyed this tutorial.