I am having an error with name resolution that I am not able to figure out.

The system is able to resolve names, say, www.google.com when using a graphical browser like chrome or firefox. But on the command line it is not able to (unless I add the domain in /etc/hosts). This extends to all operations on the command line like ping and others. We have a proxy in this environment and the proxy information is set using environment variables.


I noticed that it does seem to resolve IP addresses but it is still not able to reach them. This makes it even more perplexing.

farhat@farhat:~$ traceroute www.google.com
traceroute to www.google.com (, 30 hops max, 60 byte packets
 1 (  0.496 ms  1.033 ms  1.294 ms
 2 (  0.872 ms  0.942 ms  0.930 ms
 3  * * *
 4  * * *
 5  * * *
 6  * * *
 7  * * *

farhat@farhat:~$ ping www.google.com
PING www.l.google.com ( 56(84) bytes of data.
--- www.l.google.com ping statistics ---
100 packets transmitted, 0 received, 100% packet loss, time 99131ms

pinging www.google.com fails.

  • 2
    What are the contents of /etc/nsswitch.conf & /etc/resolv.conf ? – jamespo Mar 17 '11 at 8:15
  • The only problem I've had with name resolution was because there was some daemon or something like that running that was doing nameserver cacheing. What command are you using on the command line? – Faheem Mitha Mar 17 '11 at 8:38
  • @jamespo $ cat /etc/resolv.conf nameserver nameserver nameserver nameserver nameserver nameserver nameserver nameserver – Farhat Mar 23 '11 at 15:58
  • @jamespo farhat@farhat:~/Dropbox/projects/huhida$ cat /etc/nsswitch.conf # /etc/nsswitch.conf # # If you have the 'glibc-doc-reference' and 'info' packages installed, try: # 'info libc "Name Service Switch"' for information about this file. passwd: compat group: compat shadow: compat hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 networks: files protocols: db files services: db files ethers: db files rpc: db files netgroup: nis – Farhat Mar 23 '11 at 16:02
  • I removed some comment lines starting with a # in the files since it was getting too long for the comment box. – Farhat Mar 23 '11 at 19:19

In this case the domain resolution is not done in your browser, but in the proxy server. The command line, and all other "local" programs, rely on the domain resolution capabilities of your OS, unless you use lynx with a proxy configured, of course.

  • That sounds understandable. How can I change this behavior for command line programs? I'd rather not run firefox when I need wget. – Farhat Mar 23 '11 at 16:04
  • Not at all. You have to understand how a HTTP proxy works. It is a service like every other service in the internet, too. And your software has to be programmed (and configured) to use a proxy. In addition, a proxy never returns an IP for a DNS name, it just fetches the pages on your behalve, and then deliveres them to your browser. However, if you just want to use wget: It supports HTTP proxies. See the wget manpage. Set the *_proxy env variables, and eventually provice proxy username and password with the --proxy-user and --proxy-passwd cmdline parameters. – Daniel Mar 23 '11 at 16:17
  • The environment variables are all set properly. The problem still persists. There is no login:password on the proxy. – Farhat Mar 23 '11 at 19:18
  • Then I cannot do more for you – Daniel Mar 24 '11 at 8:11

I have had issues with mdns4_minimal in /etc/nsswitch.conf and would suggest testing removing that

  • removing just the word mdns4_minimal caused things to stop working completely. – Farhat Mar 24 '11 at 13:09
  • in that case your local dns resolution is completely hosed - I suggest you start testing with ping & dig – jamespo Mar 24 '11 at 15:32

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.