How to Restart the Network in Ubuntu

How to Restart the Network in Ubuntu

Using Ubuntu and need to restart your network? It’s a common task that might sound technical, but it’s simpler than you might think. This guide will walk you through the steps, making it easy for anyone to follow along, regardless of how tech-savvy they might be.

Using the Network Manager

Restarting the network using the Network Manager is a common method in modern Ubuntu systems. Here’s the steps below:

1.  Open the Terminal.  Press Ctrl + Alt + T together. This shortcut will open the Terminal.

2.  Check Network Status (Optional).  Before restarting, you can check the current status of your network with the following command.

nmcli general status

Sample Output:

Snapshot of a terminal window showing the output of the 'nmcli general status' command. The output provides details about the current state of the network.

3. Restart the Network Manager. To restart the network, use the following command below.

sudo systemctl restart NetworkManager

Enter your password when prompted. This command will restart the Network Manager service, which manages network connections on Ubuntu.

4. Verify the Restart. To ensure that the network has been restarted, you can check its status again.

nmcli general status

5. Close the Terminal. Once you’ve confirmed the network restart, you can close the Terminal.

Using ifup/ifdown Command

This is less common in newer versions of Ubuntu, but it is still available. Here are the steps below:

1. Open the Terminal. Press Ctrl + Alt + T to quickly open the terminal.

2. Identify Your Network Interface. To know which interface you wish to restart, list all available ones. Use this command.

ip a

This command displays all your network interfaces. Wired connections usually appear as ethX (like eth0) and wireless connections might look like wlpXsY (like wlp2s0).

Sample Output:

Screenshot of a terminal window displaying the output of the 'ip a' command. The output lists network interfaces with their respective IP addresses.

3. Restart the Network Interface. First, bring the network interface down with the ifdown command.

sudo ifdown eth0

Then, immediately bring it back up using the ifup command.

sudo ifup eth0

4. Verify the Restart. After restarting the interface, it’s wise to verify its status to ensure it’s operational. Use the ip a command again or ping a known address to test the connectivity.

ping -c 4 google.com

Please note.  Be cautious using ifup and ifdown if you’re connected to the machine remotely. Restarting the network interface can sever your connection. These commands work in conjunction with the /etc/network/interfaces configuration file. If an interface isn’t defined there, the commands might not have the desired effect.

5. Close the Terminal. After ensuring everything is working correctly, you can close the terminal by typing exit or simply closing the window.

That’s it, congratulations on expanding your Ubuntu expertise! Whether for troubleshooting or routine maintenance, you’re now better equipped to handle networking challenges. Learning the nuances of network management in Ubuntu can greatly enhance your skills as a user or administrator. By successfully navigating how to restart the network, you’ve taken an essential step in ensuring smoother system operations.

Conclusion

Want to run Ubuntu in a virtual environment? With Gcore Cloud, you can choose from Basic VM, Virtual Instances, or VPS/VDS suitable for Ubuntu:

Choose an instance

How to Restart the Network in Ubuntu

Subscribe
to our newsletter

Get the latest industry trends, exclusive insights, and Gcore
updates delivered straight to your inbox.