Full Version: Networking restart is deprecated in debian
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
If you are trying to restart the network daemon, the following code will do that without deprecating it in Debian.

# invoke-rc.d networking restart


[email protected]:~# invoke-rc.d networking restart
Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces ... (warning).
Reconfiguring network interfaces...
Not really, invoke-rc.d is just a wrapper that points to the init scripts and checks sysv init policy to make sure that the action is allowed. They are doing the same thing.

The part that is deprecated is using the init script to restart or force-reload, for example:

with the following in your /etc/network/interfaces:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp

running either /etc/init.d/networking restart or invoke-rc.d networking restart would run:

# ifdown -a
# ifup -a

The problem is that ifdown -a will bring down all network interfaces, whereas ifup -a will only bring up any network devices in /etc/network/interfaces that are set to auto, anything with allow-hotplug won't be bought back up until it detects a hotplug event, usually when a network cable is plugged in.

In the example interfaces file above this means that the loopback device will come back up every time, but eth0 won't.

To reliably restart a network interface you can use the following:

# ifdown eth0 && ifup eth0

This will bring the interface down and, once the ifdown command has completed successfully, bring it back up again.
Reference URL's