Dear Maintainer,
From dhclient-script(8) describint the PREINIT action:
The DHCP client is requesting that an interface be configured as
required in order to send packets prior to receiving an actual ad-
dress. [..]
To that end the script will bring up the interface if it is not
already up. However for DHCPv6, the client needs a working (non
tentative) link-local address before it can operate. After bringing
up the interface there might be several seconds while the kernel runs
Duplicate Address Detection (DAD) before the link-local address is
ready to use. The PREINIT6 action in dhclient-script should wait for
that to complete before returning.
The upstream example dhclient-script waits in this way[0], as does the
one in Fedora, based on it. The Debian one, however, does not [1].
This means that if you attempt to "dhclient -6" on a down interface
without first bringing it up and waiting for the link-local address,
it will fail.
This can be reproduced quite easily using the pasta too (passt
package) which will create a network namespace and includes a DHCPv6
server:
$ pasta -I exampleif -- sh -c "dhclient -v -6 exampleif"
Multiple default IPv6 routes, picked first
Internet Systems Consortium DHCP Client 4.4.3-P1
Copyright 2004-2022 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
can't create /var/lib/dhcp/dhclient6.leases: Permission denied
Can't bind to dhcp address: Cannot assign requested address
Please make sure there is no other dhcp server
running and that there's no entry for dhcp or
bootp in /etc/inetd.conf. Also make sure you
are not running HP JetAdmin software, which
includes a bootp server.
If you think you have received this message due to a bug rather
than a configuration issue please read the section on submitting
bugs on either our web page at www.isc.org or in the README file
before submitting a bug. These pages explain the proper
process and the information we find helpful for debugging.
exiting.
If, instead, time is left for DAD to complete, dhclient will succeed:
$ pasta -I exampleif -- sh -c "ip link set exampleif up; sleep 2; dhclient -v -6 exampleif"
Multiple default IPv6 routes, picked first
Internet Systems Consortium DHCP Client 4.4.3-P1
Copyright 2004-2022 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
can't create /var/lib/dhcp/dhclient6.leases: Permission denied
Listening on Socket/exampleif
Sending on Socket/exampleif
Created duid "\000\001\000\001.\243\033v2\351C\327C\333".
can't create /var/lib/dhcp/dhclient6.leases: Permission denied
PRC: Soliciting for leases (INIT).
XMT: Forming Solicit, 0 ms elapsed.
XMT: X-- IA_NA 43:d7:43:db
XMT: | X-- Request renew in +3600
XMT: | X-- Request rebind in +5400
XMT: Solicit on exampleif, interval 1020ms.
RCV: Advertise message on exampleif from fe80::7eff:4dff:fedf:6a54.
RCV: X-- IA_NA 43:d7:43:db
RCV: | X-- starts 1729126134
RCV: | X-- t1 - renew +4294967295
RCV: | X-- t2 - rebind +4294967295
RCV: | X-- [Options]
RCV: | | X-- IAADDR 2001:4479:e300:7200:222:4dff:fea6:88f3
RCV: | | | X-- Preferred lifetime 4294967295.
RCV: | | | X-- Max lifetime 4294967295.
RCV: X-- Server ID: 00:01:00:01:2e:a3:1b:74:9a:55:9a:55:9a:55
RCV: Advertisement recorded.
PRC: Selecting best advertised lease.
PRC: Considering best lease.
PRC: X-- Initial candidate 00:01:00:01:2e:a3:1b:74:9a:55:9a:55:9a:55 (s: 10103, p: 0).
XMT: Forming Request, 0 ms elapsed.
XMT: X-- IA_NA 43:d7:43:db
XMT: | X-- Requested renew +3600
XMT: | X-- Requested rebind +5400
XMT: | | X-- IAADDR 2001:4479:e300:7200:222:4dff:fea6:88f3
XMT: | | | X-- Preferred lifetime +7200
XMT: | | | X-- Max lifetime +7500
XMT: V IA_NA appended.
XMT: Request on exampleif, interval 940ms.
RCV: Reply message on exampleif from fe80::7eff:4dff:fedf:6a54.
RCV: X-- IA_NA 43:d7:43:db
RCV: | X-- starts 1729126135
RCV: | X-- t1 - renew +4294967295
RCV: | X-- t2 - rebind +4294967295
RCV: | X-- [Options]
RCV: | | X-- IAADDR 2001:4479:e300:7200:222:4dff:fea6:88f3
RCV: | | | X-- Preferred lifetime 4294967295.
RCV: | | | X-- Max lifetime 4294967295.
RCV: X-- Server ID: 00:01:00:01:2e:a3:1b:74:9a:55:9a:55:9a:55
PRC: Bound to lease 00:01:00:01:2e:a3:1b:74:9a:55:9a:55:9a:55.
can't create /var/lib/dhcp/dhclient6.leases: Permission denied
[0] https://github.com/isc-projects/dhcp/blob/572032cb0e514606559de3784e3f7ca8e1539d17/client/scripts/linux#L432
[1] https://salsa.debian.org/debian/isc-dhcp/-/blob/master/debian/dhclient-script.linux?ref_type=heads#L389