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

in ubuntu 11.04, i'm trying to change dns to force it to point to another server let's assume the domain name is www.mysite.com and the ip 96.32.66.xx

i changed /etc/hosts but when i open the browser it dosen't work.

if i ping 96.32.66.xxx it works on windows i applied the same change in system32/drivers/etc/hosts and it works

this is my /etc/hosts:

127.0.0.1   trustweb-Linux   localhost.localdomain   localhost
::1   trustweb-Linux   localhost6.localdomain6   localhost6
127.0.1.1   trustweb-Linux

96.32.66.xxx www.miosito.com

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

I execute this code to refresh the net cache

sudo /etc/init.d/networking restart

what's wrong?

share|improve this question
1  
You shouldn't have to restart networking. Did you restart your browser? –  Paul Tomblin May 28 '11 at 11:50
    
That's obviously not your /etc/hosts. That's a file with a syntax error that will cause the very behaviour that you describe. Show people your actual data, not something that you made up in the question. –  JdeBP May 28 '11 at 13:07
    
yes it was not the complete file, i changed only the last two numbers of ip address and the domain name. surely i had checked that string well before to post here...anyway, thank you to try to help me :) –  Mike May 30 '11 at 10:50

4 Answers 4

Have a look at /etc/host.conf. It should say order hosts,bind, which tells it to believe /etc/hosts before it believes dns.

share|improve this answer
    
/etc/host.conf seems to be correct: hosts,bins. The same for /etc/nsswitch.conf: hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 –  Mike May 28 '11 at 11:48

If you have a proxy, name resolution will be completed on the proxy. I also had some problems with browsers needing to be completely closed and re-opened for the hosts changes to be recognized (like closing all instances/tabs/etc).

share|improve this answer
    
i think if it works on windows it should work on ubuntu...i also tryied delete chrome cache, and unflagging some option for dns i tryed also ff and opera....same story. –  Mike May 28 '11 at 11:51

Your problem is most likely name caching. On the Linux machine, restart nscd (the name service caching daemon). Plus, flush the cache in the browser.

share|improve this answer
    
i typed: sudo aptitude install nscd.....then....sudo /etc/init.d/nscd restart....it dosen't work :( –  Mike May 28 '11 at 14:09

Strangely now it works...i didn't reboot the pc from yesterday, and i'm changing in the same way /etc/hosts file

how does it possible?

share|improve this answer

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.