- 论坛徽章:
- 0
|
[linux系统]:我用gethostbyname("zhxj")查找局域网中的一台机器,结果是返回NULL,并且h_error的值为1,我的
/etc/hosts文件为:
127.0.0.1 localhost.localdomain localhost
/etc/host.conf为:
order hosts,bind
multi on
/etc/nsswitch.conf为:
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: files
group: files
shadow: files
hosts: files dns
networks: files
protocols: files
services: files
ethers: files
rpc: files
netgroup: files
/etc/resolv.conf为:
nameserver 192.168.15.77
如果我在/etc/hosts中加入
"192.168.15.105 zhxj"一行,那么gethostbyname("zhxj")就能得到正确的返回值,不加的话,什么包也没有发出去,我通过抓包看的.其中192.168.15.77是内部的DNS,请问是什么原因??按照/etc/nsswitch.conf的配置来说,应该是会到DNS去查找的,不知对否?? |
|