2

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 173.194.74.147 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?

/etc/resolve/conf

nameserver 127.0.0.1
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 213.186.33.99
search ovh.net
15
  • 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 127.0.0.1 line and see if that works. – James O'Gorman Apr 6 '13 at 21:31
  • It works after I rebooted the server (without removing 127.0.0.1). 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
3

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, 74.125.239.98, 74.125.239.100, ...
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)... 74.125.239.98, 74.125.239.100, 74.125.239.102, ...
Connecting to google.com (google.com)|74.125.239.98|: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)... 74.125.239.115, 74.125.239.112, 74.125.239.116, ...
Connecting to www.google.com (www.google.com)|74.125.239.115|: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.

1
  • 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.