Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a quite common problem except all the solutions I've found didn't work for me.

I had my VPS, running Debian 5/Debian 6/CentOS 5.5/whatever-else-OS-I've-tried, rebuilt and reinstalled. Once started, the network works fine, and I can ping IPs, for example. The problem here is that the VPS can't resolve hostnames.

First of all, the default resolv.conf looks fine:

vps:~# cat /etc/resolv.conf

Those hosts are set by default by my VPS provider. The file does not get rewrited. And the default version is restored on every reboot.

UPDATE The server works, I've tried it on my home PC. As well as I've tried my home ISP's DNS server on that VPS -- still no success.

As I've already said, ping works fine as well:

vps:~# ping -c 4
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=55 time=7.63 ms
64 bytes from icmp_seq=2 ttl=55 time=7.55 ms
64 bytes from icmp_seq=3 ttl=55 time=7.08 ms
64 bytes from icmp_seq=4 ttl=55 time=7.30 ms

Here's what the /etc/hosts file looks like:

vps:~# cat /etc/hosts
::1 localhost.localdomain localhost localhost.localdomain localhost
# Auto-generated hostname. Please do not remove this comment.
*my-actual-IP-goes-here*  vps

UPDATE The contents of /etc/nsswitch.conf:

vps:~# cat /etc/nsswitch.conf
passwd:         compat
group:          compat
shadow:         compat

hosts:          files dns
networks:       files

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

netgroup:       nis

The /etc/network/interfaces file has the 100% working backed up version of config, and I can see that in the ifconfig output. The /ver/log/syslog file doesn't say anything relevant, except the

sm-mta[1443]: gethostbyaddr(my-actual-IP-goes-here) failed: 2

UPDATE bind is installed:

vps:~# apt-cache policy bind9
  Installed: 1:9.5.1.dfsg.P3-1+lenny1
  Candidate: 1:9.5.1.dfsg.P3-1+lenny1
  Version table:
 *** 1:9.5.1.dfsg.P3-1+lenny1 0
        100 /var/lib/dpkg/status
share|improve this question
Do you have any resolver running? – Lazy Badger Oct 14 '11 at 22:26
Hey! What do you mean, bind and so on? Yeah, forgot to mention: there's no bind or (I'm pretty sure) other software with same functionality installed. However, how do i double-check? – The Sexiest Man in Jamaica Oct 14 '11 at 22:30
if you haven't any resolver, you get exactly "...the VPS can't resolve hostnames..." in order to resolve you must have answers for "who" and "where". netstat -na|grep 53 – Lazy Badger Oct 14 '11 at 22:40
I guess you're right: the output of the above command is empty. I'm gonna manually add my nearest Debian mirror to /etc/hosts file and apt-get one. – The Sexiest Man in Jamaica Oct 14 '11 at 23:00
Tried apt-cache policy bind9 and realised I already have it installed, it just wasn't running for some reason. /etc/init.d/bind9 start made something to appear in the netstat -na|grep 53 output, mostly tcp & udp LISTEN on my external and local IPs. But I'm afraid resolving still doesn't work. – The Sexiest Man in Jamaica Oct 14 '11 at 23:17

Is /etc/nsswitch.conf set to use DNS resolution?

Just another thought, have you verified that the DNS server is functioning and configured properly (not demonstrated in your information provided)?

share|improve this answer
thank you for your reply. Well, thats Google DNS service and it's supposed to work... But, well, yeah before I found out that's a Google service, I've tried that server on my home PC with Windows's built-in nslookup utility, and yeah, it works. – The Sexiest Man in Jamaica Oct 14 '11 at 22:07
And the contents of your /etc/nsswitch.conf file? – mdpc Oct 14 '11 at 22:16
Here they are: – The Sexiest Man in Jamaica Oct 14 '11 at 22:23
up vote 0 down vote accepted

Well, I got up in the morning and everything works. I did nothing else to VPS except what I mentioned in my updates and comments. So I guess that was external issue in the DC.

And now, since everything works, that's pretty much "happy end". Thank you for your replies.

share|improve this answer
Glad to hear it works. Remember to come back and accept your answer, otherwise the question keeps coming back for people to continue to try to answer. – Michael Hampton Aug 25 '12 at 23:58

Try using dig to trouble-shoot your current dns woes (apt-get install dnsutils)

Also to actually use your bind install you'll need to point your resolv.conf at it:


share|improve this answer

Your Answer


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.