LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   DNS lookups taking too long. (http://www.linuxquestions.org/questions/linux-server-73/dns-lookups-taking-too-long-891169/)

dafydd2277 07-11-2011 06:21 PM

DNS lookups taking too long.
 
Good Morning!

This investigation started with an Oracle installation saying "Dude, you're bad host lookups are taking more than 15000 ms!" A followup (accidental) test came about when the master DNS server got shut off for longer than the zone files' Expire time.

=== The questions:

1) Of the 12 test look ups of a known bad hostname, only one returned "Host badhost not found: 2(SERVFAIL)" which I believe is the appropriate response. Why might that be?

2) Adding "option timeout" and "option attempts" to /etc/resolv.conf on the client side don't appear to change look up times in any material way. How can I speed up the SERVFAIL or time out responses from the server side?

=== The tests:

Let's start with two bind DNS servers. Call them "master" and "slave."

Both are:
RHEL 5.4
bind-9.3.6-4.P1.el5_5.3
bind-chroot-9.3.6-4.P1.el5_5.3

They handle a test network of three subdomains and one subnet. This network doesn't have access to the outside world, but has some 200 hosts in the test net.

Aside from the master/slave zoning, named.conf is identical for both hosts. I can look in slave:/var/named/chroot/var/named/slaves/ and see good copies of the master's zone files.

Test a known good host with both DNS servers running.
Code:

[root@testhost ~]# time host goodhost
goodhost.sub.dom.ain has address <goodhostIP>

real    0m0.003s
user    0m0.003s
sys    0m0.002s

[root@testhost ~]# time host goodhost <DNSmaster>
Using domain server:
Name: <DNSmaster>
Address: <DNSmaster>#53
Aliases:

goodhost.sub.dom.ain has address <goodhostIP>

real    0m0.003s
user    0m0.000s
sys    0m0.003s

[root@testhost ~]# time host goodhost <DNSslave>
Using domain server:
Name: <DNSslave>
Address: <DNSslave>#53
Aliases:

goodhost.sub.dom.ain has address <goodhostIP>

real    0m0.003s
user    0m0.002s
sys    0m0.000s

Test a non-existant hostname with both servers running.
Code:

[root@testhost ~]# time host badhost
;; connection timed out; no servers could be reached

real    0m12.013s
user    0m0.001s
sys    0m0.002s

[root@testhost ~]# time host badhost <DNSmaster>
Using domain server:
Name: <DNSmaster>
Address: <DNSmaster>#53
Aliases:

Host badhost not found: 2(SERVFAIL)

real    0m7.473s
user    0m0.000s
sys    0m0.002s

[root@testhost ~]# time host badhost <DNSslave>
;; connection timed out; no servers could be reached

real    0m14.015s
user    0m0.002s
sys    0m0.001s

Shutdown "slave" and repeat all six tests.
Code:

[root@testhost ~]# time host goodhost
goodhost.sub.dom.ain has address <goodhostIP>

real    0m3.008s
user    0m0.001s
sys    0m0.001s

[root@testhost ~]# time host goodhost <DNSmaster>
Using domain server:
Name: <DNSmaster>
Address: <DNSmaster>#53
Aliases:

goodhost.sub.dom.ain has address <goodhostIP>

real    0m0.003s
user    0m0.003s
sys    0m0.001s

[root@testhost ~]# time host goodhost <DNSslave>
Using domain server:
Name: <DNSmaster>
Address: <DNSmaster>#53
Aliases:

goodhost.sub.dom.ain has address <goodhostIP>

real    0m6.014s
user    0m0.000s
sys    0m0.002s

[root@testhost ~]# time host badhost
;; connection timed out; no servers could be reached

real    0m15.019s
user    0m0.002s
sys    0m0.000s

[root@testhost ~]# time host badhost <DNSmaster>
;; connection timed out; no servers could be reached

real    0m14.015s
user    0m0.001s
sys    0m0.001s

[root@testhost ~]# time host badhost <DNSslave>
;; connection timed out; no servers could be reached

real    0m20.029s
user    0m0.002s
sys    0m0.000s

Restart "slave" and stop "master." Re-run all six tests.
Code:

[root@testhost ~]# time host goodhost
goodhost.sub.dom.ain has address <goodhostIP>

real    0m0.004s
user    0m0.002s
sys    0m0.001s

[root@testhost ~]# time host goodhost <DNSmaster>
Using domain server:
Name: <DNSslave>
Address: <DNSslave>#53
Aliases:

goodhost.sub.dom.ain has address <goodhostIP>
real    0m3.009s
user    0m0.001s
sys    0m0.001s

[root@testhost ~]# time host goodhost <DNSslave>
Using domain server:
Name: <DNSslave>
Address: <DNSslave>#53
Aliases:

goodhost.sub.dom.ain has address <goodhostIP>

real    0m0.003s
user    0m0.001s
sys    0m0.001s

[root@testhost ~]# time host badhost
;; connection timed out; no servers could be reached

real    0m12.011s
user    0m0.002s
sys    0m0.000s

[root@testhost ~]# time host badhost <DNSmaster>
;; connection timed out; no servers could be reached

real    0m19.823s
user    0m0.001s
sys    0m0.001s

[root@testhost ~]# time host badhost <DNSslave>
;; connection timed out; no servers could be reached

real    0m14.016s
user    0m0.002s
sys    0m0.000s


kbp 07-11-2011 07:42 PM

Are "goodhost" and "badhost" FQDN's ? .. and if so is the domain part wrong or the host part wrong for "badhost"?

dafydd2277 07-12-2011 12:48 AM

goodhost and badhost are both simple host names. Goodhost exists in one of the three subdomains. Badhost is, literally, "badhost," and a hostname (so to speak) designed to fail.


All times are GMT -5. The time now is 08:58 AM.