[Dnsmasq-discuss] Questions about DHCP persistence and lease times
Jesus M Diaz
jesusm.diazperez at gmail.com
Fri Sep 3 14:35:23 UTC 2021
On Fri, 3 Sept 2021 at 15:16, Chris Green <cl at isbd.net> wrote:
> On Fri, Sep 03, 2021 at 01:58:54PM +0100, Jesus M Diaz wrote:
> > I wasn't considering erasing/deleting the dnsmasq.leases file, I was
> > rather thinking of copying it to a non-running backup dnsmasq so
> > that
> > if/when the running dnsmasq fails I can start the other and it will
> > give out the same IPs.
> >
> > Do you really need this? I mean, if dhcp server dies and you have a
> > stand-by backup that takes over immediately, the renew request from
> the
> > hosts will be to use the same IP address, so if you don't have the
> > dnsmasq.lease file, ergo there are no leases at the moment, dnsmasq
> > would grant the same (requested) IP address.
>
> That's why I asked the question about persistence of IP address, does
> a client give a 'hint' to the DHCP server that it would like the same
> IP again? However it's trivial to copy the contents of the leases
> file across so it's not a big issue.
>
>
This is the (reduced) log for a DHCP request (renew):
Sep 3 14:30:23 cinemateka dnsmasq-dhcp[1584]: 3647601719 DHCPREQUEST(eth0)
192.168.0.13 56:de:02:57:de:02
Sep 3 14:30:23 cinemateka dnsmasq-dhcp[1584]: 3647601719 DHCPACK(eth0)
192.168.0.13 56:de:02:57:de:02 outdoor
You can see the client (56:de:02:57:de:02) requests the in-use IP address.
If it is a valid one, the server will accept and ack it.
If the request is not valid (for whatever reason), the server denies, and
the host initiates a new request (without previous IP address)
Sep 3 12:12:53 cinemateka dnsmasq-dhcp[1584]: 1717759439 DHCPREQUEST(eth0)
192.168.0.215 56:de:02:09:15:3e
Sep 3 12:12:53 cinemateka dnsmasq-dhcp[1584]: 1717759439 DHCPNAK(eth0)
192.168.0.215 56:de:02:09:15:3e address in use
Sep 3 12:12:56 cinemateka dnsmasq-dhcp[1584]: 1717759440
DHCPDISCOVER(eth0) 56:de:02:09:15:3e
Sep 3 12:12:56 cinemateka dnsmasq-dhcp[1584]: 1717759440 DHCPOFFER(eth0)
192.168.0.222 56:de:02:09:15:3e
Sep 3 12:12:56 cinemateka dnsmasq-dhcp[1584]: 1717759440
DHCPDISCOVER(eth0) 56:de:02:09:15:3e
Sep 3 12:12:56 cinemateka dnsmasq-dhcp[1584]: 1717759440 DHCPOFFER(eth0)
192.168.0.222 56:de:02:09:15:3e
Sep 3 12:12:57 cinemateka dnsmasq-dhcp[1584]: 1717759440 DHCPREQUEST(eth0)
192.168.0.222 56:de:02:09:15:3e
Sep 3 12:12:57 cinemateka dnsmasq-dhcp[1584]: 1717759440 DHCPACK(eth0)
192.168.0.222 56:de:02:09:15:3e XXXXXXX
> >
> > The only other issue is then how to tell 'everyone' that the DNS
> > server has
> > changed address.
> >
> > Why don't you always include both DNS servers, so if one dies, the
> > second one will be there anyway?
>
> I was thinking about the usual "one local server and 1.1.1.1 or
> 8.8.8.8 as secondary" but now I think about it I suppose there's
> nothing difficult about providing two local servers. However will
> having one of them non-functional slow things down at all?
>
>
> So:-
>
> 1 - How do I configure dnsmasq to give two DNS server addresses?
>
> 2 - Will only actually having one listening cause any delay?
>
>
2 examples:
option:dns-server,192.168.0.99,192.168.0.1 # 2 static dns server
option:dns-server,0.0.0.0 # 0.0.0.0 dns server means
'DHCP server IP address'
> --
> Chris Green
>
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20210903/11301169/attachment.htm>
More information about the Dnsmasq-discuss
mailing list