Discussion:
[Dnsmasq-discuss] DHCPv6 with dnsmasq for automated deployments
Oliver Freyermuth
2018-05-25 12:07:34 UTC
Permalink
Dear dnsmasqers,

I fear the following is a design issue of DHCPv6, but I wonder if there's a way to overcome it with dnsmasq...

When automatically deploying machines via PXE / network installer, there's usually first a DHCPv6 client running in the installer,
and afterwards (when the machine is installed) the "real" DHCPv6 client running on the machine.
Naturally, both will usually have different client DUIDs...

Using dnsmasq's functionality to perform DHCPv6 address assignment based on MAC address,
this works fine for the first client, but the second DHCPv6 client will not get an address until the old lease is expired.

In general, I feel this is the correct behaviour, but it's of course rather inconvenient when deploying machines automatically -
they will retrieve an IPv6 address with the network installer, and then not get one after the first reboot.
Also, when reinstalling them, they will not get an address in the installer if the lease from their "old life" is still valid.

Does somebody have a good solution for this?
Is there something like "id:*" for IPv4 implemented for the IPv6 world (i.e. something like "duid:*")?

Cheers and all the best,
Oliver
Pali Rohár
2018-05-25 12:59:42 UTC
Permalink
Post by Oliver Freyermuth
Dear dnsmasqers,
I fear the following is a design issue of DHCPv6, but I wonder if there's a way to overcome it with dnsmasq...
When automatically deploying machines via PXE / network installer, there's usually first a DHCPv6 client running in the installer,
and afterwards (when the machine is installed) the "real" DHCPv6 client running on the machine.
Naturally, both will usually have different client DUIDs...
Using dnsmasq's functionality to perform DHCPv6 address assignment based on MAC address,
this works fine for the first client, but the second DHCPv6 client will not get an address until the old lease is expired.
In general, I feel this is the correct behaviour, but it's of course rather inconvenient when deploying machines automatically -
they will retrieve an IPv6 address with the network installer, and then not get one after the first reboot.
Also, when reinstalling them, they will not get an address in the installer if the lease from their "old life" is still valid.
Does somebody have a good solution for this?
Is there something like "id:*" for IPv4 implemented for the IPv6 world (i.e. something like "duid:*")?
Cheers and all the best,
Oliver
Hi Oliver!

dnsmasq for DHCPv6 stores in lease file IAID, not DUID. But assignment
of address is done either by DUID or MAC address.

I think you hit some problem affected by the way how is IPv6 address
assigned according to DUID, IAID, MAC address and status of lease file.

2 years ago I tried to discuss with Simon about possibility to assign
one address to more DHCP requests identified by MAC address and one of
needed thing was probably extension of lease file (to include also MAC
address and DUID) and handling of requests which already have address
assigned in lease file. Apparently until now Simon has not response
about it and I gave up trying to ping him again...

http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2016q1/010404.html
--
Pali Rohár
***@gmail.com
Kevin Darbyshire-Bryant
2018-05-25 13:30:57 UTC
Permalink
Post by Oliver Freyermuth
Dear dnsmasqers,
I fear the following is a design issue of DHCPv6, but I wonder if there's a way to overcome it with dnsmasq...
<snip>

Hi Oliver,

I’ve a similar/same problem when rebooting some QNAP NAS boxen, first boot/introduction to dnsmasq and they get both IPv4 & v6 addresses set to fixed values based on MAC address. On reboot whilst IPv4 is fine, IPv6 is not reallocated to the original address but rather a new one. By curious co-incidence I just started looking into this problem today though it has been bugging me for months :-) Have tried various combinations of MAC address & DUID.

Without meaning to thread hijack! If it’s not effectively the same issue will gladly start a new thread.


