将ip更改为Ubuntu 11.04上的/ etc / hosts中的dns

在Ubuntu的11.04,我试图改变DNS强制它指向另一台服务器让我们假设域名是www.mysite.com和IP 96.32.66.xx

我改变/ etc / hosts但是当我打开浏览器它不工作。

如果我ping 96.32.66.xxx它在Windows上工作,我应用在system32 /驱动器/ etc / hosts相同的变化,它的工作原理

这是我的/ 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 

我执行这个代码来刷新networkingcaching

 sudo /etc/init.d/networking restart 

怎么了?

看看/etc/host.conf 。 它应该说order hosts,bind ,它告诉它相信/etc/hosts之前,它相信DNS。

如果你有一个代理,名字parsing将在代理上完成。 我也遇到了一些问题,需要完全closures浏览器,并重新打开主机更改被识别(如closures所有实例/选项卡/等)。

你的问题很可能是名称caching。 在Linux机器上,重新启动nscd(名称服务caching守护进程)。 另外,在浏览器中刷新caching。

奇怪的是,现在它的工作原理…我没有从昨天重新启动电脑,我改变了/ etc / hosts文件

怎么可能?