Linux Network Services

How to restart network services in Linux?

Restart network services in Linux with systemctl, nmcli, netplan or ifupdown, and check the result. Includes safety steps so you don't lose remote access.

On this page
  1. Find what manages your network
  2. Restart NetworkManager
  3. Restart systemd-networkd
  4. Apply Netplan changes safely
  5. Restart ifupdown networking
  6. Restart DNS resolution alone
  7. Bounce one interface
  8. Check that it worked
  9. Check the logs if it still fails
  10. Stay connected while you work
  11. Summary

A network problem can come from a stuck connection manager, a broken DNS resolver, or a settings change that has not been applied yet. Restarting the right service often clears the problem without a reboot. The correct command depends on what manages your network, so identify that first.

Find what manages your network

Check which network services are active:

systemctl is-active NetworkManager systemd-networkd

If Netplan is in use, its configuration lives in /etc/netplan/. On older Debian-style systems that use ifupdown, settings are in /etc/network/interfaces. Use the section that matches the tool you find.

Restart NetworkManager

sudo systemctl restart NetworkManager

This restarts the whole service. To cycle a single connection instead, list the connection names first, then bring the connection down and back up:

nmcli connection show
sudo nmcli connection down "Wired connection 1"
sudo nmcli connection up "Wired connection 1"

Replace the name with one from the list. A Wi-Fi connection will drop and need to reconnect.

Restart systemd-networkd

sudo systemctl restart systemd-networkd

Use this when systemd-networkd manages your interfaces, which is common on servers. If the restart does not fix the problem, check the configuration files in /etc/systemd/network/.

Apply Netplan changes safely

On Ubuntu and other Netplan systems, changes are applied with netplan rather than by restarting a service. After you edit a file in /etc/netplan/, test the change first:

sudo netplan try

netplan try applies the new configuration and rolls it back if you do not confirm it within the timeout. That protects you if the change cuts off your remote session. When the connection still works, make the change permanent:

sudo netplan apply

Restart ifupdown networking

On Debian-style systems that use ifupdown, the networking service sets up the interfaces:

sudo systemctl restart networking

Restarting it reconfigures the interfaces, so expect a short outage.

Restart DNS resolution alone

If websites will not load by name but a plain IP test works, the problem may be name resolution rather than the connection. Test an IP address first:

ping -c 4 1.1.1.1

If that works, restart only the resolver on systems that use systemd-resolved:

sudo systemctl restart systemd-resolved

Bounce one interface

To reset a single interface quickly, find its name with ip link show, then:

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

Replace eth0 with your interface name, such as enp3s0 or wlan0. Changes made with ip do not survive a reboot, and your saved configuration will apply again.

Check that it worked

Test in order, from the local machine outward:

ip addr show
ping -c 4 1.1.1.1
ping -c 4 example.com

If the IP address test passes but the name test fails, look at DNS. If both fail, check the default gateway, the cable, or the Wi-Fi link.

Check the logs if it still fails

journalctl -u NetworkManager -b

The -b option limits the output to the current boot. Replace NetworkManager with systemd-networkd or the service you restarted.

Stay connected while you work

Restarting the network on a remote machine can disconnect your SSH session, and you may not be able to get back in. Before you start, make sure you have console access, either through your hosting provider or on site. If you use Netplan, netplan try gives you an automatic rollback. On production servers, schedule the change for a time when a short outage is acceptable.

Summary

  • NetworkManager: sudo systemctl restart NetworkManager, or nmcli connection down and up for one connection
  • systemd-networkd: sudo systemctl restart systemd-networkd
  • Netplan: sudo netplan try, then sudo netplan apply
  • ifupdown: sudo systemctl restart networking
  • DNS only: sudo systemctl restart systemd-resolved

The complete guide to linux network services

Internet and Network Services in Linux Explained
Read the guide

Keep exploring

Guides from other topics

All topics →