Slow dns resolution and IPv6
August 07, 2019
In some lan setups (e.g. you’re using a pihole), DNS resolution can be
extremely slow due to AAAA records. Under the hood,
A (ipv4) and
AAAA (ipv6) resolution requests by default. In a faulty setup, the DNS server
doesn’t respond to
AAAA leading to timeouts and visible latencies in browsing.
glibc behavior is here:
Identify the problem
dig to request for
AAAA record. You will get a connection timeout or no
dig AAAA cdn.sstatic.net
If you’re using pi-hole, here’s how the problem shows up in query log.
If you don’t control the DNS server, force the local resolver to send a single request at a time and an early timeout.
# add to resolv.conf options timeout:1 options single-request
Some more ways to disable
AAAA lookups are outlined in
Alternatively you could disable the
ipv6 stack with a kernel parameter. See
Ensure your pi-hole setup is configured to resolve
We can verify working state with
dig command above or from pi-hole query log.