12.8. DHCPCD-6.3.2

The DHCPCD package provides a DHCP Client for network configuration.

12.8.1. Installation of DHCPCD

If you wish to configure your network to connect to a DHCP server, you will first need to install a DHCP client. CLFS uses the DHCPCD package for this.

Prepare DHCPCD for compilation:

./configure --prefix=/usr --sbindir=/sbin \
    --sysconfdir=/etc --dbdir=/var/lib/dhcpcd --libexecdir=/usr/lib/dhcpcd

Compile the package:


This package does not come with a test suite.

Install the package:

make install

12.8.2. Creating the DHCP Network Interface Configuration File

The following is an example for the eth0 interface. Refer to the dhcpcd.conf man page for more information. This step may be skipped if default behavior of dhcpcd is required.

Create the /etc/dhcpcd.conf configuration file using the following commands. Adjust appropriately for additional options:

cd /etc &&
cat > dhcpcd.conf << "EOF"
# dhcpcd configuration eth0 interface
# See dhcpcd.conf(5) for details.

interface eth0
# dhcpcd-run-hooks uses these options.
option subnet_mask, routers, domain_name_servers

# The default timeout for waiting for a DHCP response is 30 seconds
# which may be too long or too short and can be changed here.
timeout 16

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

12.8.3. Configuring the Network Interface at boot

Enabling of the Network Interface configuration is done per interface. To enable Network Interface configuration at boot, run:

systemctl enable dhcpcd@eth0

To disable previously enabled Network Interface configuration at boot, run:

systemctl disable dhcpcd@eth0

To manually start the Network Interface configuration, run:

systemctl start dhcpcd@eth0

Replace eth0 with the correct Network Interface name as described on the beginning of this page.

12.8.4. Contents of dhcpcd

Installed files: dhcpcd

Short Descriptions


dhcpcd is an implementation of the DHCP client specified in RFC 2131. It gets the host information from a DHCP server and configures the network interface automatically.