[Dnsmasq-discuss] leases being removed from lease file on startup

Simon Kelley simon at thekelleys.org.uk
Sat Oct 29 10:53:32 BST 2011


On 29/10/11 01:44, Tom Metro wrote:
> I have Dnsmasq v2.57 running on a router (Tomato USB), where it gets
> invoked as 'dnsmasq -c 1500 --log-async' and uses a config like (edited):
>
> interface=br0
> resolv-file=/etc/resolv.dnsmasq
> addn-hosts=/etc/dnsmasq/hosts
> dhcp-hostsfile=/etc/dnsmasq/dhcp
> expand-hosts
> min-port=4096
> stop-dns-rebind
> rebind-localhost-ok
> dhcp-range=192.168.1.100,192.168.1.149,255.255.255.0,10080m
> dhcp-option=3,192.168.1.1
> dhcp-lease-max=255
> dhcp-authoritative
>
> # persistent lease file
> dhcp-leasefile=/mnt/ext_flash/var/run/dhcp-leases
>
> # static DHCP hosts
> dhcp-host=00:14:d1:f1:c7:e6,cctv1,192.168.1.225,infinite
>
>
> The router gets rebooted daily, and I'm trying to get the "static" lease
> to persist across reboots. Here's what I'm seeing:
>
> 1. Router restarts.
> 2. cctv1 reboots, requests a lease, and is added to lease file.
> 3. cctv1 is pingable by name.
> 4. Router is rebooted.
> 5. Initially cctv1 still exists in lease file.
> 6. A ping of cctv1 fails with a bad host name, and has disappeared from
> the lease file.
>
> The expectation is that in step 6 the cctv1 client should still be
> pingable. What caused it to disappear from the lease file?

The expiration time (first field in the relevant line in the leases 
file) is less (earlier) than the current time. You configuration means 
that dnsmasq will offer an infinite lease to the cctv, but it may choose 
to take out a shorter lease. What value is there.

The following hack may solve your problem.

1) stop dnsmasq
2) edit the leases file and make the lease expiry time for cctv1 0
3) restart dnsmasq

Note that 0 means "infinite - never expires" in this context.
>
>
> Also, I don't understand how the 'dhcp-authoritative' directive (quoting
> the man page) "allows dnsmasq to rebuild its lease database without each
> client needing to reacquire a lease, if the database is lost." I'm not
> sure how that could work.

The relevant situation is when a client renews a lease which  dnsmasq 
doesn't know about. without "dhcp-authoritative" it will reject the 
transaction and cause the client to go through a complete DHCP cycle - 
that complies with the standard. With "dhcp-authoritative" is will 
quietly put the lease into the database and continue as if nothing were 
wrong.

HTH

Simon.


>
>   -Tom
>




More information about the Dnsmasq-discuss mailing list