First boot with fresh dnsmasq
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 client MAC address: 24:5e:be:0c:bc:ba
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 DHCPREQUEST(br-lan) 00:01:00:01:22:9a:b4:43:24:5e:be:0c:bc:ba
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 DHCPREPLY(br-lan) 2a02:c7f:beef:2000::e 00:01:00:01:22:9a:b4:43:24:5e:be:0c:bc:ba Statler
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 tags: lan, known, dhcpv6, br-lan
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 sent size: 14 option: 2 server-id 00:01:00:01:21:92:2f:dc:60:e3:27:af:9e:51
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 sent size: 40 option: 3 ia-na IAID=3132886206 T1=21600 T2=37800
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 nest size: 24 option: 5 iaaddr 2a02:c7f:beef:2000::e PL=43200 VL=43200
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 sent size: 9 option: 13 status 0 success
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 sent size: 1 option: 7 preference 255
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 sent size: 29 option: 24 domain-search lan.darbyshire-bryant.me.uk
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 sent size: 16 option: 23 dns-server 2a02:c7f:beef:2000::da2b:da2b
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 sent size: 38 option: 39 FQDN Statler.lan.darbyshire-bryant.me.uk


And now a reboot of the client:
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 available DHCP range: 2a02:c7f:beef:2000::1000 -- 2a02:c7f:beef:2000::ffff
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 client MAC address: 24:5e:be:0c:bc:ba
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 DHCPSOLICIT(br-lan) 00:01:00:01:22:9a:b7:2b:24:5e:be:0c:bc:ba
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 DHCPADVERTISE(br-lan) 2a02:c7f:beef:2000::9c72 00:01:00:01:22:9a:b7:2b:24:5e:be:0c:bc:ba Statler
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 tags: lan, known, dhcpv6, br-lan
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 sent size: 14 option: 1 client-id 00:01:00:01:22:9a:b7:2b:24:5e:be:0c:bc:ba
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 sent size: 14 option: 2 server-id 00:01:00:01:21:92:2f:dc:60:e3:27:af:9e:51
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 sent size: 40 option: 3 ia-na IAID=3132886206 T1=21600 T2=37800
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 nest size: 24 option: 5 iaaddr 2a02:c7f:beef:2000::9c72 PL=43200 VL=43200
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 sent size: 9 option: 13 status 0 success
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 sent size: 1 option: 7 preference 255
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 sent size: 29 option: 24 domain-search lan.darbyshire-bryant.me.uk
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 sent size: 16 option: 23 dns-server 2a02:c7f:beef:2000::da2b:da2b
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 sent size: 9 option: 39 FQDN Statler
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 available DHCP range: 2a02:c7f:beef:2000::1000 -- 2a02:c7f:beef:2000::ffff
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 client MAC address: 24:5e:be:0c:bc:ba
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 DHCPREQUEST(br-lan) 00:01:00:01:22:9a:b7:2b:24:5e:be:0c:bc:ba
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 DHCPREPLY(br-lan) 2a02:c7f:beef:2000::9c72 00:01:00:01:22:9a:b7:2b:24:5e:be:0c:bc:ba Statler
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 tags: lan, known, dhcpv6, br-lan
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 sent size: 14 option: 1 client-id 00:01:00:01:22:9a:b7:2b:24:5e:be:0c:bc:ba
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 sent size: 14 option: 2 server-id 00:01:00:01:21:92:2f:dc:60:e3:27:af:9e:51
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 sent size: 40 option: 3 ia-na IAID=3132886206 T1=21600 T2=37800
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 nest size: 24 option: 5 iaaddr 2a02:c7f:beef:2000::9c72 PL=43200 VL=43200
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 sent size: 9 option: 13 status 0 success
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 sent size: 1 option: 7 preference 255
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 sent size: 29 option: 24 domain-search lan.darbyshire-bryant.me.uk
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 sent size: 16 option: 23 dns-server 2a02:c7f:beef:2000::da2b:da2b
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 sent size: 38 option: 39 FQDN Statler.lan.darbyshire-bryant.me.uk



Cheers,

Kevin D-B

012C ACB2 28C6 C53E 9775 9123 B3A2 389B 9DE2 334A
Oliver Freyermuth
2018-05-25 13:34:08 UTC
Permalink
Post by Kevin Darbyshire-Bryant
Post by Oliver Freyermuth
Dear dnsmasqers,
I fear the following is a design issue of DHCPv6, but I wonder if there's a way to overcome it with dnsmasq...
<snip>
Hi Oliver,
I’ve a similar/same problem when rebooting some QNAP NAS boxen, first boot/introduction to dnsmasq and they get both IPv4 & v6 addresses set to fixed values based on MAC address. On reboot whilst IPv4 is fine, IPv6 is not reallocated to the original address but rather a new one. By curious co-incidence I just started looking into this problem today though it has been bugging me for months :-) Have tried various combinations of MAC address & DUID.
Without meaning to thread hijack! If it’s not effectively the same issue will gladly start a new thread.
Dear Kevin,

