16

I can't figure out the difference from just the man pages. I can see what is a daemon and one is a client, but what does that mean practically when using the commands? Also what is the difference between the client and daemon in this case, not just the terms (client and daemon) but functionally wise? EDIT: How are the tasks divided, if the client updates the information on the client, what is the purpose of the daemon. I'm talking about the client daemon in this case dhcpcd not dhcpd. Both come installed by default with some versions of Linux and seem to share the duties of the dhcp client.

NAME dhcpcd - DHCP client daemon

Name
dhclient - Dynamic Host Configuration Protocol Client 
17

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.

0
3

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.

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.