12.7. DHCP Networking Configuration

12.7.1. Creating the DHCP Network Interface Configuration Files

First install the service from the CLFS Bootscripts package:

tar -xvf bootscripts-cross-lfs-2.1-pre1.tar.xz
cd bootscripts-cross-lfs-2.1-pre1
make install-service-dhcpcd

Finally, create the /etc/sysconfig/network-devices/ifconfig.eth0/dhcpcd configuration file using the following commands. Adjust appropriately for additional interfaces:

cd /etc/sysconfig/network-devices &&
mkdir -v ifconfig.eth0 &&
cat > ifconfig.eth0/dhcpcd << "EOF"
ONBOOT="yes"
SERVICE="dhcpcd"

# Start Command for DHCPCD
DHCP_START="-q"

# Stop Command for DHCPCD
DHCP_STOP="-k"
EOF

The values of these variables must be changed in every file to match the proper setup. If the ONBOOT variable is set to “yes” the network script will bring up the Network Interface Card (NIC) during booting of the system. If set to anything but “yes” the NIC will be ignored by the network script and not be brought up.

The SERVICE variable defines the method used for obtaining the IP address. The CLFS-Bootscripts package has a modular IP assignment format, and creating additional files in the /etc/sysconfig/network-devices/services directory allows other IP assignment methods.

The DHCP_START and DHCP_STOP variables arguments that are passed onto dhcpcd when starting and stoppping the service. More information about what can be passed can be found in the dhcpcd(8) man page.

To configure another Static Interface, Follow Section 12.5, “Static Networking Configuration”.