Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On my local Ubuntu 10.04 dev machine, if I do a wget for a web address such as "wget http://www.google.com", it gets stuck on "Resolving www.google.com" for up to 30 seconds before the response is received. If I type www.google.com into a browser, the response is near instant.

I have a similar experience using urllib.urlopen() in python, and file_get_contents() in php.

The reason I want to fix this issue is for testing code that accesses web services on my local dev machine (web service requests always seem to take up to 30 seconds which makes development slow and painful)

Any clues as to what might be causing this? How can I diagnose the problem?

share|improve this question
    
Using wget -4 took care of the problem as it forces wget to use IPv4 only (same as your browser). –  ADTC Dec 5 at 7:14

2 Answers 2

Google finds a number of reports that Ubuntu 10.4 has DNS timeout issues because it uses ipv6 (and the rest of your network does not, so you need to wait for the ipv6 lookup to timeout).

This might explain why your browser is faster, if it is configured not to use ipv6 for name resolution.

See, for example: http://askubuntu.com/questions/8704/slow-dns-resolution

share|improve this answer

The 30 seconds delay sounds like a DNS timeout so check /etc/resolv.conf (especially the first-named DNS server).

share|improve this answer

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.