1
I have just installed DNSMasq on a local device (Raspberry Pi) to use as a DNS server but the service is not always working correctly when other computers in the network try to use it. This is what I added to the /etc/dnsmasq.conf
file:
log-queries
no-resolv
server=8.8.8.8
server=8.8.4.4
This is the /etc/hosts
file:
192.168.1.101 desktop.home
192.168.1.102 laptop.home
I'm not using DHCP, DHCP is done by my router. My router has the option to manually configur the DNS server and I put the Raspberry Pi IP address (192.168.1.100) in that field. I can confirm that both my desktop and laptop (Linux machines) are aware of the new DNS server (DNSMasq at 192.168.1.100).
Both my desktop and laptop are connected by cable. When I run nslookup laptop.home
from my desktop, for example, I get 50% hit more or less - sometimes I get a successful result sometimes I don't. Same thing from the laptop.
What's even more strange is that when I connect the laptop to wifi the hits get low even more. I only get 10% hits or less on my laptop on wifi. Really strange.
The logs don't say anything. I don't even know where to start to debug this.
1Check what IP for DNS you're actually getting via DHCP. If it's windows then you can use ipconfig in a command prompt to see. – djsmiley2k TMW – 2018-07-31T15:23:04.150
Yes, the laptop and desktop are using the Raspberry Pi for DNS. This is how I know that they are:
nmcli device show enp0s25 | grep DNS
and the response includesIP4.DNS[1]: 192.168.1.100
. – kapus – 2018-07-31T15:29:57.890Is there any other DNS servers listed? If so, that'd explain why it only works 'some' of the time – djsmiley2k TMW – 2018-07-31T15:40:09.530
Yes, it lists a secondary DNS server (OpenDNS), which is a DNS server my router let's me configure in case the first fails. It should only be used if the first fails, so I think the problem is not related to that - the problem is that DNSMasq is failing to catch those requests. – kapus – 2018-07-31T15:46:22.527
1@djsmiley2k I think you were right about the other DNS. I was using another DNS server (OpenDNS) on my router because I thought the router was going to use it as a failover, but actually I think that the router was doing a round robin between DNSMasq and OpenDNS. Things work now after I removed the other DNSServer from router config. If you put an answer, I will mark it as correct. Thanks! – kapus – 2018-08-01T00:40:01.557