Ubuntu Linux Restart Network Service

Posted on in Categories , , last updated April 24, 2014

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: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

14 comment

  1. Ok, that works. But my network is not automatically started on reboot. I have to do it manually every time. How do I start it automatically every time I boot in the system.

  2. I get the following message:

    * Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces

    Is there any alternative to do the same remotely ?

Leave a Comment