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* example.com  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
  • Do you have any resolver running? 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?
    – aexl
    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 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.
    – aexl
    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.
    – aexl
    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)?

  • 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.
    – aexl
    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: i.imgur.com/ZlYOL.jpg
    – aexl
    Oct 14 '11 at 22:23

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.

  • 1
    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. 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:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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