Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

ETA:

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 (209.85.153.104), 30 hops max, 60 byte packets
 1  192.168.4.1 (192.168.4.1)  0.496 ms  1.033 ms  1.294 ms
 2  210.212.187.65 (210.212.187.65)  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 (209.85.153.104) 56(84) bytes of data.
^C
--- www.l.google.com ping statistics ---
100 packets transmitted, 0 received, 100% packet loss, time 99131ms

pinging www.google.com fails.

share|improve this question
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 192.168.1.131 nameserver 208.67.222.222 nameserver 208.67.220.220 nameserver 192.168.1.130 nameserver 218.248.240.23 nameserver 218.248.240.134 nameserver 218.248.240.208 nameserver 218.248.240.135 –  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

2 Answers 2

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.

share|improve this answer
    
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

share|improve this answer
    
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

 
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.