I think it's exactly the same issue.
Post by Kevin Darbyshire-Bryant
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 DHCPREQUEST(br-lan) 00:01:00:01:22:9a:b4:43:24:5e:be:0c:bc:ba
with
Post by Kevin Darbyshire-Bryant
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 DHCPSOLICIT(br-lan) 00:01:00:01:22:9a:b7:2b:24:5e:be:0c:bc:ba
it seems the QNAP NAS box is using a fresh client DUID each reboot...

Cheers,
Oliver
Post by Kevin Darbyshire-Bryant
First boot with fresh dnsmasq
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 client MAC address: 24:5e:be:0c:bc:ba
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 DHCPREQUEST(br-lan) 00:01:00:01:22:9a:b4:43:24:5e:be:0c:bc:ba
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 DHCPREPLY(br-lan) 2a02:c7f:beef:2000::e 00:01:00:01:22:9a:b4:43:24:5e:be:0c:bc:ba Statler
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 tags: lan, known, dhcpv6, br-lan
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 sent size: 14 option: 2 server-id 00:01:00:01:21:92:2f:dc:60:e3:27:af:9e:51
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 sent size: 40 option: 3 ia-na IAID=3132886206 T1=21600 T2=37800
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 nest size: 24 option: 5 iaaddr 2a02:c7f:beef:2000::e PL=43200 VL=43200
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 sent size: 9 option: 13 status 0 success
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 sent size: 1 option: 7 preference 255
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 sent size: 29 option: 24 domain-search lan.darbyshire-bryant.me.uk
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 sent size: 16 option: 23 dns-server 2a02:c7f:beef:2000::da2b:da2b
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 sent size: 38 option: 39 FQDN Statler.lan.darbyshire-bryant.me.uk
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 available DHCP range: 2a02:c7f:beef:2000::1000 -- 2a02:c7f:beef:2000::ffff
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 client MAC address: 24:5e:be:0c:bc:ba
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 DHCPSOLICIT(br-lan) 00:01:00:01:22:9a:b7:2b:24:5e:be:0c:bc:ba
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 DHCPADVERTISE(br-lan) 2a02:c7f:beef:2000::9c72 00:01:00:01:22:9a:b7:2b:24:5e:be:0c:bc:ba Statler
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 tags: lan, known, dhcpv6, br-lan
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 sent size: 14 option: 1 client-id 00:01:00:01:22:9a:b7:2b:24:5e:be:0c:bc:ba
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 sent size: 14 option: 2 server-id 00:01:00:01:21:92:2f:dc:60:e3:27:af:9e:51
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 sent size: 40 option: 3 ia-na IAID=3132886206 T1=21600 T2=37800
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 nest size: 24 option: 5 iaaddr 2a02:c7f:beef:2000::9c72 PL=43200 VL=43200
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 sent size: 9 option: 13 status 0 success
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 sent size: 1 option: 7 preference 255
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 sent size: 29 option: 24 domain-search lan.darbyshire-bryant.me.uk
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 sent size: 16 option: 23 dns-server 2a02:c7f:beef:2000::da2b:da2b
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 sent size: 9 option: 39 FQDN Statler
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 available DHCP range: 2a02:c7f:beef:2000::1000 -- 2a02:c7f:beef:2000::ffff
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 client MAC address: 24:5e:be:0c:bc:ba
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 DHCPREQUEST(br-lan) 00:01:00:01:22:9a:b7:2b:24:5e:be:0c:bc:ba
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 DHCPREPLY(br-lan) 2a02:c7f:beef:2000::9c72 00:01:00:01:22:9a:b7:2b:24:5e:be:0c:bc:ba Statler
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 tags: lan, known, dhcpv6, br-lan
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 sent size: 14 option: 1 client-id 00:01:00:01:22:9a:b7:2b:24:5e:be:0c:bc:ba
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 sent size: 14 option: 2 server-id 00:01:00:01:21:92:2f:dc:60:e3:27:af:9e:51
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 sent size: 40 option: 3 ia-na IAID=3132886206 T1=21600 T2=37800
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 nest size: 24 option: 5 iaaddr 2a02:c7f:beef:2000::9c72 PL=43200 VL=43200
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 sent size: 9 option: 13 status 0 success
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 sent size: 1 option: 7 preference 255
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 sent size: 29 option: 24 domain-search lan.darbyshire-bryant.me.uk
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 sent size: 16 option: 23 dns-server 2a02:c7f:beef:2000::da2b:da2b
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 15821508 sent size: 38 option: 39 FQDN Statler.lan.darbyshire-bryant.me.uk
Cheers,
Kevin D-B
012C ACB2 28C6 C53E 9775 9123 B3A2 389B 9DE2 334A
P W
2018-05-25 15:23:20 UTC
Permalink
Post by Oliver Freyermuth
Post by Kevin Darbyshire-Bryant
Post by Oliver Freyermuth
Dear dnsmasqers,
I fear the following is a design issue of DHCPv6, but I wonder if there's a way to overcome it with dnsmasq...
<snip>
Hi Oliver,
I???ve a similar/same problem when rebooting some QNAP NAS boxen,
first boot/introduction to dnsmasq and they get both IPv4 & v6
addresses set to fixed values based on MAC address. On reboot whilst
IPv4 is fine, IPv6 is not reallocated to the original address but
rather a new one. By curious co-incidence I just started looking
into this problem today though it has been bugging me for months :-)
Have tried various combinations of MAC address & DUID.
Dear Kevin,
I think it's exactly the same issue.
Post by Kevin Darbyshire-Bryant
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 DHCPREQUEST(br-lan) 00:01:00:01:22:9a:b4:43:24:5e:be:0c:bc:ba
with
Post by Kevin Darbyshire-Bryant
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 DHCPSOLICIT(br-lan) 00:01:00:01:22:9a:b7:2b:24:5e:be:0c:bc:ba
it seems the QNAP NAS box is using a fresh client DUID each reboot...
Patches Welcome
Oliver Freyermuth
2018-05-27 17:36:18 UTC
Permalink
Post by P W
Post by Oliver Freyermuth
Post by Kevin Darbyshire-Bryant
Post by Oliver Freyermuth
Dear dnsmasqers,
I fear the following is a design issue of DHCPv6, but I wonder if there's a way to overcome it with dnsmasq...
<snip>
Hi Oliver,
I???ve a similar/same problem when rebooting some QNAP NAS boxen,
first boot/introduction to dnsmasq and they get both IPv4 & v6
addresses set to fixed values based on MAC address. On reboot whilst
IPv4 is fine, IPv6 is not reallocated to the original address but
rather a new one. By curious co-incidence I just started looking
into this problem today though it has been bugging me for months :-)
Have tried various combinations of MAC address & DUID.
Dear Kevin,
I think it's exactly the same issue.
Post by Kevin Darbyshire-Bryant
Fri May 25 12:47:13 2018 daemon.info dnsmasq-dhcp[26168]: 5514926 DHCPREQUEST(br-lan) 00:01:00:01:22:9a:b4:43:24:5e:be:0c:bc:ba
with
Post by Kevin Darbyshire-Bryant
Fri May 25 12:59:40 2018 daemon.info dnsmasq-dhcp[26168]: 12603117 DHCPSOLICIT(br-lan) 00:01:00:01:22:9a:b7:2b:24:5e:be:0c:bc:ba
it seems the QNAP NAS box is using a fresh client DUID each reboot...
Patches Welcome
At the moment, there's sadly too much in my queue to start on another OpenSource project - but I'll look into it once this changes,
which sadly won't be in the very near future.
If anybody else has time at hand, of course I can offer to test a patch (the setup is here).

Cheers,
Oliver
Post by P W
_______________________________________________
Dnsmasq-discuss mailing list
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Josh Soref
2018-07-23 00:07:22 UTC
Permalink
Can you cheat and just set the lease expiration to be measured in seconds?

I suspect that you can have different lease times, so if you can
discriminate between first state and second state systems, you can provide
more reasonable lease durations once the systems are stage two...
Loading...