2

Since my router does not resolve hostnames of LAN devices, I setup my server to act as a DNS using DNSMASQ.

DNS Server Specs
----------------
OS:     Ubuntu Server
LAN IP: 192.168.1.4

I have a second server for streaming media on the network, which runs kodi, and apache2 so I can control the machine via a web interface I wrote.

Media Server Specs
------------------
LAN IP:   192.168.1.10
HOSTNAME: media.lan

My router is configured so that it uses my local DNS server for DNS lookups. I also added an entry for my media server to /etc/hosts on my DNS server.

If I run dig media.lan on any machine on my network , I get this:

; <<>> DiG 9.10.6 <<>> media.lan
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41974
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

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

;; ANSWER SECTION:
media.lan.      0   IN  A   192.168.1.10

;; Query time: 2 msec
;; SERVER: 192.168.1.4#53(192.168.1.4)
;; WHEN: Tue Dec 17 16:06:24 CET 2019
;; MSG SIZE  rcvd: 54

Which gives the impression that everything is working just fine. The proper DNS server is being contacted and the right IP address for media.lan returned. However, if I try to ping media.lan on any machine, I get the following error:

ping: cannot resolve media.lan: Unknown host

And Firefox does not find the server either. If I ping the IP of media.lan, I get a response. My setup was working perfectly fine 30 minutes ago and I did not update anything. Pinging google.com works without any issues. What the hell is going on? Why is dig getting the correct response but all other DNS lookups for local hostnames seem to fail?

Contents of /etc/nsswitch.conf (of the DNS server):

# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat systemd
group:          compat systemd
shadow:         compat
gshadow:        files

hosts:          files dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

/etc/resolv.conf

nameserver 127.0.0.53
options edns0
search home
5
  • Do you have "dns over http" enabled in firefox? Click on "Menu" (3 bars on top right of firefox) "Preferences", scroll down to "Network Settings" and click "Settings" and find a radio button.
    – icarus
    Dec 17, 2019 at 16:35
  • Also can we see the contents of /etc/resolv.conf from any machine that can ping google.com but not media.lan? In particular does it have a "nameserver 192.168.1.4" line in it?
    – icarus
    Dec 17, 2019 at 16:42
  • Added it to the main question - only one machine trying to connect is a linux host, the other two are a mac and windows pc respectively. On the Mac, when I go to System Preferences > Network > WiFi > Advanced... > DNS, it lists 192.168.1.4 as the dns server. Still the same symptoms.
    – turf
    Dec 17, 2019 at 18:45
  • Also, the whole point is that any device connecting to the network can just access the local machines set up in the DNS server's host file via their respective host names, zero configuration needed, which I believe should be possible if set up correctly.
    – turf
    Dec 17, 2019 at 18:49
  • Okay, something interesting just happened: I manually set the DNS Server to 192.168.1.4 in System Preferences > Network > WiFi > Advanced... > DNS, applied the Settings (although it had appeared there automatically before), and voilà, it worked. This is not a solution to my problem though, If I have to manually configure the DNS server for each device I might as well just edit the host file, which is what I want to avoid. Why do my devices seem to ignore the DNS settings provided by my router? Or is something else the matter entirely? I am starting to tear my hair out here.
    – turf
    Dec 17, 2019 at 18:55

1 Answer 1

0

Okay, so get this: in the List of automatically configured DNS Servers (that my Mac must've received from my modem) I spotted an IPv6 address underneath my 192.168.1.4 entry. I then disabled the IPv6 DHCP server on my router, and, surely enough, my hostname resolution all of a sudden works and I see no more IPv6 DNS server address on my Mac. Could this have been the error or is it just a freakish coincidence?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .