How to Restart Network on Ubuntu 20.04
In Linux, the Network is the backbone that enables communication between devices and the internet. Restarting the network on Ubuntu 20.04 is crucial for troubleshooting network issues or applying new configurations. This process involves refreshing network services and interfaces to ensure smooth connectivity. There are multiple methods to achieve this, including using systemctl to restart networking.service, using ifdown and ifup commands to bring down and bring up specific network interfaces, or utilizing nmcli to restart its service. Each method offers flexibility based on the user’s requirements and network setup.
How to Restart Network on Ubuntu 20.04
In this section, we will explore three different methods to restart the network on Ubuntu 20.04. Below we have listed both possible methods.
Ways to Restart Network on Ubuntu 20.04
- Using systemctl to Restart Network on Ubuntu 20.04
- Using ifdown and ifup commands to Restart Network on Ubuntu 20.04
- Using nmcli to Restart Network on Ubuntu 20.04
Using systemctl to Restart Network on Ubuntu 20.04
Step 1: Open a Terminal Window
To begin, open a terminal window on your Ubuntu 20.04 system. You can do this by searching for “Terminal” in the application menu or using the keyboard shortcut Ctrl + Alt + T.
Step 2: Restart the Network Service
sudo systemctl restart NetworkManager.service
- sudo: This command is used to run subsequent commands with superuser privileges, which are necessary for restarting system services.
- systemctl: This is the systemd command-line tool used to manage system services.
- restart: This option tells systemctl to restart the specified service.
- NetworkManager.service: This is the name of the service responsible for managing network configurations and interfaces on Ubuntu.
Step 3: Verify Restart Status
To verify that the network service has been restarted successfully, you can check the status of the networking.service by running the following command:
sudo systemctl status NetworkManager.service
This command will display information about the current status of the networking service, including whether it is active (running) or inactive (stopped).
Using ifdown and ifup commands to Restart Network on Ubuntu 20.04
Step 1: Install ifupdown Package
Use the below command to install the ifupdown package in the Ubuntu as it doesn’t come by default with Ubuntu
sudo apt install ifupdown -y
Step 2: Bring down the network interfaces using ifdown
Now, by using the below command, we will bring down all the network interfaces using ifdown. Execute the below command in the terminal.
sudo ifdown -a
Step 3: Bring up the network interface using ifup
After bringing down the interfaces, we can bring it back up using the ifup command. Execute the below command to bring up the network interfaces using ifup.
sudo ifup -a
Using nmcli to Restart Network on Ubuntu 20.04
Step 1: Turn off networking using nmcli
To turn off networking, use the nmcli command:
sudo nmcli networking off
This command instructs NetworkManager to disable all networking interfaces, effectively disconnecting your system from the network.
Step 2: Turn on networking using nmcli
After turning off networking, you can turn it back on using the following command:
sudo nmcli networking on
This command instructs NetworkManager to enable all networking interfaces, allowing your system to reconnect to the network and resume normal operations.
Frequently Asked Questions on Restarting Network on Ubuntu
What does restarting the network service do?
Restarting the network service reinitializes the networking configuration and settings, which can resolve network-related issues or apply new configurations.
Is it necessary to restart the entire system after restarting the network service?
No, it is not necessary to restart the entire system after restarting the network service. The changes will take effect immediately without requiring a system reboot.
Can I restart specific network interfaces instead of the entire network service?
Yes, you can restart specific network interfaces using the following command, replacing “interface_name” with the actual name of the interface (e.g., eth0, wlan0):
sudo ifdown interface_name && sudo ifup interface_name
Conclusion
In conclusion, restarting the network on Ubuntu 20.04 is important for troubleshooting and applying new configurations. This can be done using systemctl to restart NetworkManager.service, ifdown and ifup commands for specific interfaces, or NetworkManager for a more comprehensive approach. These methods offer flexibility and efficiency in managing network connectivity and resolving issues on Ubuntu systems.
Contact Us