I'm using a Raspberry Pi 3 with Ubuntu 18.04. At my company we have a DNS server and a couple of domains with ".local". I know technically this isn't correct and it should be ".lan" instead, because .local is reserved for multicast dns. But that's the way it is and it can't easily be changed. So on my windows machine I can ping and browse to those domain names without trouble. On my Ubuntu however I can not.
I can not use IPs because some domains are on the same machine and the IIS webserver sorts things out what goes where.
I have searched and it comes up quite often:
- https://smallbusiness.chron.com/resolving-local-ubuntu-38861.html
- Why do none of my local servers resolve?
- ubuntu server not resolving LAN hostnames
However changing /etc/nsswitch.conf doesn't do the trick for me. I tried
- hosts: files mdns4_minimal [NOTFOUND=return] dns myhostname # default
- hosts: files dns
- hosts: files mdns4_minimal [NOTFOUND=continue] dns myhostname
- hosts: files mdns4 [NOTFOUND=return] dns myhostname
- hosts: files mdns4 [NOTFOUND=continue] dns myhostname
- hosts: files dns mdsn4_minimal myhostname
- hosts: dns
- a few others
None of which worked. I tried rebooting after a change too. I tried to tell avahi that the domain-name=alocal in /etc/avahi/avahi-daemon.conf, didn't work after service restart, didn't work after reboot. After this not working, I tried disabling the avahi-daemon service entirely.
sudo systemctl disable avahi-daemon
After a reboot I tried a couple of permutations in /etc/nsswitch.conf again, with no effect.
with my current settings in hosts (files dns) I get this response:
dig login.name.local # not the actual name
; <<>> Dig 9.11.3-1ubuntu1.1-Ubuntu <<>> login.name.local
;; global options: +cmd
;; Got answer:
;; WARNING .local is reserved for Multicast DNS
;; You are currently testing what happens when an mDNS query is leaked to DNS
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33538
;; flags: qr rd ra; QUERY: 1, ANSWER:0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;login.name.local. 0 IN A
;; Query time: 2msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Thu Aug 23 10:51:50 CEST 2018
;; MSG SIZE rcvd: 56
However when I instruct dig to query the server directly I get the correct answer:
dig @dnsIP login.name.local
; <<>> Dig 9.11.3-1ubuntu1.1-Ubuntu <<>> login.name.local
; (1 server found)
;; global options: +cmd
;; Got answer:
;; WARNING .local is reserved for Multicast DNS
;; You are currently testing what happens when an mDNS query is leaked to DNS
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57866
;; flags: qr aa rd ra; QUERY: 1, ANSWER:1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;login.name.local. 0 IN A
;; ANSWER SECTION:
login.name.local. 3600 IN A serverIP
;; Query time: 2msec
;; SERVER: dnsIP#53(dnsIP)
;; WHEN: Thu Aug 23 10:51:50 CEST 2018
;; MSG SIZE rcvd: 56
This version of Ubuntu uses netplan with the network manager. The correct DNS IP is definitely in the list. (in fact it's the primary DNS.) Also the dnsIp is the same as serverIP, but that shouldn't be an issue.
Ping or connecting via browser and such don't work of course. None use the dns query.
I'm at a loss at what to do. Certainly we can't switch to a different domain name. I put the servername into /etc/hosts but that's just a temporary solution.