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:~ # ping suse11
ping: unknown host suse11
suse11:~ # ping www.google.com
PING www.google.com ( 56(84) bytes of data.

i dont want to add the hostname to /etc/hosts as 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/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:
# or disable DNS configuration updates via netconfig by setting:
# 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


# /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
  • Then put the other IP address in /etc/hosts. Sep 22, 2013 at 14:25
  • @MichaelHampton - the address is obtained from dhcp, and i dont want to hardcode it
    – radai
    Sep 23, 2013 at 4:16

2 Answers 2


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, but pay attention to "search localdomain" in /etc/resolv.conf so that is appended to the "query", so 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 @ suse11


  • ok, so how does windows do it?
    – radai
    Sep 23, 2013 at 4:16
  • I 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
    – sebelk
    Sep 23, 2013 at 12:52

When you join a windows Domain, the dhcp service integrated in the PDC add one DNS A record in the windows dns services, for that reason you resolve a windows pc in Windows Domain Network

  • so why does it work even for simple machines not connected to anything?
    – radai
    Sep 27, 2013 at 5:33
  • Look the sebelk comment
    – c4f4t0r
    Sep 27, 2013 at 10:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .