Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: DHCP client: dhclient vs dhcpcd ?



Hi Thomas

On 01/02/2018 07:17, Thomas Mueller wrote:
On Wed, Jan 31, 2018 at 1:18 PM, KIRIHARA Masaharu <mki_open%yahoo.co.jp@localhost> wrote:
NetBSD has two DHCP clients; dhclient(8) and dhcpcd(8).
What's the difference?
Which is better to use?

I'm biased as I maintain dhcpcd, but dhcpcd is better in every way.

On Wed, 31 Jan 2018 13:47:42 +0100, Benny Siegert responded:

I agree that this is confusing. dhclient is the older tool, while
dhcpcd has been created by a NetBSD developer, is newer and smaller. I
have run into situations (on Google Compute Engine for instance) where
dhclient was unable to interpret some of the more modern DHCP
features.
I recommend using dhcpcd :)

I have read about NetBSD planning to drop dhclient in favor of dhcpcd.

I have had installations where dhcpcd succeeded where dhclient failed, and (7.99.1 amd64) where dhclient succeeded where dhcpcd failed >
Failure means not being able to set up the internet connection even if the command ran without error messages.

Do you have any details on why dhcpcd failed and how dhclient worked, like say packet captures? I can probably guess though - some DHCP servers only work when the client id is in a format they know. However, this is not RFC compliant. Luckily dhcpcd can be configured to sent a client id the DHCP server does like, but this is not out of the box config, but is documented in said config.

Likewise dhclient doesn't work on links where a clientid is required out of the box.

I have also had a situation where neither dhcpcd nor dhclient could establish the internet connection, but I was able to connect by using ifconfig and route directly.

More details please.


I notice NetBSD's dhclient is very big while FreeBSD's dhclient is much smaller, like

$ ls -l /sbin/dhclient
-r-xr-xr-x  1 root  wheel  100056 Jul 31  2017 /sbin/dhclient
$ ls -l /media/zip0/sbin/dh*
-r-xr-xr-x  1 root  wheel  5352184 Jun 20  2017 /media/zip0/sbin/dhclient
-r-xr-xr-x  1 root  wheel     6221 Jun 20  2017 /media/zip0/sbin/dhclient-script
-r-xr-xr-x  1 root  wheel   299176 Jun 20  2017 /media/zip0/sbin/dhcpcd

running from FreeBSD 11.1-STABLE where /media/zip0 is mount point for NetBSD 8.99.1 installation.

FreeBSD uses dhclient in base system, which does not include dhcpcd.

FreeBSD dhclient is based on OpenBSD one, which is basically a very stripped down and old ISC dhclient which supports DHCPv4 only and isn't extendable. NetBSD ships a more modern and non stripped down ISC dhclient which is more bloaty and extendable but offers more features like say DHCPv6.

For a fair comparison dhcpcd can be compiled for DHCPv4 only (like FreeBSD and OpenBSD) and it is currently 120k on i386. But even then, that includes the control socket code AND custom DHCP option parsing code to pass to shell scripts which cannot currently be stripped out.

But frankly, with your numbers above, a client with all the features dhcpcd has and only weighing in at 299176 on disk is pretty impressive - newer versions in more recent NetBSD are smaller still.

Roy


Home | Main Index | Thread Index | Old Index