I have a local development environment setup on my Mac. I am running an Ubuntu Web Server inside of a Virtual Box VM. I setup a host file on my Mac that points my dev site to the IP of the Ubuntu Virtual Server.

Everything works good other than the fact a lot (not all) of the time it takes more than 5 seconds to load a page. I used firebug to track down where the problem is and when it's slow the DNS part of my request is taking over 5 seconds.

Like I said it's not all the time. Sometimes it resolves and loads the page within milliseconds. The same page one click will be super fast and then the next time it takes over 5 seconds.

It's really slowing me down and I am not sure what is causing it.

3 Answers 3


Firebug is reporting from the host operating system and is therefore unaware of the VM's internal state - what you see as a "DNS lookup" is probably the VM starting up a worker process or otherwise processing the request before servicing the request.

You should be able to confirm whether or not this is the case by running your webserver in debug mode (-X for Apache) and monitoring the output of top within the VM.

  • +1 If you configured /etc/hosts to point to your VM, it's not doing 5 seconds of DNS querying ;)
    – msanford
    Commented Mar 20, 2012 at 19:07

This article may be relevant: http://www.justincarmony.com/blog/2011/07/27/mac-os-x-lion-etc-hosts-bugs-and-dns-resolution/

They ended up running their own simple dns server on their Mac because of similar issues. This might be a fairly easy solution if you already have MacPorts installed (you could also try homebrew).

  • This fixed it for me Commented Mar 30, 2012 at 2:39

Amazon offers one year free on a micro instance I would move from your virtual box VM and put that server on an ec2 server (plenty of ubuntu public images 10.04 LTS etc). I had problems running WAMP with an application all the DNS lookups were taking forever for some reason even though I was on my local host. I couldn't figure out the reason even with host names and IP's in my hosts file. Not so much an answer but an option, local servers and DNS get fussy some times.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.