How to Properly Restart Networking Service in Debian Jessie: Best Practices and Commands


2 views

Debian Jessie (8.x) uses a mix of traditional SysVinit and the newer systemd init system. This hybrid approach can cause confusion when managing services like networking. The networking service handles all network interfaces defined in /etc/network/interfaces.

Here are the common commands you might encounter:

# Traditional SysVinit style
service networking restart
/etc/init.d/networking restart
invoke-rc.d networking restart

# systemd style
systemctl restart networking.service

# Interface-specific approach
ifdown -a && ifup -a

Many administrators report SSH connection drops when using service networking restart. This happens because the command briefly brings down all network interfaces, including the one used for your SSH session.

For Debian Jessie, the safest method is:

systemctl restart networking.service

This properly handles the service dependencies and maintains better connection stability than the SysVinit commands.

If you only need to restart specific interfaces, use:

ifdown eth0 && ifup eth0

Replace eth0 with your actual interface name. This method is particularly useful when you don't want to affect other network connections.

If you lose connection after restarting networking, you can often recover by:

systemctl stop networking.service
systemctl start networking.service

This sequential approach sometimes works better than a single restart command.

  • Always test networking changes in a local console session first
  • Consider using screen or tmux when working remotely
  • Document which method works best for your specific hardware configuration

In Debian Jessie (8.x), networking service management underwent a transitional phase between traditional SysVinit and systemd. This creates multiple valid but subtly different approaches to restart networking, each with specific use cases and potential pitfalls.

Traditional SysVinit approach:

service networking restart
# or
/etc/init.d/networking restart

systemd-native method:

systemctl restart networking.service

Debian-specific alternatives:

invoke-rc.d networking restart
ifdown -a && ifup -a

The SSH disconnection issue occurs because these commands might:

  • Briefly drop all network interfaces
  • Not properly reinitialize interface dependencies
  • Cause race conditions with NetworkManager

For servers accessed via SSH, use this atomic approach:

nohup sh -c 'ifdown -a; ifup -a' >/dev/null 2>&1 &

Or for systemd systems with predictable interface names:

systemctl restart systemd-networkd.service

For targeted changes (e.g., modifying /etc/network/interfaces):

ifdown eth0 && ifup eth0
Scenario Recommended Command
Full network stack restart systemctl restart networking
Single interface config change ifdown/ifup
Legacy systems service networking restart
Remote administration nohup ifdown/ifup combo

Always check logs after restart attempts:

journalctl -u networking.service -b
# or for traditional systems:
tail -n 50 /var/log/syslog

Common issues include:

# Missing dependencies
ip link set dev eth0 up
# DHCP problems
dhclient -r eth0 && dhclient eth0