[Dnsmasq-discuss] DHCP lease-time weirdness
Johan Kruger
johan at thekrugers.com
Thu Nov 28 19:49:43 GMT 2019
Hi,
I have a fairly simple DHCP setup on a Raspbian box, using dnsmasq 2.80. The relavant options in /etc/dnsmasq.conf are (yes, my home LAN is 10.168.8.0/24):
dhcp-range=10.168.8.10,10.168.8.200 # Also tried with 12h on the end, no difference
dhcp-authoritative
log-dhcp
I'm testing by running "dnsmasq -d" in a shell, so I can see what's going on.
When dnsmasq gets a DHCP request (I'm using "nmap --script broadcast-dhcp-discover" on another box to test), I see the following:
dnsmasq-dhcp: 811185697 broadcast response
dnsmasq-dhcp: 811185697 sent size: 1 option: 53 message-type 2
dnsmasq-dhcp: 811185697 sent size: 4 option: 54 server-identifier 10.168.8.254
dnsmasq-dhcp: 811185697 sent size: 4 option: 51 lease-time 2m
dnsmasq-dhcp: 811185697 sent size: 4 option: 58 T1 1m
dnsmasq-dhcp: 811185697 sent size: 4 option: 59 T2 1m45s
dnsmasq-dhcp: 811185697 sent size: 4 option: 1 netmask 255.255.255.0
dnsmasq-dhcp: 811185697 sent size: 4 option: 28 broadcast 10.168.8.255
dnsmasq-dhcp: 811185697 sent size: 4 option: 3 router 10.168.8.254
dnsmasq-dhcp: 811185697 sent size: 4 option: 6 dns-server 10.168.8.254
dnsmasq-dhcp: 811185697 sent size: 16 option: 15 domain-name myhome
Notice the lease-time, T1 and T2 responses... 2 minutes??? Default should be 1 hour, and I get the same 2m if I specify 12h in the dhcp-range line.
I then added the following to the conf file:
dhcp-option=51,12h
dhcp-option=58,12h # DHCP Renewal (T1) Time
dhcp-option=59,12h # DHCP Rebinding (T2) Time
Then the response looked like this:
dnsmasq-dhcp: 1994188113 broadcast response
dnsmasq-dhcp: 1994188113 sent size: 1 option: 53 message-type 2
dnsmasq-dhcp: 1994188113 sent size: 4 option: 54 server-identifier 10.168.8.254
dnsmasq-dhcp: 1994188113 sent size: 4 option: 51 lease-time 2m
dnsmasq-dhcp: 1994188113 sent size: 4 option: 58 T1 1m
dnsmasq-dhcp: 1994188113 sent size: 4 option: 59 T2 1m45s
dnsmasq-dhcp: 1994188113 sent size: 4 option: 1 netmask 255.255.255.0
dnsmasq-dhcp: 1994188113 sent size: 4 option: 28 broadcast 10.168.8.255
dnsmasq-dhcp: 1994188113 sent size: 4 option: 3 router 10.168.8.254
dnsmasq-dhcp: 1994188113 sent size: 4 option: 6 dns-server 10.168.8.254
dnsmasq-dhcp: 1994188113 sent size: 16 option: 15 domain-name myhome
dnsmasq-dhcp: 1994188113 sent size: 4 option: 51 lease-time 12h
Two lease-time responses, at least the correct 12h one is second so the client uses that, but notice that T1 and T2 are still wrong.
The upshot is that most DHCP clients (Android and Windows anyway) just reject the response.
For now, I guess I'll have to install isc-dhcp-server, since 2.80 is the only version of dnsmasq available for Raspdian 10 (buster). Bit of overkill for a little home LAN only running a couple of devices, but there we have it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20191128/b8656d86/attachment.html>
More information about the Dnsmasq-discuss
mailing list