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 
  • 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
  • 1
    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
  • 3
    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
  • 1
    @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

12 Answers 12


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.


  • @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

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.


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?

  • 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.

  • 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

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?

  • 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. – Martin Ueding 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?).


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...


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: ?)


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.


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 '^]..


Ran into a similar problem today, where all network setting where correct, but I could only ping and reach local machines.

I checked the above file and had the DNS entry but noticed I missed the mdns4 entry . After adding the mdns4 all is OK. Mentioning this in case some one else runs into same problem


I realize this has been solved, but I had the same symptom and the solution had to do with the default network interface card that is used by the program in question.

N.B. All linux machines (Ubuntu 15.10). DNS is bind9 running on Ubuntu 15.10 as well.

I set up a DNS server on a LAN to which the connected machines were using their second or third network interface card (i.e. each machine had several network interface cards connected to different networks) e.g. (for any given machine on the network in question):

  1. Interface 1: enp0s3 connected to some network with no DNS configured
  2. Interface 2: enp0s8 connected to the network with the new DNS
  3. Interface 3: enp0s9 connected to some network with no DNS configured

Dig's behaviour appears to indicate that it iteratively goes through all the interfaces until it gets a response, whereas ping just tries the first interface then stops/gives up.

After "downing" the first interface with:

ifconfig enp0s3 down

ping then started using the DNS on enp0s8

Hope this helps anyone who might still be trying to figure it out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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