dhclient
Obtain IP address from DHCP server
TLDR
Get an IP address for the eth0 interface
Release an IP address for the eth0 interface
SYNOPSIS
dhclient [-4|-6] [-N] [-D] [-q] [-v] [-i] [-p port] [-s server] [-cf config-file] [-lf lease-file] [-pf pid-file] [-df database-file] [-r|-x] [interface]
PARAMETERS
-4
Forces dhclient to use only the DHCPv4 protocol.
-6
Forces dhclient to use only the DHCPv6 protocol.
-N
Do not configure any interfaces. Just perform DHCP negotiation.
-D
Enter debug mode.
-q
Be less verbose.
-v
Be more verbose.
-i
Use an ISC DHCP server compliant mode.
-p port
Specifies the port to listen on.
-s server
Specifies the DHCP server to contact.
-cf config-file
Specifies the configuration file to use. Defaults to /etc/dhcp/dhclient.conf.
-lf lease-file
Specifies the lease file to use. Defaults to /var/lib/dhcp/dhclient.leases.
-pf pid-file
Specifies the PID file to use. Defaults to /var/run/dhclient.pid.
-df database-file
Specifies the database file to use. Defaults to /var/lib/dhcp/dhclient.leases.
-r
Release the current lease.
-x
Exit immediately after releasing the current lease.
interface
Specifies the network interface to configure.
DESCRIPTION
dhclient is a client program used to configure network interfaces using the Dynamic Host Configuration Protocol (DHCP). It obtains an IP address, subnet mask, default gateway, and DNS server information from a DHCP server, automatically configuring the network interface. This eliminates the need for manual network configuration, making network administration easier.
The command is typically executed at system startup or when a network interface is brought up. It listens for DHCP offers from DHCP servers on the network, selects one, and sends a request to lease the IP address. If the lease is granted, it configures the interface with the received parameters. Dhclient is essential for network environments where IP addresses are assigned dynamically. The command offers many parameters to customize behavior. For example, specifying network interfaces, sending DHCP requests to specific ports or servers, specifying lease durations, controlling the script execution for interface configuration, sending custom options, and debugging information.
CAVEATS
The DHCP server must be properly configured for dhclient to function correctly. Improper configuration can lead to network connectivity issues.
CONFIGURATION FILE
The dhclient.conf file is used to configure the behavior of dhclient. It allows setting various options, such as request parameters, timeouts, and vendor class identifiers. It also specifies scripts to run during lease acquisition and release.
LEASE FILE
The lease file stores information about acquired DHCP leases. This information is used to renew leases and prevent IP address conflicts.
HISTORY
dhclient has been a staple of Linux systems for many years, evolving alongside the DHCP protocol. It provides a standard way to configure network interfaces automatically. Development focuses on stability, security, and feature enhancements to support modern networking environments. It is widely used in various Linux distributions.