If you are running CentOS in an headless server environment, then there’s no need for NetworkManager. There is another way to configure your network interface(s) in CentOS by utilizing the Network service. First, we need to get NetworkManager out of the way. Here’s how.
Please note that this guide will not work with CentOS 8 as the Network service has been deprecated. Look here for more information on configuration. It is possible to bring back the Network service by installing the following RPM package:
sudo yum install network-scripts
The Network service should now be installed once more as well as any legacy tools that have been removed previously. Next we are going to go ahead and disable NetworkManager.
In order to disable the service, we will first need to stop it.
systemctl stop NetworkManager
This will stop the service temporarily. In order to disable the service completely, run the following command:
systemctl disable NetworkManager
NetworkManager has been disabled. Now, use your preferred text editor to open /etc/sysconfig/network-scripts/ifcfg-xx where xx is the name of your network interface. At the end of the file, add in the following:
By doing this, we won’t be getting any errors due to the service being disabled. Also make sure that ONBOOT is set to yes. Now we are going to enable the network service:
systemctl enable Network
Now restart the Network service:
systemctl restart Network
Make sure everything went according to plan by running the ip addr command. You should see an IP address assigned to your active network interface.
Starting with CentOS 8, NetworkManager may become the only viable option in the near future.