Linux – the order of precedence for RedHat network configuration files

linuxnetworkingredhat

This has been bugging me for some time, because I haven't bothered to sit down and write down what exactly is going on.

Our RedHat server network configuration is all over the map. Across a fleet of servers installed RH4 and RH5, sometimes we manage networking information in /etc/sysconfig/networking/devices, sometimes in /etc/sysconfig/networking/profiles/default and sometimes /etc/sysconfig/network-scripts.

I understand when the "profiles" come into play, the redhat-config-network application (aka. system-config-network for CentOS and other offshoots) writes files there when used, and otherwise I believe the defaults are set up initially in networking/devices.

Assuming configuration files resided in all three of these key directories, in which order are they evaluated for use, and are they on an atomic directory level, or does order take place for every individual file?

Meaning, if I have an ifcfg-eth1 in whatever is the highest ordered directory, and nothing else, and an ifcfg-eth0 in the second order directory, will the eth0 configuration be considered, or will it be skipped and eth1 the only configured device?

Best Answer

Assuming configuration files resided in all three of these key directories, in which order are they evaluated for use, and are they on an atomic directory level, or does order take place for every individual file?

/etc/sysconfig/network-scripts/ is the only directory used. The proof is to start reading /etc/rc.d/init.d/network. Ignore /etc/sysconfig/networking/.

If you're curious about how the profile system is implemented see the updateNetworkScripts function in /usr/share/system-config-network/netconfpkg/NC_functions.py.

Basically it makes hardlinks of the ifcfg-* files in /etc/sysconfig/network-scripts/, /etc/sysconfig/networking/devices/, and /etc/sysconfig/networking/profiles/*.

E.g., given that you are in profile foo

  • /etc/sysconfig/network-scripts/ifcg-eth0
  • /etc/sysconfig/networking/devices/ifcg-eth0
  • /etc/sysconfig/networking/profiles/foo/ifcg-eth0

are all the same file.

P.S. I am an RHCE so what I say must be correct. ;)