Restarting the network of your AlmaLinux system can be a useful troubleshooting step, for example if you're having problems connecting to the internet.

In this guide, we'll show several methods for restarting the network on AlmaLinux, both from command line and GUI. You can apply these steps if you've recently migrated from CentOS to AlmaLinux or have performed a fresh AlmaLinux installation.

In this tutorial you will learn:
  • How to restart the network in AlmaLinux via command line, through both NetworkManager and networkd
  • How to restart the network in AlmaLinux through GNOME GUI
Restarting network in AlmaLinux
Restarting network in AlmaLinux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System AlmaLinux
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user

How to restart network via command line


SUBSCRIBE NEWSLETTER & RSS
Subscribe to RSS and NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.


To turn networking completely off and back on in AlmaLinux, we can use the following NetworkManager commands, which effectively restart the network for the operating system.

# nmcli networking off
# nmcli networking on

We can also turn individual network interfaces off and back on. To see your currently configured interfaces, use the ip a command.

$ ip a
...
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:14:b7:83 brd ff:ff:ff:ff:ff:ff
    inet 192.168.137.132/24 brd 192.168.137.255 scope global dynamic noprefixroute ens160
       valid_lft 1652sec preferred_lft 1652sec
    inet6 fe80::5f00:9be8:e9e7:afff/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

In our case, the interface we want to reset is ens160. The following commands will take the interface down and put it back up, effectively restarting it.

# ifdown ens160
Connection 'ens160' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5)


And then put it back up:

# ifup ens160
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)

One last way to reset a network interface in AlmaLinux is with the ip link commands, which work through networkd.

# sudo ip link set ens160 down
# sudo ip link set ens160 up

How to restart network via GUI

If you are running the default GNOME GUI on AlmaLinux, the simplest way to restart the network is to click on the top right settings area of the taskbar. Select your network interface you wish to reset, then click "Turn off."

Turn off the network connection
Turn off the network connection


Click again to turn it back on.

Turn the network connection back on
Turn the network connection back on

Closing Thoughts

In this guide, we saw how to restart the network on AlmaLinux through command line methods and GUI. Any of these methods are effective at restarting the network, and you can use whichever is most convenient for you. This can be a helpful step when troubleshooting a network interface or internet connection. Since your network interfaces may be managed by either NetworkManager or networkd, we've included all applicable instructions in this article.

FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.


Comments and Discussions