I have a standalone, isolated network running mixed Windows and Linux systems, with a Windows 2008 R2 server performing AD duties and DNS.
I'm seeing 5-second delays with the use of
getaddrinfo on the Linux
In Wireshark I see (C->S means client to DNS server):
t=0.000 C->S Query A foo.example.com ID=0x1111 t=0.000 C->S Query AAAA foo.example.com ID=0x2222 t=0.004 S->C Response to 0x2222, No error (Query is echoed) Authoritative nameservers: example.com: type SOA, class IN, mname svr01.example.com Name: example.com Type: SOA Class: IN TTL: 1 hour Primary name server: svr01.example.com Refresh interval: 15 minutes Retry interval: 10 minutes Expiration limit: 1 day Minimum TTL: 1 hour [5 second delay] t=5.004 C->S Query A foo.example.com ID=0x1111 t=5.005 S->C Query response A 192.168.1.17'
If I make the same request again, shortly thereafter, I will see no delay, as expected:
t=0.000 C->S Query A foo.example.com ID=0x3333 t=0.000 C->S Query AAAA foo.example.com ID=0x4444 t=0.001 S->C Query response A 192.168.1.17'
I can continue to get immediate responses for some period of time. After a while (still experimenting) the delay will return.
What is going on here? If I use
gethostbyname() (which only does IPv4) or
nslookup foo.example.com, there is no delay.
- IPv6 is disabled on the server NICs
This answer on Ask Ubuntu suggested adding
/etc/resolv.conf. This seemed to correct the problem for me.
However, I'm still curious:
- What the SOA record actually means
- Why the server doesn't respond the first time to the A query