This question already has an answer here:

I use Ubuntu Server 12.10. Why if I try:

ping google.com

ping bitbucket.org

or any other website I have:

ping: unknown host google.com

ping: unknown host bitbucket.org

EDIT:

ping 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_req=1 ttl=47 time=6.01 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=47 time=5.99 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=47 time=5.99 ms
64 bytes from 8.8.8.8: icmp_req=4 ttl=47 time=5.98 ms

nano /etc/resolv.conf is empty file

marked as duplicate by Eric Carvalho, BuZZ-dEE, psusi, Danatela, Avinash Raj May 15 '14 at 11:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • What's in /etc/resolv.conf? Any nameservers? – Louis Matthijssen May 14 '14 at 11:21
  • Could you also add output ping 8.8.8.8, and cat /etc/resolv.conf – c0rp May 14 '14 at 11:21
  • @c0rp I updated question – mamasi May 14 '14 at 11:26
  • Are you using DHCP or do you have configured a static IP? – Louis Matthijssen May 14 '14 at 11:27
  • 1
    Read this question. You need to set dns-nameservers. – c0rp May 14 '14 at 11:33

If you're using a static IP you should also add DNS servers.

  1. Edit /etc/network/interfaces:

    sudo nano /etc/network/interfaces
    
  2. Below iface eth0 inet static add the following line:

    dns-nameservers 8.8.8.8 8.8.4.4
    

    This will use Google's DNS servers.

  3. Restart your network:

    sudo /etc/init.d/networking restart
    

Note: as chaos says, you can also edit /etc/resolv.conf but these changes will be overwritten on reobot.

Note2: Sometimes sudo /etc/init.d/networking restart is not enough, but a full reboot helps.

  • 3
    I had to completely reboot, /etc/init.d/networking restart never seems to work for me, but that's ok because I'm glad it worked period. – geneorama Mar 21 '15 at 5:36
  • This is solved my problem.Thank you. – Kemal Türk Jul 7 at 9:13

Create a file called /etc/resolv.conf write fill in the contents:

nameserver <ip-of-your-nameserver>

For example if your want to use googles dns-service:

nameserver 8.8.8.8
nameserver 8.8.4.4
  • Shouldn't the nameservers be specified as dns-nameservers in /etc/network/interfaces instead? 12.10 server should be running resolvconf by default, so there's a good chance any manual changes to /etc/resolv.conf will simple get overwritten. – steeldriver May 14 '14 at 11:33

As I see from you comments and output you are do not understand what is DNS.

The Domain Name System (DNS) is a hierarchical distributed naming system for computers, services, or any resource connected to the Internet or a private network. It associates various information with domain names assigned to each of the participating entities. Most prominently, it translates easily memorized domain names to the numerical IP addresses needed for the purpose of locating computer services and devices worldwide. The Domain Name System is an essential component of the functionality of the Internet.

Other words if you want ping google.com, you need some service that will translate google.com into IP address 173.194.71.139 and then use it. Almost at any time you are querying server by domain name such as google.com DNS translates it to IP address.

Usually DHCP configure this stuff for you. But in your case it is not, because you configure your network settings manually. And you forget to add dns-nameserver.

How to add dns-nameserver

Open NetworkManager (press Win, type "NM" and you will see Network Connection). Find your connection name, Edit Connections... | Edit... | IPv4 Settings | Additional DNS servers. enter image description here Here you can add your DNS, if you want google type 8.8.8.8, if you know your ISP DNS type it.

If you do not have GUI, read this answer

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