0

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?

EEAA
  • 109,363
  • 18
  • 175
  • 245
Michael B
  • 341
  • 1
  • 2
  • 9
  • Using `wget -4` took care of the problem as it forces `wget` to use IPv4 only (same as your browser). – ADTC Dec 05 '14 at 07:14

2 Answers2

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: https://askubuntu.com/questions/8704/slow-dns-resolution

ramruma
  • 2,740
  • 1
  • 15
  • 8
0

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

ramruma
  • 2,740
  • 1
  • 15
  • 8