The DHCPCD package provides a DHCP Client for network configuration.
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:
make
This package does not come with a test suite.
Install the package:
make install
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
EOF
To configure another Static Interface, Follow Section 12.7, “Static Networking Configuration”.
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.