Short tip: disable automatic NetworkManager connections after user logins

During a fresh CentOS installation recently I had the problem that a system's network connection was not working reliably. Sometimes pings were possible, sometimes not. After it was possible to elimiate the firewall as commonly root cause, it turned out that the network connectivity was only working if the console is used.

The mysterious cause of this issue was in the network configuration file - e.g. /etc/sysconfig/network-scripts/ifcfg-eth0:

1TYPE=Ethernet
2ONBOOT=no
3...
4USERS=root

For some reason, Anaconda decided to enable NetworkManager and also bound the network connection to the root user. Networking was only possible once this user started a console session. To disable this behavior, the configuration file was altered like t his:

1ONBOOT=yes
2...
3#USERS=root
4NM_CONTROLLED=no

ONBOOT enables the device during the system boot. The additional variable NM_CONTROLLED denies managing this interface using NetworkManager. In addition to that I completely disabled NetworkManager as the affected host is a server system:

1# systemctl disable NetworkManager ; systemctl stop NetworkManager
2# systemctl enable network ; systemctl start network

This enables networking even without an active tty session. 🙂

Translations: