Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I tried to change /etc/hosts to change a local DNS entry, so I can map any website name to any IP, but it isn't working. How can I debug it?

share|improve this question
1  
What have you tried so far –  warl0ck Sep 24 '12 at 9:13
4  
The file name you need to edit is /etc/hosts (not host). You need root permission to edit the file. –  Manula Waidyanatha Sep 24 '12 at 9:34
    
Can you better explain what it is that you're trying to do with websites? –  Karlson Sep 24 '12 at 12:40
    
@Karlson I am trying to change local dns at my computer so that i can open facebook.com by entering www.google.com in browser and mapping google.com with the ip of facebook.com in hosts file. –  Rahul Kumar Dubey Sep 25 '12 at 15:06
    
@RahulKumarDubey So you are doing this on the workstation accessing the internet? –  Karlson Sep 25 '12 at 15:22
add comment

1 Answer 1

Check /etc/nsswitch.conf and make sure on the hosts line, files is the first option and not dns

share|improve this answer
    
please explain in detail about /etc/nsswitch.conf and how it is related to /etc/hosts file ?? –  Rahul Kumar Dubey Sep 25 '12 at 15:10
    
@RahulKumarDubey man nsswitch.conf –  Karlson Sep 25 '12 at 15:21
add comment

Your Answer

 
discard

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.