4 ways To Restart Network in Ubuntu

Restoring a dropped connection or applying a new configuration is a routine task for any Linux user. You might find yourself needing to restart the network after a change to your IP address, or perhaps your server has become unreachable due to a DNS hang or an IP conflict. Without a reliable way to reset the stack, your system remains isolated from critical updates and remote management tools.

Modern Ubuntu versions use Netplan and NetworkManager to handle connectivity, providing several ways to refresh your network state without rebooting the entire machine. This guide explains four practical methods to restart your networking services using built-in terminal commands. Whether you are troubleshooting a local workstation or a remote cloud instance, these tools deliver accurate results. Master these approaches to maintain effective control over your Linux network configuration.

Key Takeaways: How to Restart Network in Ubuntu

  • Netplan apply → The standard method for persistent configuration changes. It parses YAML files and instructs the backend to refresh settings.
  • systemctl command → Used to restart the underlying network daemons like NetworkManager or systemd-networkd.
  • nmcli utility → The best tool for Desktop and dynamic environments, allowing you to toggle the entire networking stack off and on.
  • ip link command → A low-level tool for manually resetting a specific hardware interface (like eth0).
  • Remote Access Warning → Be extremely careful when restarting networks over SSH, as incorrect settings can permanently lock you out of the server.

Method 1: The Ubuntu Standard (Netplan)

Since Ubuntu 18.04, Netplan has been the default way to manage network settings via YAML files. It is the most reliable way to apply changes permanently.

Run this command to apply all pending configurations: sudo netplan apply

If you are unsure of your configuration, you should verify which interface needs attention. You can also run sudo netplan generate to check for syntax errors before applying.

Method 2: Using NetworkManager (Desktop/Standard)

Most Ubuntu systems use NetworkManager as the backend renderer. Restarting the service itself is a powerful way to clear temporary glitches.

Execute this command to reset the daemon: sudo systemctl restart NetworkManager

Expected Output: The terminal will return to the prompt without a message if successful. You can verify the status by running systemctl status NetworkManager, which should show the service as active (running).

Method 3: Toggling with nmcli

The nmcli (Network Manager Command Line Interface) allows you to shut down and bring back the entire networking stack in two quick steps. This is often faster than a full service restart.

Use this sequence to toggle connectivity: sudo nmcli networking off sudo nmcli networking on

See also: Mastering the Linux Command Line — Your Complete Free Training Guide

This method is highly effective for refreshing DHCP leases and resolving Wi-Fi connection issues. For more advanced tasks, refer to our ultimate nmcli cheat sheet.

Method 4: Manual Hardware Reset (ip command)

If only one specific interface is failing, you can reset just that device using the ip command. This avoids disrupting other active connections.

Run these commands for a hard toggle: sudo ip link set dev eth0 down sudo ip link set dev eth0 up

Replace eth0 with your actual device name (e.g., enp0s3). This manually tells the kernel to disable and then re-enable the network link, which is vital if the hardware has stopped responding.


Step-by-Step Process: Troubleshooting a Failed Connection

  1. Open your terminal and identify your interface name using ip addr.
  2. Verify your identity using the sudo command to ensure you have administrative rights.
  3. Attempt sudo netplan apply to ensure your configuration files are properly loaded.
  4. Run sudo nmcli networking off followed by on to refresh all links.
  5. Check the logs using sudo journalctl -u NetworkManager if the connection fails to come back up.
  6. Confirm the status by pinging a reliable IP like 8.8.8.8.

Summary Tables

GoalRecommended CommandBest For…
Apply New Configsudo netplan applyServers and persistent changes.
Reset All Stacksudo systemctl restart NetworkManagerClearing daemon-level glitches.
Refresh Connectionsnmcli networking off && nmcli networking onFixing Wi-Fi or DHCP issues.
Fix Specific Cardsudo ip link set <dev> down/upTargeted hardware resets.
Verify Connectivityping -c 3 8.8.8.8Final verification of the fix.
Configuration ToolRoleBackend Used
NetplanConfiguration AbstractorNetworkManager or networkd.
NetworkManagerDynamic Link ManagerIdeal for Desktop/Laptops.
systemd-networkdStatic Link ManagerIdeal for Servers/Containers.

FAQs

Will restarting the network disconnect my SSH session? Yes, in most cases, restarting the network will temporarily drop your SSH connection. If you use netplan apply, the system attempts to re-establish the link instantly, but if there is a config error, you will be locked out.

What is the difference between restart and reload? restart stops and starts the service from scratch, which is more thorough. reload only re-reads the configuration files without killing the background process.

Why is ifconfig missing in Ubuntu? Ubuntu has deprecated legacy tools in favor of the iproute2 suite. You should now use the ip command for all interface management tasks.


Related Posts

David Cao
David Cao

David is a Cloud & DevOps Enthusiast. He has years of experience as a Linux engineer. He had working experience in AMD, EMC. He likes Linux, Python, bash, and more. He is a technical blogger and a Software Engineer. He enjoys sharing his learning and contributing to open-source.

Articles: 632

Leave a Reply

Your email address will not be published. Required fields are marked *