How do I restart the networking on Ubuntu Linux system from a shell prompt?
You can easily restart, stop, or start networking service under Ubuntu Linux using a shell prompt. You can also restart networking remotely over ssh session. However, please do not stop networking service over ssh session as you will loss connectivity to the remote server. You can use the following tools:
How to restart network in Ubuntu Server:
- /etc/init.d/networking restart script based command.
- service restart networking – Use service to run a System V init script such as networking.
- systemctl restart networking – Restart networking for the latest version of Ubuntu server.
The syntax is as follows to restart the networking on Ubuntu or Debian based operating systems.
Task: Restart networking under Ubuntu Linux
Open the terminal (bash shell command line) and type the following commands on the latest version of Ubuntu 16.04 or above:
$ sudo systemctl restart networking
$ sudo systemctl restart networking.service
To verify status and connectivity, enter:
$ sudo systemctl status networking.service
$ ip r ## show routing info ##
$ ip a show eth0 ## show info for eth0 interface ##
$ ip a show br0 ## show info for br0 interface replace br0 with your actual interface ##
$ ping sxi.io
Sample session from above commands:
Note for for an older version of Ubuntu such as Ubuntu 14.04 LTS or older, enter:
$ sudo /etc/init.d/networking restart
How to restart the networking service (Ubuntu version 14.04LTS or older)?
You can use the service command following as well:
$ sudo service networking restart
Warning: Do not stop networking service over ssh session.
To start networking service, enter :
$ sudo /etc/init.d/networking start
$ sudo service networking start
To stop networking service, enter:
$ sudo /etc/init.d/networking stop
$ sudo service networking stop
A note about desktop users
If above command failed, try the following command:
$ sudo service network-manager restart
OR systemd based Ubuntu system (latest version:
$ sudo systemctl restart network-manager
- See how to make changes to Ubuntu Linux network configuration by editing /etc/network/interfaces file.