We have desktop distributions of Linux mainly in part for introducing NetworkManager. The purpose of this feature is to easily manage network connectivity in a single location and provide a more dynamic configuration for network interfaces. To make that easier to understand think about it with an example. If I'm sitting at home, and I have just plugged in a wired network to my laptop I would likely want this interface to take priority over the wirless interface I'm currently connected to. NetworkManager does that, network manager also monitors various other aspects of network connectivity and will perform actions based on certain statuses it sees.
NetworkManager also attempts to be the centralized location for all network statuses so that all applications can check it to see what the status of the network is and to take action themselves when network connectivity dies, whether that be to work in offline mode or perform some other task.
NetworkManager doesn't always provide the most useful functionality when it comes to infrastructure servers though where network connectivity is generally desired to be static and unchanging in most scenarios. In this case we can either disable NetworkManager or install a [ackages in the OS that doesn't include NetworkManager by default.
Disabling NetworkManagerCheck if Network Manager is installed/enabled at boot
chkconfig --list NetworkManagerIf it is on and running stop it
service NetworkManager stopPrevent it from booting on startup
chkconfig NetworkManager offChange configs to use network service to startup on boot instead
NM_CONTROLLED=no ONBOOT=yesRestart networking
service network startEnsure traditional network service is enabled on boot
chkconfig network on
Using Network ManagerNow network manager isn't completely useless on server machines. You can use it to generate connection profiles.
Let's say we have an interface with no configuration on it.
We can run the "nmcli" commandline tool in order to configure this instead of going in an futzing with configuration files manually
This will create us a connection called $connName with the specified parameters we want
nmcli connection add con-name $connName ifname $ethernetName type ethernet ip4 $ipAddress/$subnet gw4 $defaultGateway
We can then add DNS information to this interface as well:
nmcli connection modify $connName ipv4.dns "$ipDns1 $ipDns2"
This will create a configuration file under "/etc/sysconfig/network-scripts/ifcfg-$connName"
You can list contents of connections by using
nmcli -p connection show $connName
The output of nmcli is tab-completed so if you have more than 1 connection type you can tab it out