我有一个本地虚拟机(运行在本地安装的vmware工作站上,网络设置为NAT),我已经在上面安装了suse 11 sp3。
这台机器被设置为使用dhcp (从vmware)获得一个ip地址,这是可行的--至少我有互联网连接。
问题是它无法解决自己的主机名:
suse11:~ # hostname
suse11
suse11:~ # ping suse11
ping: unknown host suse11
suse11:~ # ping www.google.com
PING www.google.com (74.125.131.99) 56(84) bytes of data.我不想将主机名添加到/etc/host中,作为127.0.0.1。理想情况下,我希望与windows上的行为相同--将您自己的主机名解析为“真实的”ip地址(可能是众多ip地址中的一个)。
/etc/resve.conf:
### /etc/resolv.conf file autogenerated by netconfig!
#
# Before you change this file manually, consider to define the
# static DNS configuration using the following variables in the
# /etc/sysconfig/network/config file:
# NETCONFIG_DNS_STATIC_SEARCHLIST
# NETCONFIG_DNS_STATIC_SERVERS
# NETCONFIG_DNS_FORWARDER
# or disable DNS configuration updates via netconfig by setting:
# NETCONFIG_DNS_POLICY=''
#
# See also the netconfig(8) manual page and other documentation.
#
# Note: Manual change of this file disables netconfig too, but
# may get lost when this file contains comments or empty lines
# only, the netconfig settings are same with settings in this
# file and in case of a "netconfig update -f" call.
#
### Please remove (at least) this line when you modify the file!
search localdomain
nameserver 192.168.19.2/etc/nsswitch.conf:
#
# /etc/nsswitch.conf
#
# An example Name Service Switch config file. This file should be
# sorted with the most-used services at the beginning.
#
# The entry '[NOTFOUND=return]' means that the search for an
# entry should stop if the search in the previous entry turned
# up nothing. Note that if the search failed due to some other reason
# (like no NIS server responding) then the search continues with the
# next entry.
#
# Legal entries are:
#
# compat Use compatibility setup
# nisplus Use NIS+ (NIS version 3)
# nis Use NIS (NIS version 2), also called YP
# dns Use DNS (Domain Name Service)
# files Use the local files
# [NOTFOUND=return] Stop searching if not found so far
#
# For more information, please read the nsswitch.conf.5 manual page.
#
# passwd: files nis
# shadow: files nis
# group: files nis
passwd: compat
group: compat
hosts: files dns
networks: files dns
services: files
protocols: files
rpc: files
ethers: files
netmasks: files
netgroup: files nis
publickey: files
bootparams: files
automount: files nis
aliases: files发布于 2013-09-22 14:42:20
这种行为是预期的,名称服务器根据域名空间解析主机名。它与它/etc/主机的工作方式无关。
如下所述:
运行ping suse11时,首先尝试使用/etc/host解析,因为suse11不存在,然后尝试使用名称服务器192.168.19.2,但要注意/etc/surv.conf中的“搜索本地域”,以便将其附加到“查询”,因此192.168.19.2尝试解析suse11.localdomain,这样的域在公共名称空间中不存在。
ping不是测试主机解析的工具,也不是用来测试主机解析的工具。
您可以更好地使用真正的DNS查找工具,例如:
dig @192.168.19.2 suse11
HTH
发布于 2013-09-26 17:19:10
加入windows域时,PDC中集成的dhcp服务在windows DNS服务中添加一个dns A记录,因此您可以解析windows域网络中的Windows pc
https://serverfault.com/questions/540810
复制相似问题