1

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
ricmarques
  • 1,112
  • 1
  • 13
  • 23
radai
  • 505
  • 2
  • 5
  • 9

2 Answers2

1

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

sebelk
  • 642
  • 3
  • 13
  • 32
  • ok, so how does windows do it? – radai Sep 23 '13 at 04: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](http://support.microsoft.com/kb/172218) – sebelk Sep 23 '13 at 12:52
0

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

c4f4t0r
  • 5,149
  • 3
  • 28
  • 41