dhclient-script
Configure network interfaces after DHCP lease events
SYNOPSIS
dhclient-script interface reason [parameter=value …]
PARAMETERS
interface
Network interface name (e.g., eth0)
reason
DHCP event: PREINIT, BOUND, RENEW, REBIND, REBOOT, EXPIRE, RELEASE, STOP, etc.
ip_address
Assigned IPv4 address
subnet_mask
Subnet mask for the interface
routers
Space-separated list of default gateways
domain_name_servers
Space-separated DNS server IPs
domain_name
Domain name from DHCP
domain_search
Search domains for DNS resolution
new_lease_time
Lease duration in seconds
new_broadcast_address
Broadcast address
new_classless_static_routes
Classless static routes from DHCP
DESCRIPTION
The dhclient-script is a shell script used by the ISC DHCP client (dhclient) to configure network interfaces based on DHCP lease events. It is automatically invoked by dhclient during lease acquisition, renewal, release, or expiration.
The script interprets a reason argument indicating the DHCP event (e.g., BOUND, RENEW) and environment variables containing lease details like IP address, subnet mask, routers, and DNS servers. It performs actions such as assigning IP addresses with ifconfig or ip, adding routes, updating /etc/resolv.conf for DNS, and running custom hooks.
Customizable via editing the script or /etc/dhcp/dhclient-enter-hooks.d/ and exit hooks directories. Primarily used on Linux systems with ISC DHCP; not for direct user invocation but system integration. Supports IPv4; IPv6 handled separately by dhclient6-script.
CAVEATS
Not intended for direct execution; relies on dhclient. Modern systems prefer NetworkManager or systemd-networkd. Script may need updates for ip vs. deprecated ifconfig. IPv6 separate.
CUSTOM HOOKS
Extend via /etc/dhcp/dhclient-enter-hooks.d/ (pre-config) and /etc/dhcp/dhclient-exit-hooks.d/ (post-config) directories for site-specific actions.
REASON ACTIONS
BOUND/REBOOT: Configure interface up with full lease. RELEASE: Deconfigure (down interface). RENEW/REBIND: Update without full tear-down.
HISTORY
Part of ISC DHCP client since version 3.x (early 2000s); evolved from original DHCP implementation by ISC (1995). Migrated to Kea DHCP in newer distros, but dhclient-script persists in many Linuxes like Debian/RHEL.


