dhclient Command

The dhclient command is a DHCP client that automatically configures network interfaces by obtaining IP addresses, subnet masks, default gateways, and DNS servers from a DHCP server.

Syntax

dhclient [OPTIONS] [INTERFACE...]

Description

The dhclient command provides a means for configuring one or more network interfaces using the Dynamic Host Configuration Protocol (DHCP). It automatically obtains network configuration from a DHCP server.

Key features:

  • Automatically obtains IP addresses from DHCP servers
  • Configures network settings like subnet mask and gateway
  • Updates DNS configuration
  • Supports lease renewal and release
  • Can work with multiple network interfaces

Common Options

Option Description
-r Release current lease and exit
-d Run in foreground (debug mode)
-v Verbose output
-q Quiet mode (suppress output)
-1 Try once and exit
-cf file Use alternate configuration file
-lf file Use alternate lease file
-pf file Use alternate PID file

Examples

Configure interface with DHCP

sudo dhclient eth0

Configures the eth0 interface using DHCP

Configure all interfaces

sudo dhclient

Configures all available network interfaces

Release DHCP lease

sudo dhclient -r eth0

Releases the current DHCP lease for eth0

Renew DHCP lease

sudo dhclient -r eth0 && sudo dhclient eth0

Releases and then renews the DHCP lease

Run in verbose mode

sudo dhclient -v eth0

Shows detailed output during DHCP configuration

Run in debug mode

sudo dhclient -d eth0

Runs in foreground with debug output

Try once and exit

sudo dhclient -1 eth0

Attempts DHCP configuration once and exits

Use custom configuration file

sudo dhclient -cf /etc/dhcp/dhclient-custom.conf eth0

Uses a custom DHCP client configuration file

Check current lease information

cat /var/lib/dhcp/dhclient.leases

Displays current DHCP lease information

See also