我有一个本地虚拟机(运行在本地安装的VMware工作站,networking设置为NAT),我已经安装了suse enterprise 11 sp3。
该机器设置为使用dhcp(从vmware)获得IP地址,这是可行的 – 至less我有互联网连接。
问题是无法parsing自己的主机名:
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 / hosts作为127.0.0.1。 理想情况下,我想要像Windows一样的行为 – ping你自己的主机名parsing为“真正的”IP地址(可能是许多人之一)。
/etc/resolve.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
行为是预期的,根据域名空间名称服务器resolvs主机名。 它没有任何工作的方式/ etc / hosts。
想想如下:
当你运行ping suse11时,首先尝试使用/ etc / hosts来parsing,因为suse11不存在,然后尝试使用nameserver 192.168.19.2,但要注意/etc/resolv.conf中的“search localdomain”,以便追加到“查询”,所以192.168.19.2试图parsingsuse11.localdomain,这样的一个域名不存在于公共名字空间。
ping不是testing主机parsing的工具,不是为此而devise的。
你可以使用一个真正的DNS查找工具,比如:
dig @ 192.168.19.2 suse11
HTH
当你join一个Windows域时,集成在PDC中的DHCP服务在Windows DNS服务中添加一个DNS Alogging,因此你解决了Windows域networking中的Windows PC