For some reason, two of my machines have started suffering from extremely slow DNS lookups.
Sample timed output of 'host' command:
[root@ns507403 ~]# time host www.google.com
www.google.com has address 172.217.5.4
www.google.com has IPv6 address 2607:f8b0:4006:80d::2004
real 0m3.050s
user 0m0.000s
sys 0m0.004s
Lookups seem to take at least 3 seconds no matter which address is used or how many times the lookup is done. The highest I have seen was 9 seconds to lookup www.paypal.com
I have ruled out the possibility of a slow DNS server because I'm using the same DNS resolver on 4 other servers all located in the same data center, all of which work fine. (< 1ms lookups)
Things I have tried already without success:
- Adding
options single-request
to /etc/resolv.conf - Adding
options single-request-reopen
to /etc/resolv.conf - Disabling IPv6 using
sysctl -w net.ipv6.conf.all.disable_ipv6=1
- Disabling NetworkManager (It is not installed on my server)
This is my current /etc/resolv.conf file:
nameserver 127.0.0.1
nameserver 213.186.33.99
search ovh.net
The dig
command seems to work just fine, showing query time 0ms.
Any ideas what could be causing this? I'm using CentOS 6 on both machines.
dig @127.0.0.1 www.google.com
nameserver 127.0.0.1
line until that dig command above works. I would checkchkconfig --list | grep "3:on"
and see which DNS daemon is supposed to be running and fix that before you uncomment the 127.0.0.1 entry.