Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need a way of telling my ec2 centos instance to look first in /etc/hosts first before queering the dns.

In /etc/nsswitch.conf I have "hosts: files dns" and in /etc/host.conf I have "order hosts,bind".

Even so, after adding a new entry in /etc/hosts it still resolves to another IP not the one which I've put in /etc/hosts.

Any thoughts ?

share|improve this question
Ermm ... Just found this: serverfault.com/questions/121890/hosts-file-seems-to-be-ignored Apparently using 'host' wouldn't get me anywhere. –  cparfon Nov 8 '12 at 17:34
When you say "it still resolves to another IP", how did you test that? dig, ping, telnet, host? (dig, for instance, will use only the DNS) –  bortzmeyer Nov 8 '12 at 20:42
add comment

Your Answer


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

Browse other questions tagged or ask your own question.