4

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?

JdeBP
  • 3,970
  • 17
  • 17
Michele
  • 169
  • 10
  • 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 :) – Michele May 30 '11 at 10:50

4 Answers4

2

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

Paul Tomblin
  • 5,217
  • 1
  • 27
  • 39
  • /etc/host.conf seems to be correct: hosts,bins. The same for /etc/nsswitch.conf: hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 – Michele May 28 '11 at 11:48
1

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).

coredump
  • 12,573
  • 2
  • 34
  • 53
  • 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. – Michele May 28 '11 at 11:51
0

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.

wolfgangsz
  • 8,767
  • 3
  • 29
  • 34
  • i typed: sudo aptitude install nscd.....then....sudo /etc/init.d/nscd restart....it dosen't work :( – Michele May 28 '11 at 14:09
0

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?

Michele
  • 169
  • 10