[Dnsmasq-discuss] DHCP renew and rebind time weirdness

Johan Kruger johan at thekrugers.com
Fri Nov 29 08:15:22 GMT 2019


Hi,



Just to add to the comedy, and set folks' minds at ease about dnsmasq...



When I started running dhcpdump to do more diagnostics (when isc-dhcp-server stared responding with 5 minute lease times) I discovered that the nmap command I was using to test was specifically requesting a 1 second lease, so dnsmasq was replying with the default minimum lease time of 2 minutes... oops.



The issue I had on Windows hosts was a client weirdness, it was trying to renew a lease issued by a temporary DHCP server I had running on an old LTE router while I was upgrading my Raspbian box. Once I did a ipconfig /release followed by ipconfig /renew instead of just ipconfig /renew everything went back to normal. You would think the Windows IP stack would send out a broadcast for a new address if it can't see the last DHCP server it contacted, but oh well.



I expect I'll have to just forget the wireless network and reconnect with my Android devices to get those to start getting leases properly again.





---- On Thu, 28 Nov 2019 23:09:15 +0200 Geert Stappers <stappers at stappers.nl> wrote ----


On Thu, Nov 28, 2019 at 09:49:43PM +0200, Johan Kruger wrote: 
> 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. 
 
Whatever works for you and thanks for the joke 
 
 
 
_______________________________________________ 
Dnsmasq-discuss mailing list 
mailto:Dnsmasq-discuss at lists.thekelleys.org.uk 
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20191129/05dbd3ec/attachment.html>


More information about the Dnsmasq-discuss mailing list