There are several commands that can be used to reboot the network in CentOS depending on the version of CentOS. On CentOS 7 and older, the usual way is to run systemctl restart network or service network restart. On CentOS 8 and newer, where NetworkManager is used to manage networking, you will have to use systemctl restart NetworkManager or nmcli networking off && nmcli networking on. The network can be required to restart after changes in configuration such as IP addresses, DNS, or firewall changes.
How to Restart Network Services on CentOS
To restart the network services, you can choose one of the methods identified in this tutorial. These methods are listed below.
Method 1: The “nmcli” command
‘nmcli’ command line is provided for network status monitoring and manager access. To restart network services on CentOS, perform the following instructions.
- Step 1: First, click on the ‘Activities’ tab to open it. Then, a search bar will appear on the screen.
- Step 2: In the search bar, search Terminal and open it. (Note: You can also open Terminal on your CentOS system using ‘Ctrl+Alt+T’ keyboard shortcut.)
- Step 3: After showing the terminal, run the following command to stop the network service:
$ sudo nmcli off networking
After running the ‘nmcli’ command, the networking service will quickly stop and you will have control of the terminal with no output.
- Step 4: Now, to restart the network services on CentOS, you need to enable the networking services again. To do this, run the following command in the terminal:
$ sudo nmcli networking is on
Now, the network service will start, and you will have control of the terminal again while no output is displayed. You have successfully restarted the networking service on CentOS using ‘nmcli’ command by stopping and restarting the networking service.
Method 2: Network Manager Utility
What are the benefits of a Network Manager? It is network management software that makes it easy to use computer networks.
You can use this software utility to restart network in CentOS. The following steps will show you how to do so:
- Step 1: Open Terminal using the keyboard shortcut ‘Ctrl+Alt+T’ or search the word ‘Terminal’ in the search box.
- Step 2: Run the following command in the Terminal:
$ sudo systemctl start NetworkManager.service
Now your system will start the networking system quickly, and you will have control of the terminal again without any output.
- Step 3: In this step, run the below command in the terminal to stop the networking service:
$ sudo systemctl stop NetworkManager.servi
Again, your system’s network services will be shut down immediately, control of the terminal will be given to you, and no output will be displayed.
- Step 4: The following command will help you restart the networking service using the Network Manager utility:
$ sudo systemctl restart NetworkManager.service
The networking service will restart, and you will regain control of the terminal.
Do you want to check if your networking service has restarted? Run this command in the terminal:
$ sudo systemctl status NetworkManager.service
“Active (Running)” will appear on your screen when the Network Manager utility has successfully restarted your networking service. So, check it after running the command shown above.
Method 3: The systemctl command
To configure your network settings, the ‘nmcli’ command can help. After the network configuration is done you can use the ‘systemctl’ command to restart the network manager service.
# systemctl restart NetworkManager
This command should update your network, although this command will not affect the interface configuration if NetworkManager is not managing your network.
Method 4: ifup and ifdown commands
If you are using an SSH connection, use the ‘ifup’ and ‘ifdown’ commands with caution as these two commands can destroy the active SSH interface and lock you out of the system. Connecting to your server through the console can restore network access by running this command.
You can use these two commands on CentOS with or without a network manager.
With NetworkManager
Unlike older releases where the ifup and ifdown commands were part of the initscripts rpm, CentOS 8 includes both commands as part of the network manager.
# rpm -qf 'which ifup' NetworkManager-1.20.0-3.el8.x86_64
It is possible to use the ifup and ifdown commands to refresh your network configuration. For example, you have changed something on eth1; Bringing the interface down and bringing it up will refresh the changes you’ve made.
# ifdown eth1 && ifup eth1
In this format, the command must be executed because executing separately would make the server unreachable. This will update your system’s network configuration.
Without NetworkManager
To use the ifup and ifdown directives, install network-script if NetworkManager does not manage your network interface. To install it, use following command:
# dnf -y install network-scripts
Now you can check the ownership of rpm for ifup using the following command:
# rpm -qf 'which ifup' NetworkManager-1.20.0-3.el8.x86_64 network-scripts-10.00.4-1.el8.x86_64
At this point, ifup is part of NetworkManager and network-scripts rpm, and you can use the following command
# ifdown eth1 && ifup eth1
Some WARN syntax will be shown for the ifup and ifdown actions like this:
Warning: [ifdown] You are using the 'ifdown' script provided by 'network-scripts', which is now deprecated. Warning: [ifdown] 'network-scripts' will be removed in one of the next major releases of RHEL. Warning: [ifdown] It is advised to switch to 'NetworkManager' instead - it provides 'ifup/ifdown' scripts as well.
When you use ifup or ifdown without NetworkManager, it gives a warning because the network script only supports fallback behavior.
Method 5: nmtui command
If you cannot use the nmcli command and are uncomfortable with it, the ‘nmtui’ command is available to manage your network. It is possible to disable and enable your network interface by entering nmtui command in terminal as root user:
# nmtui
Now, a window will appear on your screen. To update network configuration, select “Enable a connection”. You can disable and re-enable an interface by selecting.
Note: If you disable an active interface, your SSH connection will be lost. If you want to restart networking for your primary interface, you must use nmtui from the graphical console. This is regardless of whether you’re connected to the network via SSH.
You can close the nmtui session if your interface is enabled.
Conclusion
CentOS provides a “restart network” command to restart individual network cards. This tutorial covers how to restart network services for all CentOS distributions with different methods and examples. “Restart Network” in CentOS has a proper uncut concept, explanation, examples and alternative commands. You can expect network-script support to drop soon, so you should start switching to network manager. By default, we use systemctl command to automatically restart the network. This is because it is required by request. Additionally, we need to learn another restart method instead of systemctl. Let’s end by wishing you the best for restarting the CentOS Linux network.



