dhcpcd
Obtain IP address from DHCP server
TLDR
Release all address leases
Request the DHCP server for new leases
SYNOPSIS
dhcpcd [-ABbDdKkLNnPqSTUuxVX46] [-C,--nohook HOOK] [-c,--script SCRIPT] [-E,--lastlease] [-e,--env VAR=VALUE] [-f,--config CONFIG] [-g,--user GID] [-h,--hostname HOSTNAME] [-I,--clientid CLIENTID] [-i,--vendorclassid VENDORCLASSID] [-l,--leasetime TIME] [-m,--metric METRIC] [-O,--nooption OPTION] [-o,--option OPTION] [-p,--pidfile PIDFILE] [-r,--request ADDRESS] [-s,--static ADDRESS] [-t,--timeout SEC] [-w,--waitip [4|6|interface]] [interface]
PARAMETERS
-4
IPv4 only, disables IPv6 Router Advertisements
-6
IPv6 Router Advertisements only, disables DHCPv4
-a, --all
Configure all interfaces marked 'allowinterfaces'
-A, --nobackground
Don't run as a daemon; foreground only
-b, --background
Background immediately, even with debug
-B, --noarp
Don't validate offered/requested IP with ARP
-c, --script SCRIPT
Use custom script instead of /lib/dhcpcd/dhcpcd-runhooks
-C, --nohook HOOK
Skip named hook script
-d
Increase debug verbosity (repeat for more)
-D
Return non-zero exit code on DHCP failure
-E, --lastlease
Fail if no lease available; use last lease if present
-e, --env VAR=VALUE
Set a script environment variable
-f, --config FILE
Use alternate config file
-g, --user GID
Change to group ID after config
-h, --hostname HOSTNAME
Send hostname to DHCP server
-i, --vendorclassid ID
Set vendor class identifier
-I, --clientid CLIENTID
Set client identifier (default: MAC)
-j
Write to systemd journal
-k, --kill
Kill dhcpcd instance for interface
-l, --leasetime TIME
Minimum lease time; ignore shorter offers
-L, --nolink
Don't receive link messages for hotplug
-m, --metric METRIC
Metric for interface routes
-n, --noipv4ll
Don't use IPv4LL fallback
-N
Reload config files
-O, --nooption OPTION
Don't request DHCP OPTION
-o, --option OPTION
Request DHCP OPTION
-p, --pidfile PIDFILE
Alternate PID file
-q
Quiet mode; syslog only
-r, --request IP
Request specific IP address
-s, --static IP
Use static config; IP[/prefix][gateway]
-S
Static config only; no DHCP
-t, --timeout SEC
Timeout after SEC seconds
-T, --test
Drop privileges for testing
-u, --userclass CLASS
User class ID
-U, --dumplease
Dump lease and exit
-v
Verbose logging
-V, --version
Print version
-w, --waitip [4|6|if]
Wait for IPv4/IPv6 address before exit
-x, --exit
Exit on SIGTERM
-z
Zombie process; don't fork
DESCRIPTION
dhcpcd is a robust, lightweight implementation of a DHCP client for Linux and other UNIX-like systems, compliant with RFC 2131 (DHCPv4) and supporting RFC 2132 (BOOTP), RFC 3927 (IPv4 Link-Local), and IPv6 Router Advertisements (RFC 4861). It automatically configures network interfaces by requesting and applying IP addresses, subnet masks, routes, DNS resolvers, NIS servers, NTP servers, and other parameters from a DHCP server.
Key capabilities include fallback to IPv4LL (AutoIP) on DHCP failure, static configuration support, customizable vendor class IDs and client identifiers, and extensible scripting via hooks for actions like hostname updates or NTP sync. It runs as a setuid root daemon, forking to background unless specified otherwise, and handles carrier detection, lease renewal, and interface hotplug events.
dhcpcd is ideal for embedded devices, servers, and minimal desktops due to low dependencies (no glibc required) and small footprint. It supports dual-stack IPv4/IPv6, static leases, and vendor extensions. Logging goes to syslog by default, with options for console or journald output. Configuration is via /etc/dhcpcd.conf for per-interface settings like static IPs or deny/allow lists.
Common use: dhcpcd eth0 for single interface or dhcpcd -a for all auto interfaces.
CAVEATS
Requires root privileges; conflicts with other DHCP clients like dhclient. Default config may auto-configure unintended interfaces. IPv6 support limited to RA, not DHCPv6. Leases stored in /var/lib/dhcpcd/. Not suitable for complex managed networks (use NetworkManager). Signals: SIGHUP reloads config, SIGTERM releases lease.
CONFIG FILE
/etc/dhcpcd.conf: Global and per-interface settings. Examples: denyinterfaces wlan*, interface eth0 static ip_address=192.168.1.100/24.
HOOKS
Scripts in /lib/dhcpcd/dhcpcd-hooks/ run on events (e.g., 01-network for routes, 20-resolv.conf for DNS). Custom hooks via -C.
LEASE MANAGEMENT
Leases in /var/lib/dhcpcd/dhcpcd-IFACE.lease. Use dhcpcd -U IFACE to dump.
HISTORY
Developed by Roy Marples starting in 2006 for the Bionic libc in Android. Evolved into standalone dhcpcd project (dhcpcd5), now at v10+ (2023). Focus on portability, minimalism; used in Alpine Linux, Raspberry Pi OS, Void Linux. Key milestones: IPv6 RA (2009), hooks system (2010), journald support (2015).
SEE ALSO
dhclient(8), dhcpd(8), ip(8), ifup(8), systemd-networkd(8), wpa_supplicant(8)


