Configuring the Interface for Every Boot:
The configuration values assigned by the ifconfig command do not survive the boot. To configure the interface every time the system boots, the ifconfig command must be stored in a startup file. Normally, this does not require any effort on your part. Configuring the network interface is a basic part of the Linux installation.
During installation, Linux detects the network interface; and asks for the address, address mask, broadcast address, and several other network-related parameters. The installation program stores these values on the disk, where they are used later by the ifconfig command. Slackware stores the values in /etc/rc.d/rc.inet1
; Caldera, Mandrake, and Red Hat store the values in /etc/sysconfig/network
and /etc/sysconfig/network-scripts/ifcfg.interface
, where interface is the name of the network interface, such as ifcfg.eth0
. The startup scripts provided by these distributions then use the values to configure the interface.
However, if you want to manually configure the interface, you could directly configure it by storing the ifconfig command in the rc.local script. The rc.local script is the last startup script executed, so anything stored there overrides the configuration done by the system. The following commands placed in rc.local would configure the network interface on robin in exactly the manner we wanted:
ifconfig eth0 172.16.5.4 netmask 255.255.255.0 broadcast 172.16.5.255
The ifconfig command provides the configuration described previously.
Many administrators don't edit any of the boot script files directly, nor do they manually configure the interface. Instead, they use a network configuration tool to correct any problems with the network interface configuration. Configuration tools are simple to use, but they are different on every Linux distribution, and they frequently change between releases of the same distribution. The ifconfig command is consistent. It works on every Linux distribution and every type of Unix.