A DHCP client will try to renew it's lease half way through the time span of the lease by talking to the DHCP server it got the lease from. It will continue to use the address for the rest of the lease span if it doesn't get a reply, and 7/8ths of the time through the lease it will start to broadcast the renewal, in case another DHCP server at a different address has taken over.
If you use long DHCP leases, (say, a few days) then worrying about DHCP failover is necessary: as long as you can get the DHCP server back up within a day, nothing will lose net access. On 03/09/2021 11:31, Chris Green wrote: > Two questions really:- > > Is the file /var/lib/misc/dnsmasq.leases the only place where > dnsmasq keeps DHCP/IP/Name information across restarts? I.e. if I > delete that file will new DHCP requests get new IPs? (or does the > client have some memory of the last IP it got?) > > > If a client's DHCP lease expires and it sends a new DHCP request > out, which fails, will it continue to use the old values or will > it just die? > If dnsmasq comes back up without the DHCP lease database, what happens depends. It will see renewals for leases it doesn't know about, and the standard says it should do nothing in that circumstance (since another DHCP server may be handling the lease.) By default that's what it does. If you set the --dhcp-authoritative option, it will handle the renewal as normal, as far as the client is concerned, and put the lease back into the database. Thus is you delete the lease database, and wait the time span of a DHCP lease all the deleted leases will magically reappear, with their existing IP addresses. This is more useful behaviour when you have a small network with no DHCP failover than the standard. There's one expception to the magical lease database regeneration. If a new client comes along before all the old clients have renewed, then it might be offered an IP address which is in use by an existing client which hadn't renewed yet, so the DHCP server doesn't know about it. You can then get two machines with the same address, which is bad. In practise, this is very unlikely, since the system checks for duplicate address use. The only really possible situation is that an existing client is down when the DHCP server loses the database, and when it comes up, another client has grabbed its former address and it gets given a different one. Because dnsmasq tries to allocate IP addresses based on a hash of the MAC address, using a large range of IP addresses, relative to the number of clients, makes even this less likely. S. > > I realise /var/lib/misc/dnsmasq.leases is not cast in stone and could > be a different file but I'm sure it's clear what question I'm asking. > _______________________________________________ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss