Misconfigured named May Cause Slow TNSPING Here's a report of a recent incident. Tnsping sometimes, but not always, takes more than 30 seconds to respond. On this Red Hat 5 Linux box, strace on tnsping reveals DNS related delay. Analysis: $ strace -f -t tnsping test ... 15:58:05 socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 7 15:58:05 connect(7, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, 16) = 0 15:58:05 poll([{fd=7, events=POLLOUT}], 1, 0) = 1 ([{fd=7, revents=POLLOUT}]) 15:58:05 sendto(7, "\324\6\1\0\0\1\0\0\0\0\0\0\fourhostva\5mdacc\3"..., 44, MSG_NOSIGNAL, NULL, 0) = 44 15:58:05 poll([{fd=7, events=POLLIN|POLLOUT}], 1, 5000) = 1 ([{fd=7, revents=POLLOUT}]) 15:58:05 sendto(7, "c&\1\0\0\1\0\0\0\0\0\0\fourhostva\5mdacc\3"..., 44, MSG_NOSIGNAL, NULL, 0) = 44 15:58:05 poll([{fd=7, events=POLLIN}], 1, 4999) = 0 (Timeout) 15:58:10 socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 8 15:58:10 connect(8, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("")}, 16) = 0 15:58:10 poll([{fd=8, events=POLLOUT}], 1, 0) = 1 ([{fd=8, revents=POLLOUT}]) 15:58:10 sendto(8, "\324\6\1\0\0\1\0\0\0\0\0\0\fourhostva\5mdacc\3"..., 44, MSG_NOSIGNAL, NULL, 0) = 44 ... 15:58:10 socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 7 15:58:10 connect(7, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, 16) = 0 15:58:10 poll([{fd=7, events=POLLOUT}], 1, 0) = 1 ([{fd=7, revents=POLLOUT}]) 15:58:10 sendto(7, "\323n\1\0\0\1\0\0\0\0\0\0\fourhostvb\5mdacc\3"..., 44, MSG_NOSIGNAL, NULL, 0) = 44 15:58:10 poll([{fd=7, events=POLLIN|POLLOUT}], 1, 5000) = 1 ([{fd=7, revents=POLLOUT}]) 15:58:10 sendto(7, "F\326\1\0\0\1\0\0\0\0\0\0\fourhostvb\5mdacc\3"..., 44, MSG_NOSIGNAL, NULL, 0) = 44 15:58:10 poll([{fd=7, events=POLLIN}], 1, 4999) = 0 (Timeout) 15:58:15 socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 8 15:58:15 connect(8, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("")}, 16) = 0 15:58:15 poll([{fd=8, events=POLLOUT}], 1, 0) = 1 ([{fd=8, revents=POLLOUT}]) 15:58:15 sendto(8, "\323n\1\0\0\1\0\0\0\0\0\0\fourhostvb\5mdacc\3"..., 44, MSG_NOSIGNAL, NULL, 0) = 44 ... (In the above trace output, I only replaced the actual connect identifier with "test", our real DNS IP with "" and our hostnames with "ourhostva" and "ourhostvb".) Obviously, the first 5-second delay happens because tnsping can't get a DNS response from 127.0.0.1 at port 53 (the DNS port) to resolve ourhostva, and it goes on to query the good DNS, which returns the result immediately. Then it attempts to resolve ourhostvb, again with 127.0.0.1 first. After 5 seconds' wait in vain, it turns to the good DNS for an answer. The connect identifier test is defined with 8 addresses in the address_list (ourhostva to ourhostvh), so the total tnsping time takes 40 seconds. Cause: The culprit turns out to be a misconfigured named, caching only name server. We have named running and /etc/resolv.conf has "nameserver 127.0.0.1", but its config file, /etc/named.conf (or /etc/named.caching-nameserver.conf on some servers), does not have the forwarders option, which lists the good, upper level, DNS servers this caching only name server forwards DNS queries to. Solution: Either add to the named config file the forwarders option (and optionally add "forward only" or "forward first", which controls whether to look up locally if the forwarder DNS fails to resolve), or stop using named altogether. To permanently stop named, in addition to shutdown (`service named stop'), also use `chkconfig --level35 named off' to stop it in the future. And to make it clean, delete or comment out the "nameserver 127.0.0.1" line in /etc/resolv.conf.