0

I am running Unbuntu 19 on VBox. The network driver is Nat. My network at home uses dnsmasq for dns and for dhcp. The server is called router and serves ip addresses with the required options for the dhcp clients, including the dns server addresses, of which the dnsmasq server is the first. This all works well for all devices connected to the network.

The dns servers used are here: (the first one is the dnsmasq server, the 1.1.1.1, 8.8.8.8, 208.67.222.222 and the first come from the dhcp server)

$ nmcli dev show | grep DNS
IP4.DNS[1]:                             192.168.178.2
IP4.DNS[2]:                             1.1.1.1
IP4.DNS[3]:                             8.8.8.8
IP4.DNS[4]:                             208.67.222.222
IP4.DNS[5]:                             8.8.4.4
IP4.DNS[6]:                             62.140.140.251
IP4.DNS[7]:                             62.140.138.233

The issue I ran into did not occur on Ubuntu 18 (in VBox) but does on Ubuntu 19 running in a VBox.

When I try dig host on my local network that should be serviced by the dnsmasq server, then I get no result.

$ dig router

; <<>> DiG 9.11.5-P1-1ubuntu2.4-Ubuntu <<>> router
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 24896
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;router.                IN  A

;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: za jun 01 13:49:59 CEST 2019
;; MSG SIZE  rcvd: 35

When I explicitly specify the server, then I get a good response:

$ dig router @192.168.178.2

; <<>> DiG 9.11.5-P1-1ubuntu2.4-Ubuntu <<>> router @192.168.178.2
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10229
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;router.                IN  A

;; ANSWER SECTION:
router.         0   IN  A   192.168.178.2

;; Query time: 3 msec
;; SERVER: 192.168.178.2#53(192.168.178.2)
;; WHEN: za jun 01 14:02:00 CEST 2019
;; MSG SIZE  rcvd: 51

If someone out there can help me how to fix this, that would be highly appreciated.

Cheers

  • I have solved the problem using input from another source, the ubuntu forum. I have uncommented the Domains in /etc/systemd/resolved.conf and set it to my local domain. Now it finds the hosts on my local network. – Peter Zandbergen Jun 2 at 11:09
  • Do not use the comment field for posting solutions; mods can delete comments at any time. Post your own answer and mark it as accepted. – grawity Jun 2 at 11:20
0

"First" doesn't mean much. Older Linux libc versions used to always choose the first configured server, but later it was changed to shuffle the list for better load balancing, under the assumption that all servers will work the same way.

Every OS expects all configured DNS servers to provide identical data. If one server responds with "No such domain", that response is final – the OS will not retry with another server unless it has received no response at all.

So when the OS decides to query e.g. Google DNS for your local name, it receives a negative response and that's the end – it won't keep asking other servers.

What you should do is configure hosts to only use dnsmasq, and configure dnsmasq itself to use whatever public upstream servers you need. That way you get predictable results from all different operating systems, and you also get the advantage of local caching.

(Or if your hosts support it, they could use systemd-resolved which understands domain-specific nameservers, and can direct queries to either dnsmasq or to public DNS according to the domain name... but that's redundant since dnsmasq can already do that centrally, and it'll just be a headache to configure.)

  • Thanks for your explanation. The reason for putting more than one dns server in the dnsmasq configuration is to have a backup if the dnsmasq dns server fails to work. – Peter Zandbergen Jun 2 at 11:09
  • Then I think you'll need to set up two dnsmasq servers... – grawity Jun 3 at 5:00
0

Try this. sudo apt-get install libnss-winbind

Backup /etc/nsswitch.conf

Edit /etc/nsswitch.conf from:

hosts: files mdns4_minimal [NOTFOUND=return] dns myhostname to

hosts: files wins mdns4_minimal [NOTFOUND=return] dns myhostname

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.