dhclient and dhcpcd the real difference

ISC provides dhclient, and as such, it serves as sort of a reference. The more lightweight dhcpcd is somewhat more up to date. Both dhcpcd and dhclient are fully capable DHCP client daemons. Dhclient is not a "one-time" utility:

man dhclient

-w Continue running even if no broadcast interfaces were found. Normally DHCP client will exit if it isn't able to identify any network interfaces to configure. (...)

That is more like the default behavior of dhcpcd.


DHCP has been kind of a moving target, with various vendors (Microsoft in particular) introducing various deviations from the standard.


Debian offers a dhcpcd package. The package description reads as follows:

Simple configuration: supports executions of a script when the IP address changes.

dhclient is usually used in this fashion: dhclient -v eth0 or similar - what will happen is that it will send a broadcast out of eth0, and if a DHCP server replies, it will apply information given to eth0. It will then exit. It will not monitor the interface thereafter. I haven't used dhcpcd but I presume that is its purpose.

You would use dhclient if things are messed up and you wanted to fetch a fresh IP from a DHCP server manually. Good tool to have and that is why many distros include it I suppose.


It looks like ISC dhclient is not a one-shot client. Its manpage, man dhclient(8) says:

Normally the DHCP client will run in the foreground until is has
configured an interface at which time it will revert to running in
the background.

You can use -1 flag to ask dhclient to try only once to get an IP and then exit on fail. From man page:

The -1 flag cause dhclient to try once to get a lease.  If it 
fails, dhclient exits with exit code two.

Tags:

Dhcp