I have an Ubuntu 12.04 server and the DNS looksups appear to be extremely slow. time curl www.google.com takes 40 seconds and time curl takes 70ms. I reinstalled another dedicated server with Ubuntu 12.04 and it has the same problem too.

Question: I have been asked to check my DNS configuration. So I added google's DNS servers but I am still getting slow DNS resolves. What else should I check for?


search ovh.net
  • You have localhost listed first. Are you running a recursive resolver? – James O'Gorman Apr 6 '13 at 21:30
  • I am not running and resolver (bind9?) on the system. Its a fresh install – Nyxynyx Apr 6 '13 at 21:30
  • Remove the line and see if that works. – James O'Gorman Apr 6 '13 at 21:31
  • It works after I rebooted the server (without removing However I have 2 more servers that needs their /etc/resolv.conf file updated and reloaded. How can you apply the new changes without rebooting the server? – Nyxynyx Apr 6 '13 at 21:37
  • 5
    Changes to resolv.conf do not require a reboot. – James O'Gorman Apr 6 '13 at 21:38

I just had this problem. I'm not sure about your case, but for me, it was a IPv6 network problem:

me@server:~$ time wget -O /dev/null google.com

--2014-08-26 09:44:15--  http://google.com/
Resolving google.com (google.com)... 2607:f8b0:4005:800::100e,,, ...
Connecting to google.com (google.com)|2607:f8b0:4005:800::100e|:80... ^C

real    1m32.876s
user    0m0.000s
sys     0m0.000s

I had to stop wget using Ctrl+C after 1.5 minutes. Note the 2607:f8b0:4005:800::100e indicates an IPv6 lookup. I added the following lines to /etc/sysctl.conf:

# Disable IPv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

And then refreshed those settings via: sudo sysctl -p Source: http://www.noobslab.com/2012/05/disable-ipv6-if-your-internet-is.html

Once I did that, things started working:

me@server:~$ time wget -O /dev/null google.com

--2014-08-26 09:46:12--  http://google.com/
Resolving google.com (google.com)...,,, ...
Connecting to google.com (google.com)||:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.google.com/ [following]
--2014-08-26 09:46:12--  http://www.google.com/
Resolving www.google.com (www.google.com)...,,, ...
Connecting to www.google.com (www.google.com)||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `/dev/null'

    [ <=>                                   ] 19,139      --.-K/s   in 0.002s  

2014-08-26 09:46:12 (10.6 MB/s) - `/dev/null' saved [19139]

real    0m0.093s
user    0m0.004s
sys 0m0.000s

Note: you can just run wget google.com but it will save a file in your current location. -O /dev/null will suppress that.

  • You saved my day Sir. Any idea why IPv6 could be messing with this? – Ivo Pereira Oct 1 '15 at 15:06

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.