Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm testing a new server and have been playing with /etc/hosts.

I have been able to get it working on just, but if I try it points to where the actual domain is currently delegated, not the testing server.



If I load, I get the ip address I enter. With this though I enter I get where the domain is currently hosted.

if I try:


I still end up with where the domain is currently hosted and not the test server.

What am I missing here?

share|improve this question
What is your OS? – Khaled Jul 14 '12 at 9:16
I am on osx 10.7 – willdanceforfun Jul 14 '12 at 9:16

xxx.xx.xx.xx should have worked, assuming that you have configured your resolver to first use the hosts file. (Trying DNS next and the host file as a backup is also allowed and might be the default on some distributions).

I checked FreeBSD and Fedora and both have default lines like this:

>cat /etc/host.conf
# Auto-generated from nsswitch.conf


order host, bind

Edit: I just saw your comment that you use OS X. That makes this post relevant

share|improve this answer

Your setup of /etc/hosts file is good.

Look in the file /etc/nsswitch.conf, and check if the first parameter of line beginning with "host: " is "files". If not it's a priority probleme between /etc/hosts file and DNS recursion (dns parameter).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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