suse 11sp3 - cant ping/resolve own hostname
The behaviour is the expected, a nameserver resolvs hostnames according to domain name space. It has nothing to do the way it works /etc/hosts.
Think as follows:
When you run ping suse11, first tries to resolv using /etc/hosts, as suse11 is not there, then tries to use nameserver 192.168.19.2, but pay attention to "search localdomain" in /etc/resolv.conf so that is appended to the "query", so 192.168.19.2 tries to resolv suse11.localdomain, such a domain does not exist in the public name space.
ping is not a tool to test host resolution, is not intended for that.
You could see better using a really DNS lookup tool, eg:
dig @192.168.19.2 suse11
HTH
Related videos on Youtube
radai
My father peddles opium, my mother's on the dole My sister used to walk the streets but now she's on parole My brother runs a restaurant with bedrooms in the rear But they don't even speak to me, 'cause I'm an Engineer
Updated on September 18, 2022Comments
-
radai almost 2 years
i have a local virtual machine (running on a locally installed vmware workstation, networking set to NAT) on which i have installed suse enterprise 11 sp3.
the machine is set to get an ip address using dhcp (from vmware), and this works - at least i have internet connectivity.
the issue is it cant resolve its own hostname:
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.
i dont want to add the hostname to /etc/hosts as 127.0.0.1. ideally i'd like the same behavious as on windows - pinging your own host name resolves to the "real" ip address (possibly one of many).
/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
-
Michael Hampton almost 11 yearsThen put the other IP address in
/etc/hosts
.
-
-
radai almost 11 yearsok, so how does windows do it?
-
sebelk almost 11 yearsI guess Windows makes the trick either using a host file (an equivalent of /etc/hosts of Linux, that you don't want to use it :-) ) or using netbios. You can take a look at: Microsoft TCP/IP Host Name Resolution Order
-
radai almost 11 yearsso why does it work even for simple machines not connected to anything?
-
c4f4t0r over 10 yearsLook the sebelk comment