1.9. Network Configuration Using 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 /etc/NetworkManager/ subdirectories. Interface specific information for example, is stored in ifcfg files in the /etc/sysconfig/network-scripts/ directory.
The file /etc/sysconfig/network is for global settings. Information for VPNs, mobile broadband and PPPoE connections is stored in /etc/NetworkManager/system-connections/.
In Red Hat Enterprise Linux 7 when 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, then 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 be told to read the configuration files again. To do that, issue the following command as root:
~]# nmcli connection reload
The above command reads all connection profiles. Alternatively, to reload only one changed file, ifcfg-ifname, issue a command as follows:
~]# nmcli con load /etc/sysconfig/network-scripts/ifcfg-ifname
The command accepts multiple file names. These commands require root privileges. For more information on user privileges and gaining privileges, see the Red Hat Enterprise Linux System Administrator's Guide and the su(1) and sudo(8) man pages.
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. That can be done by using commands in the following format:
nmcli dev disconnect interface-name
Followed by:
nmcli con up interface-name
NetworkManager does not trigger any of the network scripts, though the network scripts will try to trigger NetworkManager if it is running when ifup commands are used. See Section 1.8, “NetworkManager and the Network Scripts” for an explanation of the network scripts.
The ifup script is a generic script which does a few things and then calls interface-specific scripts like ifup-ethX, ifup-wireless, ifup-ppp, and so on. When a user runs ifup eth0 manually, the following occurs:
  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. and then 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 will continue with their traditional behavior and call ifup for that ifcfg file.
The end 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.

Note

It is recommended not to store backup ifcfg files in the same location as the live ones. The script literally does ifcfg-* with an exclude only for these extensions: .old, .orig, .rpmnew, .rpmorig, and .rpmsave. The best way is not to store backup files anywhere within the /etc directory.