Although NetworkManager is the default tool for configuring and managing the network services on CentOS/RHEL 8, there are situations where it may be necessary to permanently disable NetworkManager, and use alternative methods to configure and manage the network. This document describes how to permanently disable NetworkManager on CentOS/RHEL 8.
Disabling NetworkManager in CentOS/RHEL 8
1. The following three commands are needed to stop immediately the NetworkManager service and prevent it being restarted subsequently during this session and after rebooting:
# systemctl mask NetworkManager.service # systemctl stop NetworkManager.service # systemctl disable NetworkManager.service
2. Confirm that he NetworkManager service has been disabled:
# systemctl list-unit-files | grep NetworkManager
3. If systemctl list-unit files shows output similar to the out below, then follow the next step:
# systemctl list-unit-files | grep NetworkManager
NetworkManager-dispatcher.service disabled
NetworkManager-wait-online.service enabled
NetworkManager.service disabled
4. If you see NetworkManager-wait-online.service enabled then disable the same as below:
# systemctl mask NetworkManager-wait-online.service # systemctl disable NetworkManager-wait-online.service
Re-check the status.
# systemctl list-unit-files | grep NetworkManager
Enabling network-scripts in CentOS/RHEL 8
Although network-scripts is disabled in CentOS/RHEL 8, some of you may still want the old way of configuring networking. You can still do it by installing the “network-scripts” package for that.
# yum install network-scripts
Once you have installed the above package, all the ifcfg configurations will now be managed by the network.service. You may get below warnings, on using the ifup/ifdown command:
# ifup ens4 WARN : [ifup] You are using 'ifup' script provided by 'network-scripts', which are now deprecated. WARN : [ifup] 'network-scripts' will be removed in one of the next major releases of RHEL. WARN : [ifup] It is advised to switch to 'NetworkManager' instead - it provides 'ifup/ifdown' scripts as well.
These warnings are harmless and can be ignored. You can also disable these warning by:
# touch /etc/sysconfig/disable-deprecation-warnings
You can start using network.service instead of NetwrokManager.service from here on. For examample:
# systemctl status network
You may also want to enable the network service to start after boot:
# systemctl enable network
Disabling NetworkManager in “network-scripts”
Add the below parameter in /etc/sysconfig/network-scripts/ifcfg-ethX of interfaces that are managed by NetworkManager to make it unmanaged. Here, ethX is the interface on which you want to disable the NetworkManager.
# vi /etc/sysconfig/network-scripts/ifcfg-ethX NM_CONTROLLED="no"