I have been searching for a while and looking at source code and various scripts on the Linux filesystem and still have been unable to figure out what ultimately initiates the reading of the scripts for network interfaces (or other interfaces) in /etc/sysconfig/network-scripts/ that parses and grabs the basic parameters like IPADDR and assigns it to the interface.

The documentation from Redhat, for example, is not very specific:

Interface configuration files control the software interfaces for individual network devices. As the system boots, it uses these files to determine what interfaces to bring up and how to configure them. These files are usually named ifcfg-, where refers to the name of the device that the configuration file controls.

Very generally the "system" is said to read the files.

I do think that I've found one of the final programs in the chain of calls that parses those files and the parameters in them: /etc/sysconfig/network-scripts/ifup (which then calls other ifup-* scripts and executes various commands with the /sbin/ip binary and sets values under /sys/class/net/). But what calls that ifup script (which is a symbolic link to /sbin/ifup)? I started looking at udev but hit a dead end there. I used https://livegrep.com/search/linux to search the kernel code for references to those files and didn't find anything there either.

I basically would like to see a clear explanation of the chain of calls that lead to /etc/sysconfig/network-scripts/ifcfg-* scripts being parsed, starting from boot time.

Edit: Thanks to LinuxNinja for supplying the answer below. Following that answer I also found this similar post on the Unix SE site.

  • 1
    Looking on an old CentOS system, "/etc/init.d" is run at bootup and in there is "network", that appears to parse the ifcfg files in /etc/sysconfig/network-scripts – user16081-JoeT Jan 28 '16 at 4:02

The service 'network' is where you want to start (/etc/init.d/network)

It sets interfaces=$(ls ifcfg*)

That is also piped to sed to do some other magic, but this is where the ifcfg* files are identified.

There is a for statement that goes through each of the found ifcfg files using the $interfaces variable and evaluates each one, calling ifup eth0 boot, for example.

| improve this answer | |
  • Wow, I should have thought of that. Makes sense. Sometimes it's the simple things... – SeligkeitIstInGott Jan 28 '16 at 14:55

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.