7

I have a problem resolving host names on Debian running on VMWare.

It just stopped working out of the blue. Somewhere after uninstalling percona server and deleting /etc/mysql. Initially it thought it was a problem with networking when host has been to sleep while guest was running which is a known issue with VMWare. But it can't be.

Debian 7.4, VMWare tools installed

/etc/resolv.conf

# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 8.8.4.4

ping, dig and nslookup output

ivar@debian:~$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=47 time=40.0 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=47 time=39.7 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 39.747/39.874/40.001/0.127 ms
ivar@debian:~$ dig google.com

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18895
;; flags: qr rd ra; QUERY: 1, ANSWER: 11, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;google.com.            IN  A

;; ANSWER SECTION:
google.com.     299 IN  A   173.194.113.100
google.com.     299 IN  A   173.194.113.99
google.com.     299 IN  A   173.194.113.96
google.com.     299 IN  A   173.194.113.103
google.com.     299 IN  A   173.194.113.110
google.com.     299 IN  A   173.194.113.102
google.com.     299 IN  A   173.194.113.98
google.com.     299 IN  A   173.194.113.105
google.com.     299 IN  A   173.194.113.97
google.com.     299 IN  A   173.194.113.101
google.com.     299 IN  A   173.194.113.104

;; Query time: 43 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Sat Mar 29 18:46:07 2014
;; MSG SIZE  rcvd: 204

ivar@debian:~$ nslookup google.com
Server:     8.8.8.8
Address:    8.8.8.8#53

Non-authoritative answer:
Name:   google.com
Address: 173.194.113.97
Name:   google.com
Address: 173.194.113.104
Name:   google.com
Address: 173.194.113.101
Name:   google.com
Address: 173.194.113.99
Name:   google.com
Address: 173.194.113.100
Name:   google.com
Address: 173.194.113.96
Name:   google.com
Address: 173.194.113.102
Name:   google.com
Address: 173.194.113.103
Name:   google.com
Address: 173.194.113.110
Name:   google.com
Address: 173.194.113.105
Name:   google.com
Address: 173.194.113.98

ivar@debian:~$ ping google.com
ping: unknown host google.com

Any ideas how to resolve this issue?

/etc/nsswitch.conf

# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat
group:          compat
shadow:         compat

hosts:          files mdns4_minimal wins [NOTFOUND=return] dns mdns4
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis
2
  • 2
    What are the contents of /etc/nsswitch.conf? Commented Mar 29, 2014 at 17:19
  • Added /etc/nsswitch.conf Commented Mar 29, 2014 at 17:37

1 Answer 1

7

With your current nsswitch.conf, dns will only be requested if a request for wins fails. Here are the relevant excerpts from the nsswitch.conf manpage on my system:

notfound
The lookup succeeded, but the requested entry was not found. The default action for this condition is "continue".

return
Return a result now. Do not call any further lookup functions.

In your example you sucessfully queried WINS but did not retrieve a result for google.com. To fix this, you can either remove the [NOTFOUND=return] or reorder the services that are queried for host lookup. Here is an example fix:

hosts:          files mdns4_minimal dns wins [NOTFOUND=return] mdns4
5
  • That does it. Btw, is the successful wins query with no answer also reflected in the output I posted? If so, could you tell me where? Since I'm not too good at interpreting that output :p Commented Mar 29, 2014 at 19:03
  • @Ivarpoiss Only in the nsswitch.conf file you posted. Commented Mar 29, 2014 at 19:23
  • That did the trick for me too! Just so I know, to which package is this configuration file related? Commented Mar 13, 2015 at 12:03
  • 1
    @martin libc6. The base C library contains the functions such as gethostbyname that do DNS lookups. The default is located at /usr/share/libc-bin/nsswitch.conf Commented Mar 13, 2015 at 13:11
  • I had a similar issue, deleting the [notfound=return] bits cleared it up, resolution is still a bit slower than it was last week before the upgrades/reinstalls that caused the issue but at least it resolves. (tip: copy the line and comment out the copy before making changes) Commented Aug 20, 2020 at 1:09

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.