If you’ve recently updated your network configuration or just can’t get things to connect, you may need to restart the networking services on your Ubuntu System to get things back up and running.
Restarting the Network Service from the Linux Terminal/Command Line
This is probably the solution you’re looking for – it works on Ubuntu desktop and servers without a GUI. It will completely restart the networking service and reload all configurations.
All of these commands are run with the sudo command to elevate the user to administrator/root privileges.
To restart the networking service, run the following:
sudo service network-manager restart
Restarting Networking on Ubuntu via the Desktop/GUI
To restart a specific network adapter from the Ubuntu desktop, click on the network icon in the top-right of the screen, expand the menu under the network adapter you want to restart, and turn it off.
Repeat, this time toggling back on.
Done! That adapter should now take on any configuration changes made to it or notice any configuration change you’ve made to the wider network (for example, changes to DHCP or DNS you’ve made on your router).
This may not be enough, however – it may be necessary to completely restart the networking services from the command line as outlined above.
Restarting from the command line is also useful if you run a different desktop environment that doesn’t include options to start/stop a network interface.
Toggling Networking via the CLI
You could also use the nmcli package to restart the networking services:
sudo nmcli networking off sudo nmcli networking on
nmcli is the Network Manager Command Line Interface. It comes installed with Ubuntu Desktop by default – it’s the command line equivalent of toggling the network via the GUI. You can find out more about it by running:
…to view the user manual.