Why is domain name resolution slow in Sierra I have a Linux web server running in VirtualBox and after upgrading to Sierra I found that my sites on the web server are extremely slow to load.  It takes minutes.  I thought it had to do with something about the VirtualBox guest installation so I set up my sites in a Docker container but I'm seeing the same thing.

On a whim I turned off all networking and suddenly my sites load instantly.  This leads me to believe there's some kind of domain name resolution problem but I'm not sure where to look.

My development domains are in /etc/hosts which looks something like this:

127.0.0.1 firstdomain.dev
127.0.0.1 seconddomain.dev


When I ping firstdomain.dev I get this:

PING firstdomain.dev (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.089 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.109 ms


When I host firstdomain.dev I get this:

firstdomain.dev has address 127.0.53.53
firstdomain.dev mail is handled by 10 your-dns-needs-immediate-attention.dev.


I don't understand why the OS isn't looking at /etc/hosts first and going from there.  What else can I look at or do to resolve this?

Edit: I have tried changing the .dev to .local but I still see the same thing.
I assume you already executed all usually proposed mDSNResponder tasks to reset it, clear caches etc.

.dev is a proper "New gTLDs" since 2014. Probably you are using Google Chrome to access your site(s) which often uses its own DNS query service. The flaky name resolution management in OS X as well as the Google Chrome "service" (which both seem to ignore /etc/hosts entries sometimes and then fail to resolve a real firstdomain.dev in the WAN) suggest to simply use another TLD like .development, .devhome or .devwork.

And/or set up dnsmasq with homebrew and use localhost/127.0.0.1 as only DNS server in your network preferences. Setup proper IP addresses instead of a lot of 127.0.0.1 IP-addresses in the config files.