Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Like this:

root@tis-server:~# ping www.google.com
ping: unknown host www.google.com

root@tis-server:~# 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=55 time=50.3 ms
64 bytes from 8.8.8.8: 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 192.168.0.1 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:192.168.0.100  Bcast:0.0.0.0  Mask:255.255.255.0
          inet6 addr: fe80::4a5b:39ff:feae:2198/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          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:127.0.0.1  Mask:255.0.0.0
          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
address 192.168.0.100
netmask 255.255.255.0
share|improve this question
    
Possible duplicate askubuntu.com/questions/23011/… –  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
1  
What is the output of cat /etc/resolv.conf –  Manula Waidyanatha Jun 7 '12 at 9:30
show 5 more comments

4 Answers

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 8.8.8.8' | sudo tee -a /etc/resolv.conf

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

gateway 192.168.0.1

to the appropriate iface stanza.

share|improve this answer
2  
I already did that –  aitchnyu Jun 7 '12 at 9:35
    
The gateway would need to be fine for him to ping 8.8.8.8 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 8.8.8.8. Please edit that. –  aitchnyu Jun 7 '12 at 11:23
show 3 more comments

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
address 192.168.0.100
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.1.1
dns-nameservers 192.168.0.1 8.8.8.8

This results in /etc/resolv.conf containing:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.0.1
nameserver 8.8.8.8
share|improve this answer
add comment

I concur with Tim, you can ping but not resolve, then it is a DNS issue. you need to have a line " nameserver 8.8.8.8 " 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 8.8.8.8 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
add comment

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
add comment

Your Answer

 
discard

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.