Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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/reslov.conf

# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 8.8.4.4

ping, dig and nsloopup 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
share|improve this question
2  
What are the contents of /etc/nsswitch.conf? –  jordanm Mar 29 at 17:19
    
Added /etc/nsswitch.conf –  Ivarpoiss Mar 29 at 17:37

1 Answer 1

up vote 2 down vote accepted

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
share|improve this answer
    
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 –  Ivarpoiss Mar 29 at 19:03
    
@Ivarpoiss Only in the nsswitch.conf file you posted. –  jordanm Mar 29 at 19:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.