How To Restart Network Services In Linux : Using Systemctl Restart Command

When network connectivity drops, restarting network services in Linux often resolves the issue faster than rebooting. Learning how to restart network services in linux is a core skill for anyone managing a Linux server or desktop. This guide walks you through every method, from simple commands to systemd and NetworkManager tools.

You don’t need to be a sysadmin to fix network problems. A quick restart of the network service can clear glitches, renew IP addresses, and restore connections. Let’s start with the basics and move to advanced techniques.

Why Restart Network Services Instead Of Rebooting

Rebooting takes time and disrupts running processes. Restarting network services is faster and less intrusive. It reloads network configurations, flushes DNS caches, and re-establishes connections without affecting other services.

Common scenarios where a restart helps:

  • Lost internet after a configuration change
  • DHCP lease renewal issues
  • DNS resolution failures
  • Interface not coming up after sleep or hibernate
  • Network driver or module problems

How To Restart Network Services In Linux

This is the central method you’ll use most often. The exact command depends on your Linux distribution and init system. Modern distros use systemd, while older ones rely on SysVinit or Upstart.

Using Systemd (Most Modern Distros)

Systemd is the default for Ubuntu 16.04+, CentOS 7+, Debian 8+, and Fedora. The command is:

sudo systemctl restart NetworkManager

If your system uses the older networking service instead:

sudo systemctl restart networking

Check the status after restart:

sudo systemctl status NetworkManager

This shows if the service is active, enabled, and error-free.

Using SysVinit (Older Distros)

For CentOS 6, Debian 7, or older Ubuntu versions:

sudo /etc/init.d/networking restart

Or use the service command:

sudo service networking restart

These commands are deprecated but still work on legacy systems.

Using NetworkManager CLI (Nmcli)

NetworkManager provides a command-line tool for granular control. To restart the entire network manager:

sudo nmcli networking off
sudo nmcli networking on

To restart a specific connection:

sudo nmcli connection down "Your Connection Name"
sudo nmcli connection up "Your Connection Name"

List all connections with nmcli connection show.

Restarting Network Interfaces Individually

Sometimes you only need to reset a single interface, not the entire service. This is useful when troubleshooting a specific port.

Using Ifdown And Ifup

Bring an interface down and up:

sudo ifdown eth0
sudo ifup eth0

Replace eth0 with your interface name. Check interfaces with ip link show or ifconfig -a.

Using Ip Command

The modern ip command replaces ifconfig. To restart an interface:

sudo ip link set eth0 down
sudo ip link set eth0 up

This method is faster and works on all modern distros.

Using Nmcli For Specific Interfaces

NetworkManager can also toggle interfaces:

sudo nmcli device disconnect eth0
sudo nmcli device connect eth0

Use nmcli device status to see all devices.

Restarting DNS Services

DNS issues often mimic network problems. Restarting DNS services can resolve them without touching the main network service.

Restart Systemd-Resolved

Many modern distros use systemd-resolved:

sudo systemctl restart systemd-resolved

Check its status:

sudo systemctl status systemd-resolved

Restart Dnsmasq

If you use dnsmasq for local DNS caching:

sudo systemctl restart dnsmasq

Or for older systems:

sudo service dnsmasq restart

Flush DNS Cache

Sometimes you just need to clear the cache. For systemd-resolved:

sudo resolvectl flush-caches

For dnsmasq, restarting the service flushes the cache automatically.

Restarting Network Services On Specific Distros

Different distributions have slightly different commands. Here’s a breakdown by popular distro.

Ubuntu And Debian

Ubuntu 18.04+ and Debian 9+ use systemd:

sudo systemctl restart NetworkManager

For older versions:

sudo service networking restart

If you use netplan (Ubuntu 18.04+), apply changes without restart:

sudo netplan apply

CentOS, RHEL, And Fedora

CentOS 7+ and RHEL 7+ use systemd:

sudo systemctl restart NetworkManager

For CentOS 6 and RHEL 6:

sudo service network restart

Fedora uses NetworkManager by default, same command as above.

Arch Linux

Arch uses systemd with NetworkManager or netctl:

sudo systemctl restart NetworkManager

If using netctl:

sudo netctl restart your-profile-name

OpenSUSE

OpenSUSE uses wicked or NetworkManager:

sudo systemctl restart wicked

Or for NetworkManager:

sudo systemctl restart NetworkManager

Automating Network Service Restarts

If you frequently need to restart network services, automate it with a script or cron job.

Simple Bash Script

Create a script called restart-network.sh:

#!/bin/bash
sudo systemctl restart NetworkManager
sudo systemctl restart systemd-resolved
echo "Network services restarted"

