Ubuntu Linux Restart Network Service

I am a new Ubuntu Linux user and using it on my HP Laptop. Now, I need to restart my network service. How do I restart network under Ubuntu Linux? How can I restart networking service on Ubuntu LTS server? How do I successfully restart a network service without rebooting Ubuntu box?

Ubuntu Linux comes with a script called networking (Ubuntu restart network command). This script is used to activates or deactivates or restart all network interfaces (NIC) configured to start at boot time.

Ubuntu Linux restart network command

Open shell or terminal and type the command as follows:
$ sudo /etc/init.d/networking restart
You can also use the following command:
$ sudo service networking restart
Sample outputs:

 * Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces
 * Reconfiguring network interfaces...                                           * Disconnecting iSCSI targets
   ...done.
 * Stopping iSCSI initiator service
   ...done.
resolvconf: Error: /etc/resolv.conf isn't a symlink, not doing anything.
 * Disconnecting iSCSI targets
   ...done.
 * Stopping iSCSI initiator service
   ...done.
resolvconf: Error: /etc/resolv.conf isn't a symlink, not doing anything.
resolvconf: Error: /etc/resolv.conf isn't a symlink, not doing anything.
 * Starting iSCSI initiator service iscsid
   ...done.
 * Setting up iSCSI targets
   ...done.
ssh stop/waiting
ssh start/running, process 45886
resolvconf: Error: /etc/resolv.conf isn't a symlink, not doing anything.
 * Setting up iSCSI targets
   ...done.
ssh stop/waiting
ssh start/running, process 45946

You can use this command on remote Ubuntu Linux server without any problem, but make sure you pass only restart option. This command also accepts start and stop options:

WARNING! These examples may stop remote networking service if executed. Always, use restart option over ssh session.

The start and stop option

To start or stop service:
$ sudo /etc/init.d/networking start
$ sudo /etc/init.d/networking stop

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.