Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

2.7. Using NetworkManager with sysconfig files

The /etc/sysconfig/ directory is a location for configuration files and scripts. Most network configuration information is stored there, with the exception of VPN, mobile broadband and PPPoE configuration, which are stored in the /etc/NetworkManager/ subdirectories. For example, interface-specific information is stored in the ifcfg files in the /etc/sysconfig/network-scripts/ directory.
For global settings, use the /etc/sysconfig/network file. Information for VPNs, mobile broadband and PPPoE connections is stored in /etc/NetworkManager/system-connections/.
In Red Hat Enterprise Linux 7 if you edit an ifcfg file, NetworkManager is not automatically aware of the change and has to be prompted to notice the change. If you use one of the tools to update NetworkManager profile settings, NetworkManager does not implement those changes until you reconnect using that profile. For example, if configuration files have been changed using an editor, NetworkManager must read the configuration files again.
To ensure this, enter as root to reload all connection profiles:
~]# nmcli connection reload
Alternatively, to reload only one changed file, ifcfg-ifname:
~]# nmcli con load /etc/sysconfig/network-scripts/ifcfg-ifname
Note that you can specify multiple file names using the above command.
Changes made using tools such as nmcli do not require a reload but do require the associated interface to be put down and then up again:
~]# nmcli dev disconnect interface-name
~]# nmcli con up interface-name
NetworkManager does not trigger any of the network scripts, though the network scripts attempt to trigger NetworkManager if it is running when the ifup commands are used. See Section 2.6, “Using NetworkManager with Network Scripts” for the explanation of the network scripts.
The ifup script is a generic script which does a few things and then calls interface-specific scripts such as ifup-ethX, ifup-wireless, ifup-ppp, and so on. When a user runs ifup eth0 manually:
  1. ifup looks for a file called /etc/sysconfig/network-scripts/ifcfg-eth0;
  2. if the ifcfg file exists, ifup looks for the TYPE key in that file to determine which type-specific script to call;
  3. ifup calls ifup-wireless or ifup-eth or ifup-XXX based on TYPE;
  4. the type-specific scripts do type-specific setup;
  5. the type-specific scripts let common functions perform IP-related tasks like DHCP or static setup.
On bootup, /etc/init.d/network reads through all the ifcfg files and for each one that has ONBOOT=yes, it checks whether NetworkManager is already starting the DEVICE from that ifcfg file. If NetworkManager is starting that device or has already started it, nothing more is done for that file, and the next ONBOOT=yes file is checked. If NetworkManager is not yet starting that device, the initscripts continue with their traditional behavior and call ifup for that ifcfg file.
The result is that any ifcfg file that has ONBOOT=yes is expected to be started on system bootup, either by NetworkManager or by the initscripts. This ensures that some legacy network types which NetworkManager does not handle (such as ISDN or analog dial-up modems) as well as any new application not yet supported by NetworkManager are still correctly started by the initscripts even though NetworkManager is unable to handle them.

Important

It is recommended to not store the backup files anywhere within the /etc directory, or in the same location as the live files, because the script literally does ifcfg-*. Only these extensions are excluded: .old, .orig, .rpmnew, .rpmorig, and .rpmsave.
For more information on using sysconfig files, see Section 3.5, “Configuring Ip Networking with ifcfg Files” and the ifcfg(8) man page.