[Dnsmasq-discuss] DHCP renew and rebind time weirdness

Geert Stappers stappers at stappers.nl
Fri Nov 29 17:14:22 GMT 2019


On Fri, Nov 29, 2019 at 10:15:22AM +0200, Johan Kruger 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. 
> > 
> 
> 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.
 
Thanks for reporting back.

Yes, networksniffers (dhcpdump and friends) are really cool tools.
Infact "must have tools".


Groeten
Geert Stappers
-- 
Meten is weten, als je maar weet wat je meet.



More information about the Dnsmasq-discuss mailing list