[Dnsmasq-discuss] Dnsmasq fails to offer static lease (IPv4) occasionally

Timo Sigurdsson public_timo.s at silentcreek.de
Mon Jan 11 14:44:52 GMT 2016


Hi,

I'm using dnsmasq on OpenWrt as my DHCP and DNS server for my home network. I set
up static leases for all my clients which mostly works well, but sometimes
dnsmasq fails to offer the static IPv4 lease to some of my clients. Instead, they
will get a dynamic IP. Now this doesn't happen too often (sometimes it works for
2 weeks without any issue), but it does happen occasionally (sometimes even with 2 clients on the
same day).

Some basic information:
- I first used the OpenWrt configuration interface UCI to set up the static
leases. But after I became aware of the occasional dynamic assignments, I
switched to configuring the static leases via /etc/hosts and /etc/ethers instead.
But that didn't solve it.

- I have a total of 16 static leases defined which covers all my network devices.
I only use static leases for IPv4. The IP range dnsmasq can use is big enough (100 addresses) and all static leases are within that range, of course.

- The clients with which I saw this problem don't have much in common. One is a
wired desktop computer running Windows 7. The other is a wireless MacBook Air
running OS X. The only similarity I find is that these are both clients that are
not running 24/7. They are often shut down and also often go to standby and wake
up from it. I have two servers on the network that are always connected and with
them I haven't observed any false IP assignment yet.

- All clients have only one way to connect to the network. So, there are no
laptops that would sometimes connect wireless and sometimes wired or anything like that.

- I tried different lease times from 2h to 12h with no effect so far.

- Before I started using OpenWrt with dnsmasq, I used a Linksys Router with the
proprietary vendor firmware and had set up the same static leases there, too. I
never observed such an issue with any of these (same) clients, so it shouldn't be caused by the clients themselves.

When a client does not receive the correct static lease, I can see in the logs
that dnsmasq doesn't send a DHCPOFFER after a DHCPDISCOVER. But I don't see why.
I can see, though, that when a client gets a dynamic IP instead of a static one,
dnsmasq refuses to assign the local domain name (hostname.lan) to this client
that is listed in /etc/hosts. So, dnsmasq seems to recognize the client after
all, but fails to offer the static lease. Since I have only seem this problem so
far with clients that often disconnect and reconnect or go to standby and wake up
again, I just assume that it might have to do something with DHCP leases that
haven't expired yet. That's why I tried diffent lease times but so far with no
luck. Another thing I noticed is: When a client get's a dynamic lease and asks for renewal of the lease at some point, dnsmasq will just acknowledge this request rather than assigning the static lease to the client. So unless I force the client to reconnect (and sometimes reboot the router), they will just keep using the dynamic lease.

What ca I do to prevent this from happening? How can I ensure clients will be
served the correct static lease?
In addition, what is a good or recommended lease time for a home network where
clients should keep the same IP address and where there is a mix of wired and
wireless clients?

I had asked this on the OpenWrt forums before, but nobody was able to help me
there. So, I'd really appreciate any insights or hints you might have. Thanks.

Regards,

Timo




More information about the Dnsmasq-discuss mailing list