How do I configure Yosemite to be able to resolve DNS ending in ".local"?
Solution 1:
Apple has provided some related documentation here. In which they recommend avoiding .local
if you can and instead using a suffix such as .private
, .intranet
, .internal
, or .lan
.
The reason .local
should be avoided is because it's used by the Bonjour service.
Short Answer
Add the following Search Domain as in the screenshot (you can disregard my DNS Server settings):
Long Answer
Another possibility is documented here in an article about using Dnsmasq for local development on OS X and a related StackOverflow question in which someone seems to have found it successful except when their offline (which doesn't make a lot of since.. but the key point here is, it seems to work for them at least part of the time)
The linked article directs that you should create a directory at /etc/resolver
if it doesn't already exist by using the command
sudo mkdir -p /etc/resolver
Now you should create a new file in this directory for each resolver you want to configure. Configure with at least these two options (there are more options available):
- the name of the resolver (corresponding to the domain name)
- the DNS server to be used.
For more information about these files, see the
resolver(5)
manual page:
man 5 resolver
Create a new file with the same name as your new top-level domain in the
/etc/resolver/
directory and add a nameserver to it by running the following commands:
sudo tee /etc/resolver/local >/dev/null <<EOF
nameserver 127.0.0.1
EOF
Here
local
is the top-level domain name configured to respond to and127.0.0.1
is the IP address of the server to use.
I looked to see if I had that directory by default and I did not, but I did notice I had a file /etc/resolv.conf
which existed by default. I have not attempted, but if the solution in the article is unsuccessful I would try using this pre-existing resolv.conf
file.. under the assumption.. it must be there for a reason.
Solution 2:
Apple does not resolve .local
using a DNS server, but Apple Bonjour its zeroconf
impementation. You could install Avahi
the Linux and BSD implementation.
I use netatalk
on my Linux boxes to communicate with OS X
Solution 3:
See https://apple.stackexchange.com/a/152892/65787 for a way to automate sudo discoveryutil mdnsactivedirectory yes
which forces DNS resolution of .local domains on Yosemite.