In the following article we will see and show various ways how to restart network from command line as well as from Graphical User Interface (GUI) on Ubuntu 18.04 Bionic Beaver distribution.
Operating System and Software Versions
- Operating System: – Ubuntu 18.04 Bionic
- Software: – GNOME Desktop
- # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
- $ – requires given linux commands to be executed as a regular non-privileged user
Graphical User Interface
Bring up network management window by right-click on the top right corner network icon and locate the network connection you wish to restart then click on Turn Off.
The Network Icon will disappear. To turn on the network again, left click on the top right corner arrow down, locate your network interface and click Connect.
To restart network from the command line you have the following options:
$ sudo netplan apply
The first command line network restart uses the systemctl command to perform the restart of network manager.
|$ sudo systemctl restart NetworkManager.service|
Same as the above can be accomplished with the service command:
|$ sudo service network-manager restart|
Controlling the Network Manager with the nmcli command will restart the Network Manager directly:
$ sudo nmcli networking off
$ sudo nmcli networking on
System V init
The old fashioned and now obsolete way using System V init scripts directly is still available on Ubuntu 18.04 Bionic Beaver Linux:
$ sudo /etc/init.d/networking restart
$ sudo /etc/init.d/network-manager restart
In this last example we will restart the network interface directly using the ifup and ifdown commands. Note the the -a option will tell the ifup and ifdown commands to restart all available network interfaces marked as “auto“:
$ sudo ifdown -a
$ sudo ifup -a