[Dnsmasq-discuss] default lease time for dhcp-host entries ?

Simon Kelley simon at thekelleys.org.uk
Mon Dec 16 21:27:27 GMT 2013


On 16/12/13 21:00, Maule Mark wrote:
> As an alternative to a fake tag to remove the empty field, would it work
> to declare a static dhcp-range in my configuration file to cover the
> addresses that are managed by the hostsfile?
>

No. As you'd expect, lease times configured for individual hosts 
override those in dhcp-ranges.

I looked at the code, and it looks like the problem is indeed the double 
comma.

,,

gets treated that same as

,0,

ie a lease time of zero.

That's a bug, but the easiest way for you to work around it is to avoid 
the double comma.

Cheers,

Simon.

>
> On Monday, December 16, 2013 2:47 PM, Maule Mark <mark_maule at yahoo.com>
> wrote:
>
>     I don't think our client is asking for a lease time.  Or if it was,
>     I would also expect it to make the request on the very first
>     DHCPREQUEST, which gets the correct 1h lease.
>
>     The double comma is to establish a placeholder field where we can
>     plug in an optional tag: field, which we do in certain situations to
>     influence the next dhcp exchange for this id.  The program we use to
>     manage this file rigidly expects each line to have the same number
>     of fields if this optional tag exists or not..  I'll try putting a
>     fake tag in that field and see if it solves the 2m lease time issue.
>
>
>
>
>     On Monday, December 16, 2013 2:28 PM, Simon Kelley
>     <simon at thekelleys.org.uk> wrote:
>
>         On 16/12/13 19:36, Maule Mark wrote:
>          > I'm seeing an unexptected (to me) behavior when using a dnsmasq
>          > hostsfile and dhcp.  To start, my interface (pmi_if) is
>         configured with
>          > a lease time of 1h (the default), and I have a blank hostsfile.
>          >
>          > dhcp-leasefile=/var/lib/axiom/dnsmasq_pmi.leases
>          > dhcp-hostsfile=/var/lib/axiom/dnsmasq_pmi_hostsfile
>          > dhcp-range=172.30.80.0,static,255.255.255.0
>          > dhcp-range=172.30.80.200,172.30.80.240,255.255.255.0
>          > dhcp-lease-max=255
>          > dhcp-option=option:dns-server,172.30.80.1
>          > dhcp-option=option:router,172.30.80.1
>          > dhcp-option=option:ntp-server,172.30.80.1,172.30.80.2,172.30.80.3
>          > dhcp-option=option:default-ttl,50
>          > dhcp-option=option:all-subnets-local,1
>          > dhcp-script=/var/lib/axiom/dhcp-script-pmi.sh
>          > dhcp-boot=/pds/pxe/pxelinux.0,172.30.80.1
>          >
>          > Clients boot and are assigned dhcp addresses as expected.  We
>         have a
>          > program in our software stack that looks for heartbeat
>         messages on this
>          > pmi_if, and when detected, constructs a hostsfile entry for
>         the client
>          > that looks like this:
>          >
>          > [root at pilot2 <mailto:root at pilot2> axiom]# cat
>         dnsmasq_pmi_hostsfile
>          >
>         00:21:28:A1:F3:F2,00:21:28:A1:F3:F3,,WN5080020001592690,172.30.80.128
>          >
>         00:21:28:A1:CA:3A,00:21:28:A1:CA:3B,,WN5080020001592691,172.30.80.129
>          >
>          > The clients are running udhcpc from busybox.
>          >
>          > Everything works as expected until the clients get toward the
>         end of
>          > their 1h lease period at which point the clients start sending
>          > DHCPREQUEST requests.  It seems at this point, that the
>         leases granted
>          > are now 120s.  Here's some syslog output showing the first
>         DHCPREQUEST
>          > being sent about 55 minutes into the 1h initial lease.  Why
>         did dnsmasq
>          > return a lease time of 12s in this case?
>          >
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817
>          > DHCPREQUEST(pmi_if) 172.30.80.129 00:21:28:a1:ca:3a
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817
>          > tags: known, pmi_if
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817
>          > DHCPACK(pmi_if) 172.30.80.129 00:21:28:a1:ca:3a
>         WN5080020001592691
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817
>          > requested options: 1:netmask, 3:router, 6:dns-server,
>         12:hostname,
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817
>          > requested options: 15:domain-name, 28:broadcast, 42:ntp-server
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817
>          > bootfile name: /pds/pxe/pxelinux.0
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817
>          > server name: 172.30.80.1
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817 next
>          > server: 172.30.80.3
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817 sent
>          > size:  1 option: 53 message-type  5
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817 sent
>          > size:  4 option: 54 server-identifier  172.30.80.3
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817 sent
>          > size:  4 option: 51 lease-time  2m
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817 sent
>          > size:  4 option: 58 T1  56s
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817 sent
>          > size:  4 option: 59 T2  1m41s
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817 sent
>          > size:  4 option:  1 netmask  255.255.255.0
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817 sent
>          > size:  4 option: 28 broadcast  172.30.80.255
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817 sent
>          > size:  5 option: 15 domain-name  axiom
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817 sent
>          > size: 18 option: 12 hostname  WN5080020001592691
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817 sent
>          > size: 20 option:209  70:78:65:6c:69:6e:75:78:2e:63:66:67:2f:64...
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817 sent
>          > size:  4 option:208  f1:00:74:7e
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817 sent
>          > size: 12 option: 42 ntp-server  172.30.80.1, 172.30.80.2,
>         172.30.80.3
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817 sent
>          > size:  4 option:  3 router  172.30.80.1
>          > 2013-12-16 19:33:42.253+00:00 pilot2 dnsmasq-dhcp[23916]:
>         208328817 sent
>          > size:  4 option:  6 dns-server  172.30.80.1
>          >
>          >
>          > Is there a default lease time of 120s for client requests whose
>          > addresses which match a hoststfile entry?.
>
>         No, there's no 120s default, but there is a 120s floor (ie no
>         lease less
>         the 120s will be issued).
>
>         Note that the DHCP _client_ can ask for a particular lease time, it
>         would be interesting to see if it's sending a lease-time option
>         for 120s
>         or less in the DHCPREQUEST packet.
>
>         Another potential issue is your hostfile:
>
>         00:21:28:A1:CA:3A,00:21:28:A1:CA:3B,,WN5080020001592691,172.30.80.129
>
>         I've not looked, but the double comma may concievably confuse
>         the parser
>         such that it looks like a zero, which then gets interpreted as a
>         lease
>         time, and transformed to 120s by the floor.
>
>         I think that is the most likely explanation.
>
>         Cheers,
>
>         Simon.
>
>
>          >
>          > thanks
>          > Mark
>
>          >
>          >
>          >
>          > _______________________________________________
>          > Dnsmasq-discuss mailing list
>          > Dnsmasq-discuss at lists.thekelleys.org.uk
>         <mailto:Dnsmasq-discuss at lists.thekelleys.org.uk>
>          > http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>          >
>
>
>         _______________________________________________
>         Dnsmasq-discuss mailing list
>         Dnsmasq-discuss at lists.thekelleys.org.uk
>         <mailto:Dnsmasq-discuss at lists.thekelleys.org.uk>
>         http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>
>
>
>
>     _______________________________________________
>     Dnsmasq-discuss mailing list
>     Dnsmasq-discuss at lists.thekelleys.org.uk
>     <mailto:Dnsmasq-discuss at lists.thekelleys.org.uk>
>     http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>
>




More information about the Dnsmasq-discuss mailing list