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.

I am not able to browse any websites. Please take a look at the following error:

karthick@karthick:~$ ping www.google.com                         
ping: unknown host www.google.com


karthick@karthick:~$ dig www.google.com

; <<>> DiG 9.7.1-P2 <<>> www.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26402
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 4, ADDITIONAL: 4

;www.google.com.            IN  A

www.google.com.     238583  IN  CNAME   www.l.google.com.
www.l.google.com.   97  IN  A
www.l.google.com.   97  IN  A
www.l.google.com.   97  IN  A
www.l.google.com.   97  IN  A
www.l.google.com.   97  IN  A

google.com.     146866  IN  NS  ns3.google.com.
google.com.     146866  IN  NS  ns2.google.com.
google.com.     146866  IN  NS  ns1.google.com.
google.com.     146866  IN  NS  ns4.google.com.

ns2.google.com.     317814  IN  A
ns1.google.com.     317814  IN  A
ns3.google.com.     317814  IN  A
ns4.google.com.     317814  IN  A

;; Query time: 5 msec
;; WHEN: Wed Aug  3 15:30:38 2011
;; MSG SIZE  rcvd: 268


karthick@karthick:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr bc:30:5b:c4:fd:dc  
inet addr:172.29.XX.XX  Bcast:172.29.XX.XXX  Mask:
inet6 addr: fe80::be30:5bff:fec4:fddc/64 Scope:Link
RX packets:1757954 errors:0 dropped:0 overruns:0 frame:0
TX packets:1422948 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000 
RX bytes:1329324192 (1.3 GB)  TX bytes:1231317787 (1.2 GB)

lo        Link encap:Local Loopback  
inet addr:  Mask:
inet6 addr: ::1/128 Scope:Host
RX packets:10528 errors:0 dropped:0 overruns:0 frame:0
TX packets:10528 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0 
RX bytes:768164 (768.1 KB)  TX bytes:768164 (768.1 KB)

karthick@karthick:~$ sudo iptables -nvL
[sudo] password for karthick: 
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target     prot opt in     out     source           destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target     prot opt in     out     source           destination         

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target     prot opt in     out     source               destination 
share|improve this question
How are you trying to connect to your ISP? Wireless/Ethernet (Cable) or modem. In order to help with this problem we will need some more information from you. –  Christopher Stansbury Aug 3 '11 at 7:10
This seems to be a networking problem. –  con-f-use Aug 3 '11 at 7:14
paste this command's output: ifconfig –  shantanu Aug 3 '11 at 7:38
What is in your /etc/nsswitch.conf, especially on the line that starts with hosts:? You should have dns somewhere on that line. –  taneli Aug 13 '11 at 19:09
@Scaine dig, host and nslookup do not use the name service switch (as they don't need to consider other name service mechanisms than DNS). Most other software uses it. It is part of libc, and man nsswitch.conf on the command line will give you rationale and overview. –  taneli Aug 16 '11 at 11:23

10 Answers 10

up vote 6 down vote accepted

I have found that the problem lies in this file /etc/nsswitch.conf. In that file dns entry was missed. After adding that entry i am able to browse the sites.


share|improve this answer
Shouldn't you have accepted taneli's answer? –  Oxwivi Aug 16 '11 at 11:30
@OXwivi: taneli answered the question almost a day after karthick87 had answered it him self. –  binW Aug 16 '11 at 12:19
@binW, thanks for pointing it out, I did not notice the time gap. It's a shame the bounty's going to waste though... –  Oxwivi Aug 16 '11 at 12:28

It seems that you've got connectivity to the Internet (dig works ok, DNS replies are good), so perhaps it's a higher-level issue, like proxy setup.

So, have you checked your system's proxy settings?

share|improve this answer
Perhaps run a wget to test http directly? –  Scaine Aug 14 '11 at 20:51

That looks like a DNS issue.

Run dig example.com to check such a DNS query. If it times out or fails, the configured DNS server is broken. Try setting an alternative DNS server by adding the next line to /etc/resolv.conf (replacing other nameserver entries):


This nameserver is from Google, but can be set to any valid DNS server.

share|improve this answer
I have tried but still i am getting the same error.. –  karthick87 Aug 5 '11 at 6:25
can you post the contents of your resolve.conf file? –  fossfreedom Aug 12 '11 at 15:47
OpenDNS can be used for DNS resolution as well. –  Nathan Osman Aug 14 '11 at 19:24

You need to add dns to /etc/nsswitch.conf on the line that starts with hosts:. For example, mine has

hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4

which I think is the default in natty.

It would be good to know if your setup was broken by some software, as it is highly uncommon (and difficult to diagnose) if the name service switch facility is not using the default settings.

share|improve this answer

did you notice this

RX bytes:1329324192 (1.3 GB)  TX bytes:1231317787 (1.2 GB)

you are receiving 1.3 Giga Bytes and transmitting 1.2 Giga Bytes. I have been listening to a radio program through the web browser for almost two hours and I have only Received (RX) 888.8 MB and transmitted (TX) 22.7 MB. Something is using your network connection and this could be what is blocking your access. You do not say what OS you are using. You may now be the proud owner of a zombie machine.

Are you using a torrent? Have you given it too much bandwidth?

share|improve this answer
That depends on how long you have your computer running, I get my share of a couple GB if I update some Linux VMs. The sending is still odd, though. –  queueoverflow Aug 13 '11 at 22:21

Turn off all applications (Firefox, Thunderbird, etc).

Then enter these commands in a terminal:

sudo -s  <enter your password>
tcpdump -qtn port 53 & host www.google.com
Ctrl-c (2 keys on the keyboard)

The last 2 commands are for stopping the tcpdump command.

Post the output back into your question as an edit (assuming you find a way to do so without a working internet connection - perhaps a USB key to transfer the text log to a PC with internet?).

share|improve this answer

I've recently had this problem on Windows where I had DNS but no Ping, there are two possibilities:

  1. You are using a proxy that is not correctly working, get rid of the proxy or fix it.

  2. There is something broken in the network chain; which means that you have to rebuild it from scratch, if you don't want to get your hands dirty with cleaning and reinstalling network drivers and programs you might as well take a back-up and reinstall Ubuntu...

share|improve this answer

It must be an ISP problem, or the local modem/router/switch plays with you. Restart your machine, modem and all network affected devices.

(Otherwise, can you ping Google by IP: ?)

share|improve this answer

You've masked off your IP address as 172.29.XX.YY, but since your subnet mask is, you need to make sure that the third octect (the xx, not the yy), is the same as your default router. If not, then you'll only see PCs on the same subnet as you (172.29.xx). If your DNS server is on the same subnet as yours, this would explain why nothing, except it, is working.

share|improve this answer

One way to rule out the browser being the problem would be to run:

telnet google.com 80

from a Terminal prompt. If it works you should have two lines that say: Connected to google.com Escape character is '^]..

share|improve this answer

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.