I noticed Mavericks prefers the DNS server to /etc/hosts (scutil --dns). There used to be a good 'ol "order hosts,bind". Is there anything equivalent for Mavericks so my hosts file is consulted before reaching out to the DNS server? Thanks.
-
1Please elaborate your thoughts about lookup order changes and add some examples. On my system the order is hosts->mDNS->DNS (except using dig, host and nslookup of course)– klanomathCommented Feb 24, 2015 at 20:34
-
Additionally check gordon's answer here– klanomathCommented Feb 24, 2015 at 22:49
2 Answers
(Cross-posting my Reddit answer here.) In my experience, it's more of an additional priority issue: IPv6. It hit me in Mavericks, but probably dates back to Lion. I develop on my local machine using /etc/hosts aliases to route requests through nginx, but on slow Wifi with slow DNS, it will often hit a 5-second timeout before bailing out on IPv6 and trying IPv4, realizing that there's a relevant /etc/hosts entry, and resolving that way. Not very convenient to have +5s tacked onto my recode-reload cycle.
Adding a ::1 example.com
line to go along with my 127.0.0.1 example.com
lines resolved the issue for me.
I've noticed this dns authority priority inversion in 10.10.2 (Yosemite) but not back in Mavericks.
I just started this thread. https://www.reddit.com/r/mac/comments/2y22sj/yosemite_ignoring_localhost_etchosts_redirects/