1

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, 8.8.8.8 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
nameserver 8.8.8.8
nameserver 8.8.4.4

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 8.8.8.8 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 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_seq=1 ttl=55 time=7.63 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=55 time=7.55 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=55 time=7.08 ms
64 bytes from 8.8.8.8: 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
127.0.0.1 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
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
Starfish
  • 2,735
  • 25
  • 28
ᴍᴇʜᴏᴠ
  • 577
  • 1
  • 6
  • 20
  • 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? – ᴍᴇʜᴏᴠ 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. – ᴍᴇʜᴏᴠ 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. – ᴍᴇʜᴏᴠ Oct 14 '11 at 23:17
  • `nslookup www.google.com` + `traceroute www.google.com` - test, not afraid – Lazy Badger Oct 14 '11 at 23:43
  • What hostname are you trying to resolve and what is your IP address? I'm asking this just to check that it is actually a resolvable one. – sybreon Oct 15 '11 at 02:18
  • No need to delete this question, the steps can be useful for other people. – sysadmin1138 Oct 15 '11 at 12:22
  • I'd like to see the output from `dig -t a www.google.com @8.8.8.8`. – bahamat Jun 20 '12 at 21:50

3 Answers3

0

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)?

mdpc
  • 11,856
  • 28
  • 53
  • 67
  • 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 8.8.8.8 server on my home PC with Windows's built-in nslookup utility, and yeah, it works. – ᴍᴇʜᴏᴠ 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: http://i.imgur.com/ZlYOL.jpg – ᴍᴇʜᴏᴠ Oct 14 '11 at 22:23
0

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.

ᴍᴇʜᴏᴠ
  • 577
  • 1
  • 6
  • 20
  • 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. – Michael Hampton Aug 25 '12 at 23:58
0

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:

nameserver 127.0.0.1

kband
  • 459
  • 2
  • 6