- How to Restart the Network on Ubuntu 22.04
- Method 1: Restarting the Network on Ubuntu 22.04 Using CLI
- Method 1.1: Using nmcli Command
- Method 1.2: Using the Network Manager Service
- Method 2: Restarting Network on Ubuntu 22.04 Using GUI
- Conclusion
- How do I reset the network adapter using a terminal command?
- 4 Answers 4
- How to restart Network Interface / Network Adapter on Linux & Windows Cloud Servers
- Restarting Network interface/adapter in Linux OS
- Ubuntu / Debian
- AlmaLinux
- Rocky Linux
- CentOS 8
- CentOS 7
- CentOS 6
- Windows OS
- Using the Enable/Disable mode of network adapter
- Using the netsh command
- Using the Network Reset option (Windows 10/11)
- Related Tutorials
How to Restart the Network on Ubuntu 22.04
In Linux distribution, the network manager is responsible for managing the network on your system. The latest release of Ubuntu 22.04 provides the facility to change or restart the network status with the help of the Command Line Interface or Graphical User Interface. Restarting the network helps in setting the connection and resolving network connection issues.
In this write-up, we will provide you with a deep insight into the methods to restart the network on Ubuntu 22.04. The outcomes are as follows:
Let’s dig into the CLI method first:
Method 1: Restarting the Network on Ubuntu 22.04 Using CLI
The CLI of Ubuntu 22.04 offers various commands to manage the network. This section enlists various commands that can be used to restart the network on Ubuntu 22.04.
Method 1.1: Using nmcli Command
The nmcli utility is used to control the network’s connections. Using the nmcli utility, users restart the network on Ubuntu 22.04. For this purpose, follow the given steps one by one.
Step 1: Check device status
First, check the network status, whether it is connected or not. For this purpose, run the following command:
The output shows that the network is connected.
Step 2: Turn off the Network
To turn off the network, run the following command:
$ sudo nmcli networking off
The successful execution of the command shows that the network is disabled now.
Step 3: Switch on the Network
Now, to reconnect the network, utilize the below script:
After this connection, the network’s active state will be restored.
Method 1.2: Using the Network Manager Service
The network manager service manages the network and connectivity settings on your device.
First, to check the network status on your device, use the below script:
$ systemctl status NetworkManager.service
The output showed that the network is in an active state.
To restart the network on Ubuntu 22.04, execute the below script in the terminal:
$ sudo systemctl restart NetworkManager.service
Upon successful execution, the network will take a quick restart.
Method 2: Restarting Network on Ubuntu 22.04 Using GUI
The Graphical-User-Interface is the utility that provides an easy and user-friendly interface to the user. You can graphically interact with Ubuntu 22.04 to restart the network using the following steps.
Step 1: Open the Network Menu
First, open the network menu and check the network status:
The wire is connected, and the network icon shows that the network is in an active state.
Step 2: Turn off Network
To turn off the network, click on “Wired Connected” and then click on the “Turn off” option:
It will disconnect the network of your device.
Step 3: Turn on Network
After turning off the network, choose the“Connect” button to turn on the network again:
It will connect to the network of your device.
Step 4: Check Network Status
Furthermore, the network restarts the process, and the user can check the network status of their device:
The output shows that the device is connected to the network.
Congratulations! You have learned the process for restarting the network on Ubuntu 22.04.
Conclusion
A user can restart the network on Ubuntu 22.04 with the help of the Command Line Interface or Graphical User Interface. Restarting the network refreshes the network connection quickly and resolves the errors, if any. This short blog illustrated the knowledge to restart the network on Ubuntu 22.04 using CLI and GUI. The CLI uses the nmcli utility and NetworkManager service while the GUI restarts the network graphically on Ubuntu 22.04.
TUTORIALS ON LINUX, PROGRAMMING & TECHNOLOGY
How do I reset the network adapter using a terminal command?
Well ,when I turn the Router off and then I turn it on again while running Ubuntu , it doesn’t obtain an IP address automatically : I click on disconnect , but it remains like above. It works only if I log out and switch to another session and then back the default one. So How do I reset the network adapter using a terminal command, or any another suggestions? Edit: I’ve tried using sudo dhclient , but it didn’t work.
Have you tried disabling/enabling the whole wireless networking through nm? (cannot remember if 11.04 has this feature, though).
Network Manager? It used to allow to disable Networking or Wireless Networking in the menu you obtain clicking on its icon.
4 Answers 4
If you really want to reset the network adapter you usually need to unload and reload the kernel module that it uses.
If you just want to reconfigure it you can usually do:
sudo /etc/init.d/network-manager restart
But if you just want a new dhcp lease (that’s the technical name for obtain a new IP from the router), you just need to use:
@Binarylife yes, that should get you a new IP address. If it doesnt, the router’s DHCP may be at fault, and not your wifi card.
IMHO this answer will not work, as both mentioned commands refer to listed devices in /etc/network/interfaces. In a normal Ubuntu install, only ‘loopback’ is listed there.
This sound like a network-manager problem to me.
I would try the following: (in a gnome-terminal)
- ‘Softblock’ your wireless device with rfkill block wifi
- rfkill list will show you if you were successful.
- killall nm-applet You kill the network-manager process (panel icon will be gone).
- rfkill unblock wifi Enable wifi again.
- nm-applet Load a new network-manager session.
Maybe simply killing/loading nm-applet will do. Also note, that you don’t need to use ‘sudo’ for this.
I do know that some router and wifi devices do not ‘like’ each other very well. This is often a problem of a somehow ‘beta’ wifi linux-driver.
nmcli radio wifi off nmcli radio wifi on
I wrote a script to try various methods to reset the wifi when it dropped the connection or was otherwise non-responsive (it is called every 2 minutes in a cron):
#!/bin/sh # program to check wifi and reset if not running IPTEST=192.168.1.1 iwconfig=/sbin/iwconfig rfkill=/usr/sbin/rfkill DEVICE=`$iwconfig | egrep 802 | awk ' '` if ping -c 1 $IPTEST >/dev/null 2>&1 ; then #echo $IPTEST ok exit 0 else # Failed, try to reset wifi - sometimes works ok ( date echo "Apagando wifi. " nmcli nm wifi off sleep 3 echo Iniciando wifi. nmcli nm wifi on sleep 10 if ping -c 1 $IPTEST >/dev/null 2>&1 ; then #echo $IPTEST ok exit 0 else # try another way echo "Apagando wifi $iwconfig . " $iwconfig $iwconfig $DEVICE txpower off sleep 3 echo Iniciando wifi. $iwconfig $DEVICE txpower auto fi sleep 10 if ping -c 1 $IPTEST >/dev/null 2>&1 ; then #echo $IPTEST ok exit 0 else # try another way echo "Apagando wifi $rfkill . " $rfkill list $rfkill block wifi sleep 3 echo Iniciando wifi. $rfkill unblock wifi fi #echo Cerrar esta ventana cuando sale el estado #sleep 3 #iftop -i $DEVICE ) >> $HOME/wificheck.log 2>&1 fi exit 0
How to restart Network Interface / Network Adapter on Linux & Windows Cloud Servers
Once you make changes in the server network configuration file, then require to restart the server networking service in order to reflect the changes.
This guide will describe the steps to restart the network interface or network adapter in the Linux and Windows servers.
Restarting Network interface/adapter in Linux OS
Ubuntu / Debian
- Use the following command to restart the server networking service.
# sudo /etc/init.d/networking restart or # sudo /etc/init.d/networking stop # sudo /etc/init.d/networking start else # sudo systemctl restart networking
Once this is done, use the following command to check the server network status.
# sudo /etc/init.d/networking status or # sudo systemctl status networking
Ubuntu 17.10 and higher versions use NetPlan as the default network management tool and its configuration files are written in YAML syntax with a .yaml file extension .
Run the below command to update networking and then any changes that have been made to the network will take effect:
AlmaLinux
- Use the following command to restart the server networking service.
# nmcli networking off # nmcli networking on or # systemctl restart NetworkManager
Once this is done, use the following command to check the server network status.
# nmcli -o or # systemctl status NetworkManager
Rocky Linux
- Use the following command to restart the server networking service.
# nmcli networking off # nmcli networking on or # systemctl restart NetworkManager
Either of the below commands can be executed to check the status of the networking service.
# nmcli -o or # systemctl status NetworkManager
CentOS 8
- Use the following command to restart the server networking service.
# nmcli networking off # nmcli networking on or # systemctl restart NetworkManager.service
Either of the below commands can be executed to check the status of the networking service.
# systemctl status NetworkManager.service or # nmcli -o
CentOS 7
- Use the following command to restart the server networking service.
# systemctl restart network.service or # service network restart or # /etc/init.d/network restart
The status of the networking service can be checked by making use of any of the below commands.
# systemctl status network.service or # service network status or # /etc/init.d/network status
CentOS 6
- Use the following command to restart the server networking service.
# service network restart or # /etc/init.d/network restart
Once this is done, use the following command to check the server network status.
# service network status or # /etc/init.d/network status
Windows OS
Using the Enable/Disable mode of network adapter
- Click on the Windows key to open start and search Settings and go to the Network and Internet then click on Change adapter option which is shown in the below image. Then will get the below page:
- Right-click the Ethernet device and click on Disable option.
- Again, Right-click the Ethernet device and click on enable option.
- Once this is done, Right-click the Ethernet device and click on status .
Using the netsh command
In Windows OS, the command line method involves using the netsh command for resetting the network and TCP/IP stack.
- Go to Start and type CMD in the search window.
- Once opened the Command Prompt , the command for restarting the network interface, as provided below, can be executed.
The output will be as follows:
Using the Network Reset option (Windows 10/11)
The reset button method can be used in Windows 10 & 11 versions by which the user can restart the Network interface. The steps for this are given below.
- Click on Windows Start Menu button and then select Settings .
- From the Settings option, select Network & Internet option.
- Here you would be able to see the adapter options i.e Advanced Network Settings , from which you can click on Network Reset option.
- Click on the Reset Now button on the right side of Network reset option and you will be prompted for the confirmation. Choose Yes for proceeding with resetting the network settings.
Once clicked on Yes , the network adapter will start to reset and you will be able to restart the network interface.