Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Like this:

root@tis-server:~# ping
ping: unknown host

root@tis-server:~# ping
PING ( 56(84) bytes of data.
64 bytes from icmp_req=1 ttl=55 time=50.3 ms
64 bytes from icmp_req=2 ttl=55 time=65.4 ms

It was tinkered by somebody else and I (and him!) cant trace his actions. The graphical connection manager also refuses to work thanks to the tinkering.

It also makes route add default gw necessary for each reboot to atleast ping by IP.

How do I fix this?

It is Ubuntu 11.10

As requested:

Output of ifconfig:

eth0      Link encap:Ethernet  HWaddr 48:5b:39:ae:21:98  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::4a5b:39ff:feae:2198/64 Scope:Link
          RX packets:13194 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5156 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1420596 (1.4 MB)  TX bytes:827295 (827.2 KB)
          Interrupt:42 Base address:0x2000 

lo        Link encap:Local Loopback  
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4817 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4817 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:377732 (377.7 KB)  TX bytes:377732 (377.7 KB)

Output of resolv.conf:

Output of /etc/network/interfaces:

  GNU nano 2.2.6         File: /etc/network/interfaces                          

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
share|improve this question
Possible duplicate… – Mitch Jun 7 '12 at 9:23
Saw that. But my question pertains to connecting on the internet, not discovering other PCs in local network. – aitchnyu Jun 7 '12 at 9:25
Output of ifconfig please – Mitch Jun 7 '12 at 9:27
posted the same – aitchnyu Jun 7 '12 at 9:29
What is the output of cat /etc/resolv.conf – Manula Waidyanatha Jun 7 '12 at 9:30
up vote 2 down vote accepted

For Ubuntu releases prior to 12.04 you can put nameserver information in /etc/resolv.conf provided it is not automatically generated by NetworkManager or another utility.

Type the following command.

echo 'nameserver' | sudo tee -a /etc/resolv.conf

To add the gateway to /etc/network/interfaces, open that file in an editor and add a line


to the appropriate iface stanza.

share|improve this answer
I already did that – aitchnyu Jun 7 '12 at 9:35
The gateway would need to be fine for him to ping Its just DNS problem. – LinuxBill Jun 7 '12 at 11:04
setting the gateway did not help... – aitchnyu Jun 7 '12 at 11:11
I posted the gateway command because aitchnyu said 'he had to set gateway after each reboot' – Manula Waidyanatha Jun 7 '12 at 11:15
Your answer is right and accepted, but for the detail sudo echo nameserver Please edit that. – aitchnyu Jun 7 '12 at 11:23

If you're going to declare a static IP, you need to tell the computer pretty much everything that it would have gotten from the DHCP server. This is from a newer (12.04) Ubuntu build where dns-nameservers is used in place of editing resolv.conf

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static

This results in /etc/resolv.conf containing:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
share|improve this answer

I concur with Tim, you can ping but not resolve, then it is a DNS issue. you need to have a line " nameserver " at the top or your /etc/resolv.conf file so it is the first server it looks to for resolving DNS queries. However if your default gateway is incorrect then you will not be able to get out your local network, so if you can ping that is all good and working so must be DNS. so edit the /etc/resolv.conf file and see whats at the top of that. If this is for your desktop then i would recommend using the GUI from the task bar to set all that info.

share|improve this answer

Only being able to "ping" by IP address and not by hostname means your DNS resolution is not correct.

However you are also having to add a default gateway - which suggests your initial network setup is incorrect.

Whilst "popping" a value into resolv.conf seems like a good idea - I suggest you go and set up your network connection (via the GUI) to specify these values. And see if the situation is improved.

share|improve this answer
the GUI simply shows an "outline of a hand-fan" :-) The tinkering has disabled it, as I mentioned – aitchnyu Jun 7 '12 at 11:08
The network section in system settings lists the connection as "unmanaged" – aitchnyu Jun 7 '12 at 11:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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