Debian Buster dhclient randomly uses its MAC address or a generated DUID-LLT as its DHCP client ID.
Can I force it to always use MAC address instead of the generated DUID-LLT?
I know the option send dhcp-client-identifier = xx:xx:xx:xx:xx:xx;, but it forces me to configure every interface manually with its own MAC address, something I prefer to avoid if possible.
As I said before, it is doing it already, but randomly.
Can it be forced to do it always?
62 Answers
The solution is simple, but not documented (not on the manpage of dhclient.conf at least). You can set the option send dhcp-client-identifier = hardware instead of hardcoding a specific MAC address.
Complete example:
$ echo "send dhcp-client-identifier = hardware;" >>/etc/dhcp/dhclient.conf
$ rm /var/lib/dhcp/*
$ systemctl restart networkingIt configures dhclient to send hardware address as client identifier, removes previous leases and restart interfaces with new settings. After this change it will use the MAC address as the client ID of each interface, automatically.
Since this change ifupdown had been adding the -i parameter to dhclient.
-i Use a DUID with DHCPv4 clients.But here is a fix: this change went to ifupdown 0.8.36 and makes the -i option optional. This is kind of documented in the (new enough) manpage for /etc/network/interfaces: man interfaces / INET ADDRESS FAMILY / "The dhcp Method" / Options / client
client client_id Client identifier (dhcpcd), or "no" (dhclient)So, for my case the practical solution was to add "client no" to my /etc/network/interfaces, like
.....
iface eno1 inet dhcp client nowhich brings the old behaviour, which is: ifup calls dhclient without "-i", as seen here:
For the record, I look at the command line parameters for confirmation: ps aux | grep dhclient
(By the way, to see the logs one can go like: sudo journalctl | grep -i dhcp | less)
This way it can talk to a DHCP server that is scared of RFC 4361.
This comes with a bit of fine print:
for Debian 10, I had to backport the ifupdown package.
I have followed
to obtain locally a ifupdown_0.8.36~bpo10+1_amd64.deb package.
After installation, I wasn't able to cleanly restart my networking (probably due to some systemd-related complexities).
So I had to reboot, unfortunately. Then it was able to obtain the IP address as expected.