6

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?

9
  • Does the close text reading "close (1)" mean someone is voting to close it?
    – VxJasonxV
    Oct 11, 2010 at 5:50
  • That's a design choice you should ask Red Hat developers about; it's like asking "why windows stores networking informations in (at least) two places in the Registry": there is no "true" answer anyone can provide here.
    – Massimo
    Oct 11, 2010 at 7:01
  • TWO people, now.
    – Massimo
    Oct 11, 2010 at 7:01
  • And yet, no comments that could tell me why people feel this way.
    – VxJasonxV
    Oct 11, 2010 at 15:52
  • You're stating that no RedHat certified system engineer visits here? Nor any RedHat developer? Nor any user that has been frustrated with this just as much but actually learned what's going on? (UTSL...). This isn't just a "why" question in "why was this decision made", but "why is it like this and how do I get a wrangle on it"? I know that priority is involved ("If files are in $X and $Y then $Y's configuration will be used first."), which is half the question I'm asking for clarification. Perhaps I should rewrite it to make that more explicit.
    – VxJasonxV
    Oct 11, 2010 at 15:54

3 Answers 3

5
+50

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. ;)

1
  • Hard Links? Really? Hmm.
    – VxJasonxV
    Oct 17, 2010 at 4:27
5

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.

 16 if [ ! -f /etc/sysconfig/network ]; then
 17     exit 0
 18 fi
 19
 20 . /etc/sysconfig/network
 21
 22 if [ -f /etc/sysconfig/pcmcia ]; then
 23         . /etc/sysconfig/pcmcia
 24 fi
 25
 26
 27 # Check that networking is up.
 28 [ "${NETWORKING}" = "no" ] && exit 0
 29

 38
 39 CWD=`pwd`
 40 cd /etc/sysconfig/network-scripts
 41
 42 . ./network-functions
 43
 44 # find all the interfaces besides loopback.
 45 # ignore aliases, alternative configurations, and editor backup files
 46 interfaces=$(ls ifcfg* | \
 47             LANG=C sed -e "$__sed_discard_ignored_files" \
 48                        -e '/\(ifcfg-lo\|:\|ifcfg-.*-range\)/d' \
 49                        -e '/ifcfg-[A-Za-z0-9\._-]\+$/ { s/^ifcfg-//g;s/[0-9]/ &/}' | \
 50             LANG=C sort -k 1,1 -k 2n | \
 51             LANG=C sed 's/ //')
 52

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".

2
  • Network-Scripts is highest priority and sysconfig/networking is no man's land?!?! You're kidding me. I mean, the priority part actually makes sense now that I'm thinking about it, but their base installer puts files where they don't want you too?! Wow. I'm shocked.
    – VxJasonxV
    Oct 13, 2010 at 16:05
  • IMO, the file was created by the base installer, since it would have kick the same python script (GUI/non-GUI) to get networking details during installation. And that's like a temp directory for them to store the configuration.
    – Muhammad
    Oct 14, 2010 at 1:39
1

/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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.