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?
Firstly, i am not RHEL certified. :p
I have check against one of my RHEL 5.4 box:
1.During bootup or network service restart, it will use this startup script "/etc/init.d/network", which is a plain bash script that you can check it out in details yourself.
2.Two main things about the startup script:
a.It checks the existence of "/etc/sysconfig/network" before proceeding.
b.Then it change directory to "/etc/sysconfig/network-scripts", which means, this is the main directory it refers to and load the config file.
3.About the other two directories or ultimately one "/etc/sysconfig/networking/", it has been warned in RHEL manual that it is a no fly zone. I believe when you use the "system-config-network", it will utimately copied the file over to the main directory as per 2(b).
4.If you need to be really really sure about it, you can browse through the developer python source code for "system-config-network" in "/usr/share/system-config-network". Which might point you back to (3) that the tool will finally copy or write the config file in "/etc/sysconfig/network-scripts".
/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. ;)
/etc/sysconfig/network is your system's global network configuration file. It contains the default route and hostname
/etc/sysconfig/network-scripts/ifcfg-eth? should be the only files you'll need to edit to get a working network configuration. You can manually edit these files according to this doc or use system-config-network to get up and running.
/etc/sysconfig/networking/profiles/ is used only by
system-config-network
to store network profiles. Nothing under that directory is ever used by the network start/stop scripts by default.To be honest, I don't know what /etc/sysconfig/networking/devices is used for and have never had to edit any files under this directory.
When using RHEL's network scripts, /etc/sysconfig/network-scripts/ifcfg-eth? is what they'll get their information from. If you use ifconfig to set up your network interfaces, keep in mind that you'll need to duplicate your changes in these files to get your configuration to survive a reboot or
service network restart