How often do you restart your network services? Sometimes you might need to troubleshoot your network connection in case you have made changes to your network or simply cannot access the internet. In this tutorial, we'll focus on how you can restart networking service on Ubuntu 18.04 and older versions.
1) Using Graphic User interface
One of the ways you can restart networking on Ubuntu 18.04 is by using GNOME's GUI interface. Navigate at the top right corner of your screen and click on the network icon as shown to reveal the pull-down menu. You'll be able to locate and view your network connection type. In this case, I'm using a wired connection. You could be using a wireless connection for your case.
Click on the network interface and click on 'Turn off' option to turn off the networking service.
To turn on the networking service, head out to the top right corner and click on the arrow down icon. Be sure to locate your network interface that is turned off as illustrated below.
Click on the interface to expand the options and thereafter, click on 'Connect'.
This will bring up the interface and resume network services as normal :-)
2) Using the Command line
For the command line geeks, a couple of options are available to you to achieve the same result. We'll discuss a few commands that you can use to restart networking service on Ubuntu 18.04.
Netplan is a command line tool used for easily configuring networking service on Linux systems. To restart the networking service run the command below
$ sudo netplan apply
Since Ubuntu 18.04 is based on systemd init , you can also use
systemctl as shown
$ sudo systemctl restart NetworkManager.service
In addition, you can also use the service command to achieve the same result as shown.
$ sudo service network-manager restart
nmcli is yet another command line tool that's easy to use and saves you time when managing network interfaces. To restart networking service, run the following commands in succession.
$ sudo nmcli networking off $ sudo nmcli networking on
Finally, we have the ifup/ifdown commands which can be used as follows
$ sudo ifdown -a $ sudo ifup -a
For older versions of Ubuntu
For older versions of Ubuntu (14.04 LTS and earlier ), you can restart networking through the following commands
$ sudo service networking restart
$ /etc/init.d/ restart networking
Alternatively, you can stop and start networking service as an alternative to restarting networking service
To stop networking service in older versions of Ubuntu run
$ sudo service networking stop
$ sudo /etc/init.d/networking stop
After stopping the service, it's time now to start the service.
start networking service
To start networking service run
$ sudo service networking start
$ sudo /etc/init.d/networking start
It's a pretty simple command but how many times you end up issue restarting the network? Feel free to add any comment with your experience and share this article.