Make it executable:

chmod +x restart-network.sh

Run it with ./restart-network.sh.

Cron Job For Scheduled Restarts

To restart network services daily at 3 AM:

sudo crontab -e

Add this line:

0 3 * * * /usr/bin/systemctl restart NetworkManager

Use with caution – scheduled restarts can disrupt active connections.

Systemd Timer Unit

For more control, create a systemd timer. First, a service file:

/etc/systemd/system/restart-network.service

Content:

[Unit]
Description=Restart NetworkManager

[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl restart NetworkManager

Then a timer file:

/etc/systemd/system/restart-network.timer

Content:

[Unit]
Description=Restart NetworkManager daily

[Timer]
OnCalendar=daily
Persistent=true

[Install]
WantedBy=timers.target

Enable and start the timer:

sudo systemctl enable restart-network.timer
sudo systemctl start restart-network.timer

Troubleshooting Common Network Restart Issues

Sometimes restarting network services fails. Here’s how to diagnose and fix common problems.

Service Not Found Or Not Installed

If you get “Failed to restart NetworkManager.service: Unit not found”, the service might not be installed. Check available services:

systemctl list-units --type=service | grep network

Install NetworkManager if missing:

sudo apt install network-manager   # Debian/Ubuntu
sudo yum install NetworkManager    # CentOS/RHEL

Permission Denied

You need root privileges. Always use sudo or run as root. If you get permission errors, check sudoers configuration.

Interface Not Coming Up After Restart

If an interface stays down after restart, check:

  • Physical connection (cable, Wi-Fi switch)
  • Driver issues (lspci -k for PCI devices)
  • Configuration files in /etc/network/interfaces or /etc/netplan/

Use dmesg | grep network to see kernel messages.

NetworkManager Conflicts With Other Services

If you have multiple network managers (e.g., systemd-networkd and NetworkManager), they can conflict. Disable one:

sudo systemctl stop systemd-networkd
sudo systemctl disable systemd-networkd

DNS Not Working After Restart

If internet works but DNS fails, restart the DNS resolver:

sudo systemctl restart systemd-resolved

Check /etc/resolv.conf – it should point to 127.0.0.53 for systemd-resolved.

Best Practices For Network Service Management

Follow these tips to avoid unnecessary restarts and keep your network stable.

  • Always backup configuration files before making changes
  • Use nmcli or netplan apply instead of full restarts when possible
  • Monitor network logs with journalctl -u NetworkManager
  • Test connectivity after restart with ping 8.8.8.8 and ping google.com
  • Document any custom network configurations for quick reference

Advanced: Restarting Network Services Without Downtime

For production servers, you want minimal disruption. Here are techniques to restart network services gracefully.

Using Nmcli Connection Reload

Reload all connections without restarting the service:

sudo nmcli connection reload

This applies changes without dropping existing connections.

Using Systemctl Reload

Some services support reload instead of restart:

sudo systemctl reload NetworkManager

This reloads configuration without interrupting active connections.

Rolling Restart With Multiple Interfaces

If you have multiple network interfaces, restart them one at a time:

sudo ifdown eth0
sudo ifup eth0
sudo ifdown eth1
sudo ifup eth1

This keeps at least one interface active during the process.

Frequently Asked Questions

What Is The Command To Restart Network Services In Linux?

The most common command is sudo systemctl restart NetworkManager for modern distros. For older systems, use sudo service networking restart.

How Do I Restart Network Services Without Root?

You cannot restart network services without root privileges. However, you can use sudo with a password or configure sudoers to allow specific users.

Will Restarting Network Services Disconnect My SSH Session?

Yes, if you restart the network service on the interface your SSH session uses. Use a local console or schedule the restart during maintenance windows.

How Often Should I Restart Network Services?

Only when troubleshooting or after configuration changes. Regular restarts are not needed and can cause unnecessary downtime.

What Is The Difference Between Restarting NetworkManager And Networking Service?

NetworkManager is a dynamic network manager that handles connections automatically. The networking service is a legacy init script that manages static interfaces defined in /etc/network/interfaces.

Conclusion

Knowing how to restart network services in linux saves time and frustration. Whether you use systemd, SysVinit, or NetworkManager, the commands are straightforward. Start with sudo systemctl restart NetworkManager on modern distros, and use nmcli for granular control. Always check logs and test connectivity after a restart. With these skills, you can fix most network issues in minutes without rebooting.

Remember to choose the method that fits your distribution and scenario. For production servers, prefer reloads or rolling restarts to minimize downtime. Practice these commands on a test system first to build confidence. Your network will thank you.