Inside Out

Notes on seeking wisdom and crafting software

Slow dns resolution and IPv6

In some lan setups (e.g. you’re using a pihole), DNS resolution can be extremely slow due to AAAA records. Under the hood, glibc sends 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.

Details about glibc behavior is here:

Identify the problem

Use dig to request for AAAA record. You will get a connection timeout or no data.

dig AAAA

If you’re using pi-hole, here’s how the problem shows up in query log.

Figure: ipv6 resolver problem


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 AAAA requests.

Figure: ipv6 resolver configuration

We can verify working state with dig command above or from pi-hole query log.

Figure: ipv6 resolver working