Jump to content

Linux Networking/Where should I put the configuration commands?

From Wikibooks, open books for an open world

There are a few different approaches to Linux system boot procedures. After the kernel boots, it always executes a program called `init'. Many distributions are using a SysV-style init program, predominantly sysvinit developed by Miguel van Smoorenburg, though others are experimenting with replacements. Anyhow, the SysV init program reads its configuration file called /etc/inittab and commences the boot process.

Despite the fact that the init program is always the same, the setup of system boot is organized in a different way by each distribution.

Usually the /etc/inittab file contains an entry looking something like:

si::sysinit:/etc/init.d/boot

This line specifies the name of the shell script file that actually manages the boot sequence. This file is somewhat equivalent to the AUTOEXEC.BAT file in MS-DOS. There are usually other scripts that are called by the boot script and often the network is configured within one of many of these.

The following table may be used as a guide for your system:

---------------------------------------------------------------------------
       Distrib. | Interface Config/Routing          | Server Initialization
---------------------------------------------------------------------------
       Debian   | /etc/init.d/network               | /etc/rc2.d/*
---------------------------------------------------------------------------
       RedHat   | /etc/rc.d/init.d/network          | /etc/rc.d/rc3.d/*
---------------------------------------------------------------------------
       Slackware| /etc/rc.d/rc.inet1                | /etc/rc.d/rc.inet2
---------------------------------------------------------------------------

Note that Debian and Red Hat use a whole directory to host scripts that fire up system services (and usually information does not reside within these files, for example Red Hat systems store all of system configuration in files under /etc/sysconfig, whence it is retrieved by boot scripts). If you want to grasp the details of the boot process, my suggestion is to check /etc/inittab and the documentation that accompanies init. Linux Journal is also going to publish an article about system initialization, and this document will point to it as soon as it is available on the web.

Most modern distributions include a program that will allow you to configure many of the common sorts of network interfaces. If you have one of these then you should see if it will do what you want before attempting a manual configuration.


              -----------------------------------------
              Distrib   | Network configuration program
              -----------------------------------------
              RedHat    | /usr/bin/netcfg
              Slackware | /sbin/netconfig
              -----------------------------------------

To configure network you usually change some files to configure and set up networking and not change these scripts.

             -----------------------------------------------------
             Distrib    | Network configuration files
             -----------------------------------------------------
             Redhat     | /etc/sysconfig/network-scripts/ifcfg-*
             Debian     | /etc/network/interfaces (man interfaces)
             -----------------------------------------------------