I've configured a computer to act as a DNS server for my LAN (following roughly this guide). My main motivation is to be able to access my computers and appliances with URLs instead of IPs.
It's working and forwarding OK, as I'm able to resolve correctly my own names:
➜ ~ nslookup router.casa 192.168.1.5 Server: 192.168.1.5 Address: 192.168.1.5#53 Name: router.casa Address: 192.168.1.1
and outside ones:
➜ ~ nslookup google.com 192.168.1.5 Server: 192.168.1.5 Address: 192.168.1.5#53 Non-authoritative answer: Name: google.com Address: 126.96.36.199
192.168.1.5, as you probably already discovered, is the DNS server address)
I've then setup the DHCP server (a Linksys router) to hand out
192.168.1.5 as the primary DNS address, and Google ones next. That's because I'd like my devices to be able to resolve names even if the local DNS server is down. This also seems to be working, or at least is correctly reflected in any PC when I do
➜ ~ nmcli dev show | grep DNS IP4.DNS: 192.168.1.5 IP4.DNS: 188.8.131.52 IP4.DNS: 184.108.40.206
nslookup queries (without explicit DNS address) do not work:
➜ ~ nslookup router.casa Server: 127.0.1.1 Address: 127.0.1.1#53 ** server can't find router.casa: NXDOMAIN
After reading many SuperUser, Unix & Linux and AskUbuntu questions, I now know that this
127.0.1.1 address is something like a local DNS cache setup by default by
resolvconf, which comes pre-configured for that in my distro (Mint). Effectively:
➜ ~ cat /etc/resolv.conf # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 127.0.1.1
I've read many (accepted) solutions recommending some manual patches (either editing the resolv.conf base files, removing resolvconf entirely, etc.). However, I would like any guest device to be able to use the local names, and I really don't want to edit the entire LAN settings (some of the devices are not mine).
Is there any way to configure the DNS server and/or the DHCP so that I don't have to edit all PCs' and devices' settings manually?
Also, as a side question, why is this 127.0.1.1 server ignoring the first DNS address?
nslookup fails even when I use it from the DNS server:
➜ ~ nslookup router.casa 127.0.0.1 Server: 127.0.0.1 Address: 127.0.0.1#53 Name: router.casa Address: 192.168.1.1 ➜ ~ nslookup router.casa 127.0.1.1 Server: 127.0.1.1 Address: 127.0.1.1#53 ** server can't find router.casa: NXDOMAIN
More useful output:
➜ ~ sudo netstat -tulpn | grep 127.0.1.1 tcp 0 0 127.0.1.1:53 0.0.0.0:* ESCUCHAR 1489/dnsmasq udp 0 0 127.0.1.1:53 0.0.0.0:* 1489/dnsmasq