<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>Thanks for your answer. The full dig output was in the first posting.<br>I have not modified nsswitch.conf and /etc/hosts contains only this:<br><br>127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4<br>::1         localhost localhost.localdomain localhost6 localhost6.localdomain6<br><br>And you were right! When using "dig www.google.com @127.0.0.1" it takes just<br>0.021 seconds. But I still do not have a clue why, do you?<br><br>When using another recursor (Dnsmasq) there is no time difference when using<br>@localhost or @127.0.0.1.<br><br>Thanks,<br>Shamus<br><br></div>  <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div
 dir="ltr"> <hr size="1">  <font face="Arial" size="2"> <b><span style="font-weight:bold;">Von:</span></b> Michael Loftis <mloftis@wgops.com><br> <b><span style="font-weight: bold;">An:</span></b> Shamus Smith <smithshamus@yahoo.de> <br><b><span style="font-weight: bold;">CC:</span></b> bert hubert <bert.hubert@netherlabs.nl>; "pdns-users@mailman.powerdns.com" <pdns-users@mailman.powerdns.com> <br> <b><span style="font-weight: bold;">Gesendet:</span></b> 18:44 Sonntag, 23.Juni 2013<br> <b><span style="font-weight: bold;">Betreff:</span></b> Re: [Pdns-users] 1 sec delay before DNS-answer at pdns-recursor<br> </font> </div> <div class="y_msg_container"><br>What about giving the full dig output too?  My bet is you're actually<br>experiencing some sort of huge delay starting up dig or resolving<br>"localhost", use @127.0.0.1 instead and see if the time goes away.<br>Does your /etc/hosts contain 'localhost'?  Have you
 modified your<br>nsswitch.conf? (Assuming standard *nix like system)<br><br>On Sun, Jun 23, 2013 at 3:58 AM, Shamus Smith <<a ymailto="mailto:smithshamus@yahoo.de" href="mailto:smithshamus@yahoo.de">smithshamus@yahoo.de</a>> wrote:<br>> Hello Bert,<br>><br>>> > Any ideas why it takes so long?<br>>><br>>> Rerun with --trace enabled and check what is happening. With some study,<br>>> it should be clear what it is waiting for.<br>><br>> did that already before, but still did not found anything helpful there.<br>> Below is a new trace.<br>> btw, I am using 3.5.1 (package pdns-recursor-3.5.1-1.el6.x86_64).<br>><br>> Thanks,<br>>  Shamus<br>><br>> - /etc/init.d/pdns-recursor start<br>> Jun 23 12:30:12 server pdns_recursor[11064]: PowerDNS recursor 3.5.1 (C)<br>> 2001-2013 PowerDNS.COM BV (May  3 2013, 20:04:33, gcc 4.4.7 20120313 (Red<br>> Hat 4.4.7-3)) starting up<br>>
 Jun 23 12:30:12 server pdns_recursor[11064]: PowerDNS comes with ABSOLUTELY<br>> NO WARRANTY. This is free software, and you are welcome to redistribute it<br>> according to the terms of the GPL version 2.<br>> Jun 23 12:30:12 server pdns_recursor[11064]: Operating in 64 bits mode<br>> Jun 23 12:30:12 server pdns_recursor[11064]: Reading random entropy from<br>> '/dev/urandom'<br>> Jun 23 12:30:12 server pdns_recursor[11064]: Only allowing queries from:<br>> 127.0.0.0/8, 10.0.0.0/8, 100.64.0.0/10, 169.254.0.0/16, 192.168.0.0/16,<br>> 172.16.0.0/12, ::1/128, fe80::/10<br>> Jun 23 12:30:12 server pdns_recursor[11064]: Will not send queries to:<br>> 127.0.0.0/8, 10.0.0.0/8, 100.64.0.0/10, 169.254.0.0/16, 192.168.0.0/16,<br>> 172.16.0.0/12, ::1/128, fe80::/10, 0.0.0.0, ::<br>> Jun 23 12:30:12 server pdns_recursor[11064]: NOT using IPv6 for outgoing<br>> queries - set 'query-local-address6=::' to enable<br>> Jun 23
 12:30:12 server pdns_recursor[11064]: Redirecting queries for zone<br>> '.' to: 8.8.8.8:53<br>> Jun 23 12:30:12 server pdns_recursor[11064]: Inserting rfc 1918 private<br>> space zones<br>> Jun 23 12:30:12 server pdns_recursor[11064]: Not decreasing socket buffer<br>> size from 229376 to 200000<br>> Jun 23 12:30:12 server pdns_recursor[11064]: Listening for UDP queries on<br>> 127.0.0.1:53<br>> Jun 23 12:30:12 server pdns_recursor[11064]: Enabled TCP data-ready filter<br>> for (slight) DoS protection<br>> Jun 23 12:30:12 server pdns_recursor[11064]: Listening for TCP queries on<br>> 127.0.0.1:53<br>> Jun 23 12:30:12 server pdns_recursor[11064]: Calling daemonize, going to<br>> background<br>> Jun 23 12:30:12 server pdns_recursor[11065]: Set effective group id to 497<br>> Jun 23 12:30:12 server pdns_recursor[11065]: Set effective user id to 497<br>> Jun 23 12:30:12 server pdns_recursor[11065]: Launching 2
 threads<br>> Jun 23 12:30:12 server pdns_recursor[11065]: Done priming cache with root<br>> hints<br>> Jun 23 12:30:12 server pdns_recursor[11065]: Done priming cache with root<br>> hints<br>> Jun 23 12:30:12 server pdns_recursor[11065]: Enabled 'epoll' multiplexer<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: No cache hit for '.|NS',<br>> trying to find an appropriate NS record<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: No cache hit for '.|NS',<br>> trying to find an appropriate NS record<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: Cache consultations done,<br>> have 1 NS to contact<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: Cache consultations done,<br>> have 1 NS to contact<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: Nameservers:<br>> -8.8.8.8:53(0.00ms)<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: Trying to resolve NS<br>> '-8.8.8.8:53'
 (1/1)<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: Domain has hardcoded<br>> nameserver(s)<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: Resolved '.' NS -8.8.8.8:53<br>> to: 8.8.8.8<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: Nameservers:<br>> -8.8.8.8:53(0.00ms)<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: Trying to resolve NS<br>> '-8.8.8.8:53' (1/1)<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: Domain has hardcoded<br>> nameserver(s)<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: Resolved '.' NS -8.8.8.8:53<br>> to: 8.8.8.8<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: Trying IP 8.8.8.8:53, asking<br>> '.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: Trying IP 8.8.8.8:53, asking<br>> '.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: Got 13 answers from<br>> -8.8.8.8:53 (8.8.8.8), rcode=0, aa=0, in 6ms<br>> Jun 23 12:30:12
 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|d.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|l.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|c.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|g.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|h.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|b.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: Got 13 answers from<br>> -8.8.8.8:53 (8.8.8.8), rcode=0, aa=0, in 6ms<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept
 answer<br>> '.|NS|d.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|l.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|c.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|g.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|h.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|b.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|f.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|m.root-servers.net.'
 from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|k.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|a.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|j.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|i.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|e.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: determining status after<br>> receiving this packet<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'd.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]:
 .: answer is in: resolved to<br>> 'l.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'c.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'g.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'h.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'b.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'f.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'm.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'k.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>>
 'a.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'j.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'i.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'e.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: status=got results, this<br>> level of recursion done<br>> Jun 23 12:30:12 server pdns_recursor[11065]: Refreshed . records<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|f.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|m.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|k.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23
 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|a.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|j.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|i.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: accept answer<br>> '.|NS|e.root-servers.net.' from '.' nameservers? YES!<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: determining status after<br>> receiving this packet<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'd.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'l.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>>
 'c.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'g.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'h.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'b.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'f.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'm.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'k.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'a.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'j.root-servers.net.|NS'<br>> Jun 23
 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'i.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: answer is in: resolved to<br>> 'e.root-servers.net.|NS'<br>> Jun 23 12:30:12 server pdns_recursor[11065]: .: status=got results, this<br>> level of recursion done<br>> Jun 23 12:30:12 server pdns_recursor[11065]: Refreshed . records<br>><br>> - 1st lookup: dig +short www.google.com @localhost<br>> Jun 23 12:34:10 server pdns_recursor[11065]: 0 [3] question for<br>> 'www.google.com.|A' from 127.0.0.1<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3] www.google.com.: Looking<br>> for CNAME cache hit of 'www.google.com.|CNAME'<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3] www.google.com.: No CNAME<br>> cache hit of 'www.google.com.|CNAME' found<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3] www.google.com.: No cache<br>> hit for
 'www.google.com.|A', trying to find an appropriate NS record<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3] www.google.com.: Cache<br>> consultations done, have 1 NS to contact<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3] www.google.com.:<br>> Nameservers: -8.8.8.8:53(0.23ms)<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3] www.google.com.: Trying to<br>> resolve NS '-8.8.8.8:53' (1/1)<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3] www.google.com.: Domain has<br>> hardcoded nameserver(s)<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3] www.google.com.: Resolved<br>> '.' NS -8.8.8.8:53 to: 8.8.8.8<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3] www.google.com.: Trying IP<br>> 8.8.8.8:53, asking 'www.google.com.|A'<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3] www.google.com.: Got 5<br>> answers from -8.8.8.8:53 (8.8.8.8), rcode=0, aa=0, in 3ms<br>> Jun 23 12:34:10
 server pdns_recursor[11065]: [3] www.google.com.: accept<br>> answer 'www.google.com.|A|173.194.112.242' from '.' nameservers? YES!<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3] www.google.com.: accept<br>> answer 'www.google.com.|A|173.194.112.243' from '.' nameservers? YES!<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3] www.google.com.: accept<br>> answer 'www.google.com.|A|173.194.112.240' from '.' nameservers? YES!<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3] www.google.com.: accept<br>> answer 'www.google.com.|A|173.194.112.241' from '.' nameservers? YES!<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3] www.google.com.: accept<br>> answer 'www.google.com.|A|173.194.112.244' from '.' nameservers? YES!<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3] www.google.com.:<br>> determining status after receiving this packet<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3]
 www.google.com.: answer is<br>> in: resolved to '173.194.112.242|A'<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3] www.google.com.: answer is<br>> in: resolved to '173.194.112.243|A'<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3] www.google.com.: answer is<br>> in: resolved to '173.194.112.240|A'<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3] www.google.com.: answer is<br>> in: resolved to '173.194.112.241|A'<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3] www.google.com.: answer is<br>> in: resolved to '173.194.112.244|A'<br>> Jun 23 12:34:10 server pdns_recursor[11065]: [3] www.google.com.: status=got<br>> results, this level of recursion done<br>> Jun 23 12:34:10 server pdns_recursor[11065]: 0 [3] answer to question<br>> 'www.google.com.|A': 5 answers, 0 additional, took 1 packets, 0 throttled, 0<br>> timeouts, 0 tcp connections, rcode=0<br>><br>> - 2nd lookup: dig +short
 www.google.com @localhost<br>> Jun 23 12:34:21 server pdns_recursor[11065]: 0 question answered from packet<br>> cache from 127.0.0.1<br>><br>><br>> _______________________________________________<br>> Pdns-users mailing list<br>> <a ymailto="mailto:Pdns-users@mailman.powerdns.com" href="mailto:Pdns-users@mailman.powerdns.com">Pdns-users@mailman.powerdns.com</a><br>> <a href="http://mailman.powerdns.com/mailman/listinfo/pdns-users" target="_blank">http://mailman.powerdns.com/mailman/listinfo/pdns-users</a><br>><br><br><br><br>-- <br><br>"Genius might be described as a supreme capacity for getting its possessors<br>into trouble of all kinds."<br>-- Samuel Butler<br><br><br></div> </div> </div>  </div></body></html>