I can resolve a *.local domain, ping the IP, but I can't ping this domain
I found the answer! So most of you will know that the /etc/hosts file will resolve domains, somewhat like a DNS server. But how does the system know to look in that file? And how does it know what order to look check that file or a DNS server?
There is a file: /etc/nsswitch.conf
I had the line:
hosts: files myhostname mdns4_minimal [NOTFOUND=return] dns
This means first check files, like /etc/hosts. Then check the system hostname. Then there is mdns4, which I believe is the protocol for finding other machines on the local network.
After mdns4 is what was holding me up. [NOTFOUND=return]
. mdns looks for names ending in .local
. If it can't find one, it doesn't just pass to the next and final search method dns
, it will actually stop and tell your system that the domain does not exist. Since the domain I set up in dnsmasq was a .local
domain, it would never get there.
So there are two ways to fix this. The first is to remove [NOTFOUND=return]
. This is the way I chose, and it works great. There is a small delay because I think mdns sees the .local
and attempts to look it up anyway before passing it to dns
.
This is what my file looks like now:
hosts: files myhostname mdns4_minimal dns
Another option, since I don't really use mdns, is I could either remove it completely, or there was a way to tell it to use a different tld like .alocal
instead - but I think that would effectively disable it also.