How to disable NetworkManager on CentOS
Below you can find how to disable NetworkManager service.
1. Command how to check interfaces are managed by NetworkManager
# nmcli device status
Mentioned command displays table with lists all network interfaces along with their STATE.
If Network Manager is not controlling an interface, its STATE will be listed as unmanaged.
Any other value indicates the interface is under Network Manager control.
2. How to stop the NetworkManager service:
# systemctl stop NetworkManager
3. For disabling the NetworkManager service permanently:
# systemctl disable NetworkManager
4. For confirming that NetworkManager service has been disabled
# systemctl list-unit-files | grep NetworkManager
5. To make NetworkManager unmanaged you need to add next parameter in interfaces: /etc/sysconfig/network-scripts/ifcfg-ethX
NM_CONTROLLED="no"
Switching to “network” service.
Interface can be configured for use with the network service when the NetworkManager is disabled.
Below you can find several steps configure and interface using network services.
1. You need to set the IP address in the configuration file: /etc/sysconfig/network-scripts/ifcfg-eth0.
Set the NM_CONTROLLED value to no and assign a static IP address in the file.
NAME="eth0"
HWADDR=...
ONBOOT=yes
BOOTPROTO=none
IPADDR=...
NETMASK=...
GATEWAY=...
TYPE=Ethernet
NM_CONTROLLED=no
2. Next step to set the DNS servers to be used by adding into the file:
/etc/resolv.conf:
nameserver [server 1]
nameserver [server 2]
3. Enable the network service
# systemctl enable network
4. Restart the network service
# systemctl restart network