Re: [Dnsmasq-discuss] When does dnsmasq read the leases file?
On Fri, Feb 11, 2022 at 08:32:27PM +0100, Matus UHLAR - fantomas via Dnsmasq-discuss wrote: > > > On 2/10/22 22:33, Chris Green wrote: > > > > As per the subject when does dnsmasq [re]read the leases file? > > > On Fri, Feb 11, 2022 at 12:16:52AM +0100, Petr Menšík wrote: > > > When it starts. It has own data stored in-memory and just rewrites lease > > > file. It would not read any new leases from it if some other service > > > pushed them there. If dnsmasq is restarted, it starts a new process. It > > > has to read all configuration all again, which has to be done for leases. > > On 11.02.22 09:01, Chris Green wrote: > > So does that mean there's no way to 'warm start' an instance of dnsmasq > > with a set of leases? > > as Petr said, when dnsmasq starts, it reads the leases file. > not after. > > > > > I am experimenting with my backup DHCP/DNS strategy and I have just > > > > stopped my dnsmasq server and started another listening on the first > > > > dnsmasq server's IP address. It's working OK'ish. However the new > > > > dnsmasq server doesn't (of course) know the name/IP pairs that the old > > > > dnsmasq server had in its memory. > > > > > > > > If I had copied the dnsmasq.lease file across from the old server to > > > > the new one would that help? Is there some way to tell dnsmasq to > > > > reload its memory from the file? If dnsmasq is restarted (e.g. by > > > > systemd) does it read the dnsmasq.leases file? > > > Surely when dnsmasq is stopped and then started it reads it's previous > > leases file so that it still knows the names/IPs of systems that it > > has provided IPs for. So if I copy that leases file to another system > > and start a copy of dnsmasq there (with same configuration as the one > > it's replacing) won't it read that leases file? > > since it reads leases file on start, copying them to second system and > starting dnsmasq there would cause reading the leases file. > > however, copying it to system with running dnsmasq would cause losing that > file. > > If you want dhcp synchronization, better use isc-dhcpd or kea-dhcpd. > > for manual (or semi-automatic) transition copying leases file could work. Yes, thanks all, I think I understand (the bits I need anyway). -- Chris Green ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Strange error when running 'host'
On Fri, Feb 11, 2022 at 04:06:52PM +, Chris Green wrote: > I am setting up my dnsmasq backup system(s) and have just moved to the > 'other' dnsmasq server, now I'm getting odd response to 'host' :- > > chris$ host esprimo > esprimo has address 192.168.1.3 > Host esprimo not found: 5(REFUSED) > chris$ host C475IP > C475IP has address 192.168.1.101 > Host C475IP not found: 5(REFUSED) > chris$ > > I have checked that I don't have two DNS servers running. Also if I > stop dnsmasq from listening I get no response. > > dig seems to produce a sensible response:- > > chris$ dig esprimo > > ; <<>> DiG 9.16.15-Ubuntu <<>> esprimo > ;; global options: +cmd > ;; Got answer: > ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47052 > ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 > > ;; OPT PSEUDOSECTION: > ; EDNS: version: 0, flags:; udp: 4096 > ;; QUESTION SECTION: > ;esprimo. IN A > > ;; ANSWER SECTION: > esprimo.0 IN A 192.168.1.3 > > ;; Query time: 8 msec > ;; SERVER: 127.0.0.1#53(127.0.0.1) > ;; WHEN: Fri Feb 11 15:59:11 GMT 2022 > ;; MSG SIZE rcvd: 52 > > > So what on earth have I misconfigured? > I've moved esprimo to 192.168.1.245 and it's (basically) working again. So I'm not in a sort of disaster area but I haven't a clue what was wrong with it being at 192.168.1.3. I've had supper and a drink now so it will have to wait until the morning. -- Chris Green ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Comments, can I add comments on same line as confiuguration?
Hello, On 12/3/2021 4:41 PM, Chris Green wrote: It's not explicitly allowed according te the man page but can I add comments to configuration lines in dnsmasq.conf, e.g. :- domain-needed # don't forward plain names dhcp-option=3,192.168.1.1 # default route On 03.12.21 19:40, john doe wrote: Are you seeing any issues while doing it/does Dnsmasq complains? BTW I'm curious about this too: have you tried this and got any errors or unexpected behaviour? -- Matus UHLAR - fantomas, uh...@fantomas.sk ; http://www.fantomas.sk/ Warning: I wish NOT to receive e-mail advertising to this address. Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu. Spam is for losers who can't get business any other way. ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] When does dnsmasq read the leases file?
On 2/10/22 22:33, Chris Green wrote: > As per the subject when does dnsmasq [re]read the leases file? On Fri, Feb 11, 2022 at 12:16:52AM +0100, Petr Menšík wrote: When it starts. It has own data stored in-memory and just rewrites lease file. It would not read any new leases from it if some other service pushed them there. If dnsmasq is restarted, it starts a new process. It has to read all configuration all again, which has to be done for leases. On 11.02.22 09:01, Chris Green wrote: So does that mean there's no way to 'warm start' an instance of dnsmasq with a set of leases? as Petr said, when dnsmasq starts, it reads the leases file. not after. > I am experimenting with my backup DHCP/DNS strategy and I have just > stopped my dnsmasq server and started another listening on the first > dnsmasq server's IP address. It's working OK'ish. However the new > dnsmasq server doesn't (of course) know the name/IP pairs that the old > dnsmasq server had in its memory. > > If I had copied the dnsmasq.lease file across from the old server to > the new one would that help? Is there some way to tell dnsmasq to > reload its memory from the file? If dnsmasq is restarted (e.g. by > systemd) does it read the dnsmasq.leases file? Surely when dnsmasq is stopped and then started it reads it's previous leases file so that it still knows the names/IPs of systems that it has provided IPs for. So if I copy that leases file to another system and start a copy of dnsmasq there (with same configuration as the one it's replacing) won't it read that leases file? since it reads leases file on start, copying them to second system and starting dnsmasq there would cause reading the leases file. however, copying it to system with running dnsmasq would cause losing that file. If you want dhcp synchronization, better use isc-dhcpd or kea-dhcpd. for manual (or semi-automatic) transition copying leases file could work. -- Matus UHLAR - fantomas, uh...@fantomas.sk ; http://www.fantomas.sk/ Warning: I wish NOT to receive e-mail advertising to this address. Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu. If Barbie is so popular, why do you have to buy her friends? ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Strange error when running 'host'
On 11.02.22 16:06, Chris Green wrote: I am setting up my dnsmasq backup system(s) and have just moved to the 'other' dnsmasq server, now I'm getting odd response to 'host' :- chris$ host esprimo esprimo has address 192.168.1.3 Host esprimo not found: 5(REFUSED) chris$ host C475IP C475IP has address 192.168.1.101 Host C475IP not found: 5(REFUSED) chris$ host by default checks for A, and MX records. apparently your primary nameserver returns REFUSED for or MX query. I have checked that I don't have two DNS servers running. Also if I stop dnsmasq from listening I get no response. dig seems to produce a sensible response:- chris$ dig esprimo ; <<>> DiG 9.16.15-Ubuntu <<>> esprimo ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47052 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;esprimo. IN A ;; ANSWER SECTION: esprimo.0 IN A 192.168.1.3 ;; Query time: 8 msec ;; SERVER: 127.0.0.1#53(127.0.0.1) ;; WHEN: Fri Feb 11 15:59:11 GMT 2022 ;; MSG SIZE rcvd: 52 So what on earth have I misconfigured? diy sends A query by default. -- Matus UHLAR - fantomas, uh...@fantomas.sk ; http://www.fantomas.sk/ Warning: I wish NOT to receive e-mail advertising to this address. Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu. Your mouse has moved. Windows NT will now restart for changes to take to take effect. [OK] ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Questions about /etc/hosts
On 10.02.22 19:24, Chris Green wrote: When running dnsmasq it (by default) uses /etc/hosts to provide some system's addresses. Some of my systems have their names in the /etc/hosts file against a loopback address so host t470 has:- 127.0.0.1 localhost 127.0.1.1 t470.zbmc.eu t470 While others only have their names against their (static) IP address so host backup has:- 192.168.1.1 2860n # Draytek router, internet 192.168.1.2 dns.zbmc.eu dns # this Pi running dnsmasq 192.168.1.3 esprimo zbmc.eu # my desktop system 192.168.1.4 backup.zbmc.eu backup # backup Raspberry Pi, also DNS/DHCP backup Is that 127.0.1.1 loopback address just so that there is an IP for a system to refer to itself (particularly in the case where it has DHCP assigned IP so there isn't a fixed address for itself)? debian and its derivatives do this (127.0.1.1 to local hostname), so: - the hostname is always reachable even if there's no network connection - 127.0.0.1 always maps to localhost (anything else could cause troubles). Where a system has a static/fixed IP is it OK to have only the 'localhost' loopback address and the 'real' static IP for 'self'? yes. I usually do this, so my hostname is reachable in case of DNS failure E.g. can one have:- 127.0.0.1 localhost 192.168.1.1 2860n # Draytek router, internet 192.168.1.2 dns.zbmc.eu dns # this Pi running dnsmasq 192.168.1.3 esprimo zbmc.eu # my desktop system 192.168.1.4 backup.zbmc.eu backup # backup Raspberry Pi, also DNS/DHCP backup As the /etc/hosts file on all of those systems (which have static IP)? as was already mentioned, the point of DNS is to avoid need to copy /etc/hosts contents. OTOH, I configured /etc/hosts on my home router, and dnsmasq can read it and use for both DNS and DHCP. -- Matus UHLAR - fantomas, uh...@fantomas.sk ; http://www.fantomas.sk/ Warning: I wish NOT to receive e-mail advertising to this address. Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu. There's a long-standing bug relating to the x86 architecture that allows you to install Windows. -- Matthew D. Fuller ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
[Dnsmasq-discuss] Strange error when running 'host'
I am setting up my dnsmasq backup system(s) and have just moved to the 'other' dnsmasq server, now I'm getting odd response to 'host' :- chris$ host esprimo esprimo has address 192.168.1.3 Host esprimo not found: 5(REFUSED) chris$ host C475IP C475IP has address 192.168.1.101 Host C475IP not found: 5(REFUSED) chris$ I have checked that I don't have two DNS servers running. Also if I stop dnsmasq from listening I get no response. dig seems to produce a sensible response:- chris$ dig esprimo ; <<>> DiG 9.16.15-Ubuntu <<>> esprimo ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47052 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;esprimo. IN A ;; ANSWER SECTION: esprimo.0 IN A 192.168.1.3 ;; Query time: 8 msec ;; SERVER: 127.0.0.1#53(127.0.0.1) ;; WHEN: Fri Feb 11 15:59:11 GMT 2022 ;; MSG SIZE rcvd: 52 So what on earth have I misconfigured? -- Chris Green ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Questions about /etc/hosts
On Fri, Feb 11, 2022 at 12:24:27AM +0100, Petr Menšík wrote: > I think we would need to know, which distribution and version you are > running. /etc/hosts is not directly controlled by dnsmasq. It is often > updated by system installation, which varies across distributions. > They're a mix of [x]ubuntu and Raspberry Pi systems, however the /etc/hosts have evolved with my changes added and removed over the years so they're a long way from default now. > Depends on how t470 and t470.zbmc.eu names are used any by what > services. I would recommend --local=/zbmc.eu/ or better auth-zone=zbmc.eu. > > I doubt host 127.0.1.1 were added automatically. Unless you don't know > what does use it, I would recommend to comment it out and reboot. Unless > you see any visible failures or delays during boot, it is safe to be > removed :) > I *think* I probably added the 127.0.1.1 so that t470 can 'talk to itself' by name as well as by using localhost. > Cheers, > Petr > > On 2/10/22 20:24, Chris Green wrote: > > When running dnsmasq it (by default) uses /etc/hosts to provide some > > system's addresses. > > > > Some of my systems have their names in the /etc/hosts file against > > a loopback address so host t470 has:- > > > > 127.0.0.1 localhost > > 127.0.1.1 t470.zbmc.eu t470 > > > > > > While others only have their names against their (static) IP address > > so host backup has:- > > > > 192.168.1.1 2860n # Draytek router, internet > > 192.168.1.2 dns.zbmc.eu dns # this Pi running dnsmasq > > 192.168.1.3 esprimo zbmc.eu # my desktop system > > 192.168.1.4 backup.zbmc.eu backup # backup Raspberry Pi, also > > DNS/DHCP backup > > > > > > Is that 127.0.1.1 loopback address just so that there is an IP for a > > system to refer to itself (particularly in the case where it has DHCP > > assigned IP so there isn't a fixed address for itself)? > > > > > > Where a system has a static/fixed IP is it OK to have only the > > 'localhost' loopback address and the 'real' static IP for 'self'? > > E.g. can one have:- > > > > 127.0.0.1 localhost > > > > 192.168.1.1 2860n # Draytek router, internet > > 192.168.1.2 dns.zbmc.eu dns # this Pi running dnsmasq > > 192.168.1.3 esprimo zbmc.eu # my desktop system > > 192.168.1.4 backup.zbmc.eu backup # backup Raspberry Pi, also > > DNS/DHCP backup > > > > As the /etc/hosts file on all of those systems (which have static IP)? > > > -- > Petr Menšík > Software Engineer > Red Hat, http://www.redhat.com/ > email: pemen...@redhat.com > PGP: DFCF908DB7C87E8E529925BC4931CA5B6C9FC5CB > > > ___ > Dnsmasq-discuss mailing list > Dnsmasq-discuss@lists.thekelleys.org.uk > https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss -- Chris Green ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Questions about /etc/hosts
oN fRI, fEB 11, 2022 AT 07:30:51am +0100, gEERT sTAPPERS VIA dNSMASQ-DISCUSS WROTE: > On Fri, Feb 11, 2022 at 12:24:27AM +0100, Petr Menšík wrote: > > On 2/10/22 20:24, Chris Green wrote: > > > When running dnsmasq it (by default) uses /etc/hosts to provide some > > > system's addresses. > > > > > > Some of my systems have their names in the /etc/hosts file against > > > a loopback address so host t470 has:- > > > > > > 127.0.0.1 localhost > > > 127.0.1.1 t470.zbmc.eu t470 > > > > > > > > > While others only have their names against their (static) IP address > > > so host backup has:- > > > > > > 192.168.1.1 2860n # Draytek router, internet > > > 192.168.1.2 dns.zbmc.eu dns # this Pi running dnsmasq > > > 192.168.1.3 esprimo zbmc.eu # my desktop system > > > 192.168.1.4 backup.zbmc.eu backup # backup Raspberry Pi, also > > > DNS/DHCP backup > > > > > > > > > Is that 127.0.1.1 loopback address just so that there is an IP for a > > > system to refer to itself (particularly in the case where it has DHCP > > > assigned IP so there isn't a fixed address for itself)? > > > > > > > > > Where a system has a static/fixed IP is it OK to have only the > > > 'localhost' loopback address and the 'real' static IP for 'self'? > > > E.g. can one have:- > > > > > > 127.0.0.1 localhost > > > > > > 192.168.1.1 2860n # Draytek router, internet > > > 192.168.1.2 dns.zbmc.eu dns # this Pi running dnsmasq > > > 192.168.1.3 esprimo zbmc.eu # my desktop system > } } 192.168.1.3 esprimo.zbmc.eu # my desktop system > > > 192.168.1.4 backup.zbmc.eu backup # backup Raspberry Pi, also > > > DNS/DHCP backup > > > > > > As the /etc/hosts file on all of those systems (which have static IP)? > > > > > I think we would need to know, which distribution and version you are > > running. > > And which computer of them is running dnsmasq as Domain Name Server > for the other computers. > Currently 'dns' is running dnsmasq as the DHCP/DNS server for the LAN, however these questions are as a result of me wanting to move that service to one of the other systems on the LAN. > > /etc/hosts is not directly controlled by dnsmasq. > > dnsmasq, as DNServer, uses /etc/hosts as source > for hostname-IPaddress-mapping. Consider it as source of a single thruth. > > Back to > > > As the /etc/hosts file on all of those systems (which have static IP)? > > That is fairly ignorant. The whole idea of DNS is eliminating the > maintainance of /etc/hosts files. And having hostname-IPaddress-mapping > in several places (/etc/hosts and DNS) creates several thruths, which > should be avoided. > Yes, I know, but *some* systems have to have static IP:- 192.168.1.1 The VDSL router, not *absolutely* necessary but it is the default route 192.168.1.2 This is the DHCP/DNS server so has to be static 192.168.1.3 This is SMTP server among other things, if DNS fails I need it to remain as 192.168.1.3 192.168.1.4 Going to become backup DHCP/DNS -- Chris Green ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] When does dnsmasq read the leases file?
On Fri, Feb 11, 2022 at 12:16:52AM +0100, Petr Menšík wrote: > On 2/10/22 22:33, Chris Green wrote: > > As per the subject when does dnsmasq [re]read the leases file? > > > > I am experimenting with my backup DHCP/DNS strategy and I have just > > stopped my dnsmasq server and started another listening on the first > > dnsmasq server's IP address. It's working OK'ish. However the new > > dnsmasq server doesn't (of course) know the name/IP pairs that the old > > dnsmasq server had in its memory. > > > > If I had copied the dnsmasq.lease file across from the old server to > > the new one would that help? Is there some way to tell dnsmasq to > > reload its memory from the file? If dnsmasq is restarted (e.g. by > > systemd) does it read the dnsmasq.leases file? > > > When it starts. It has own data stored in-memory and just rewrites lease > file. It would not read any new leases from it if some other service > pushed them there. If dnsmasq is restarted, it starts a new process. It > has to read all configuration all again, which has to be done for leases. > So does that mean there's no way to 'warm start' an instance of dnsmasq with a set of leases? Surely when dnsmasq is stopped and then started it reads it's previous leases file so that it still knows the names/IPs of systems that it has provided IPs for. So if I copy that leases file to another system and start a copy of dnsmasq there (with same configuration as the one it's replacing) won't it read that leases file? -- Chris Green ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss