I would like to know how I can configure my dns settings so that domain is resolved locally first, then if not resolved it goes to external DNS.

I had this working before, I am using Ubuntu through a VM and need the local domain to resolve first but since I have upgraded I had to reconfigure network and now it works only external, local host file does not seem to even be used.

Is there an easy way to check this out?

I did slap it up in google but no specific answer seemed to match my case and I too tight on delivery deadline to test-and-try different approaches.

You guys rock, thanks.


For /etc/hosts on the local machine not to be used first is very strange. Are you sure this is happening? (You say it "seems" not to be used.)

Perhaps you no longer have the correct entries in it, or perhaps they are commented out with #.

On the other hand, if what you mean is that you have an Ubuntu host system virtualizing a guest system, and you want /etc/hosts file on the virtualization host to dictate how the virtualization guest resolves DNS queries, then that's a totally different situation. That would require that you do one of these things:

  • Run a DNS server on the virtualization host and configure the virtualizationg guest to use it.

  • Run a transparent proxy on the host that acts transparently to cache DNS. This is probably more complicated a solution than you're after.

  • Make the virtualization guest's hosts file (assuming it's the same style and syntax) a symbolic link, via a VM or network share, to the virtualization host's hosts file. (If you share /etc/hosts with a VM, you should generally make it so that the VM can only read this file, even as root or the equivalent on the VM, unless the VM is fully trusted and you really need to be able to write to it.)

  • Make the virtualization guest's hosts file track /etc/hosts on the virtualization host, using some automated mechanism (e.g., scripting).

If this is what you need, I recommend editing your question to make that more clear.

  • Thanks for posting the issue was not related to dns. – stefgosselin Jun 20 '12 at 3:44
  • You've posted about the issue in past tense. Is that to say you've solved the problem? If so, I recommend answering your own question, to tell the solution. Then other people with similar problems can benefit as well. (You can accept your own answer 48 hours after you post it, so people know it's the one that worked.) – Eliah Kagan Jun 20 '12 at 3:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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