Ping: unknow host but can ping IPs

Posted January 30, 2016 13.4k views

After restarting my droplet [Ubuntu 15.10 x64], I keep getting “unknown host” message. Pinging IPs though works fine.

I cannot cat resolv.conf, it says “No such file or directory” although on ls -l it does appear as a linked file to /run/resolvconf/resolv.conf. which I cannot access either - no resolvconf folder in run dir.

In /etc/network/interfaces, I have dns-nameservers under eth0.

Sorry if any of the above information is irrelevant, I am a Linux noob.
Any help would be greatly appreciated!

  • Note: your system probably requires you to use ‘sudo’ in front of your privilege access commands, or need to issue 'su root’ to gain full root access. Try

    sudo cat /etc/resolve.conf 

    So, reboot cleared out your DNS cache and now your DNS servers have gone dark. Can you ping IP address or ?

  • I always log in with root, but tried sudo cat /etc/resolve.conf anyway. The result is the same “No such file or directory”.

    I can ping both and I can also ping the gateway.

    One additional note though, I was playing around with ufw before restarting the droplet. However, after discovering this issue, I have inactivated it, but the problem persists.

  • @medowlock - Does your system have a /var/run/resolvconf/resolv.conf
    If it’s there, for diagnostic purpose, create a link to it in etc

    ln -s /var/run/resolvconf/resolv.conf /etc/resolv.conf

    Then try ping

  • This is where it gets really weird, at least for me. When listing the contents of /etc I can see there is a file resolv.conf symlinked to /run/resolvconf/resolv.conf. However

    root@ubuntu-512mb-fra1-01:/run# cd /run/resolvconf
    -bash: cd: /run/resolvconf: No such file or directory

    And running the command you mentioned gives

    root@ubuntu-512mb-fra1-01:~# ln -s /var/run/resolvconf/resolv.conf /etc/resolv.conf
    ln: failed to create symbolic link ‘/etc/resolv.conf’: File exists
    root@ubuntu-512mb-fra1-01:~# cat /etc/resolv.conf
    cat: /etc/resolv.conf: No such file or directory
    root@ubuntu-512mb-fra1-01:~# ping
    ping: unknown host

    Thanks for all your answers and patience!

  • @medowlock - Oops, need to remove the existing file before the link command:

    mv /etc/resolv.conf /etc/resolv.conf.hold
    ln -s /var/run/resolvconf/resolv.conf /etc/resolv.conf
  • Show 2 more comments

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

This question was answered by @medowlock:

@gndo No luck.

But I did manage to get it working again. What I did was remove the symlink altogether and created the resolv.conf file manually and added to its contents:


View the original comment