主机命令和Web浏览器不接受hosts.conf命令


0
[root@MYPC etc]# lsb_release -a
LSB Version:    :core-4.0-ia32:core-4.0-noarch
Distributor ID: Fedora
Description:    Fedora release 14 (Laughlin)
Release:    14
Codename:   Laughlin

[root@MYPC etc]# uname -a
Linux MYPC 2.6.35.11-83.fc14.i686.PAE #1 SMP Mon Feb 7 06:57:55 UTC 2011 i686 i686 i386 GNU/Linux

[root@MYPC etc]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 127.0.0.1
nameserver 8.8.8.8

[root@MYPC etc]# cat /etc/host.conf 
multi on
order hosts,bind

[root@MYPC etc]# cat /etc/hosts
192.168.1.2 MYPC    # Added by NetworkManager
127.0.0.1   localhost.localdomain   localhost
::1 MYPC    localhost6.localdomain6 localhost6

127.0.0.0   audit.median.hu

[root@MYPC etc]# ping audit.median.hu
Do you want to ping broadcast? Then -b

[root@MYPC etc]# host -t a audit.median.hu
audit.median.hu has address 193.68.35.149
audit.median.hu has address 193.91.69.232
audit.median.hu has address 193.68.35.131
audit.median.hu has address 193.68.35.136

为什么 ping 看到 audit.median.hu 为127.0.0.0,为什么呢 host -t a audit.median.hu 把它看作193.68.35.149? audit.median.hu 只是一个示例网站[托管广告等]

我的Fedora PC上只有一个缓存名称服务器:

yum -y install caching-nameserver
service named restart
chkconfig named on

我在Network-Manager Applet中配置了我的DNS服务器地址:127.0.0.1,8.8.8.8

即使使用Wireshark,我也能看到它:

`195.70.37.149 DNS Standard query A audit.median.hu`

所以最大的问题是:为什么不这样做 host 命令或我的Web浏览器识别我已修改 audit.median.hu 的IP地址?

Answers:


1

/etc/nsswitch.conf 你有没有

hosts:      files dns

组?



可能很傻但我不确定主机是否真的遵守nsswitch.conf ...你能尝试使用'ping'或关闭/重新打开浏览器再试一次吗?
PriceChild

运行strace后 主办 在我的Ubuntu 10.10框中,我看不到对/etc/host.conf,/​​etc/nsswitch.conf或libnss的引用。我的猜测是它没有使用它们。 (如果你愿意,我可以深入研究源代码)。
Majenko

重启后ping /浏览器怎么样?
PriceChild
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.