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
bindand so on? Yeah, forgot to mention: there's nobindor (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:30netstat -na|grep 53– Lazy Badger Oct 14 '11 at 22:40/etc/hostsfile andapt-getone. – The Sexiest Man in Jamaica Oct 14 '11 at 23:00apt-cache policy bind9and realised I already have it installed, it just wasn't running for some reason./etc/init.d/bind9 startmade something to appear in thenetstat -na|grep 53output, 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