Recently a friend told me that his Internet access while in Ubuntu using a Fon router was fairly slow, but in Windows it was fine. I noticed the same thing using my own laptop on his network, which confused me. Then I realised that I'd been thinking the DNS lookups on my machine were a bit sluggish sometimes too, though I'd blamed the BIND setup on my Bytemark VM server being swapped out. So just now I decided to investigate, with the help of tcpdump. It turns out that when requesting one of my domain names, and presumably a few others, it would first ask for an IPv6 address record (an AAAA record, as opposed to an A) for the domain from the local DNS server in my router. As these domains don't have AAAA records, This would take a good few seconds to fail. It would then ask for a reverse lookup on my laptop's IP, which would also fail, then inexplicably ask for an A record for www.domain.my.lan, where www.domain is what I had typed into Firefox and my.lan is the search domain set up on the laptop that is supplied by the wireless router. Only then when that failed would it go off and ask for an A record for the domain which would then work.
The brute-force solution seems to be to disable IPv6 entirely on the machine. On Ubuntu and presumably Debian systems, this is done by editing the file /etc/modprobe.d/aliases, and finding the line that says
alias net-pf-10 ipv6
Changing this line to read
alias net-pf-10 off
and then rebooting results in the IPv6 kernel module being blacklisted and prevented from loading. So far, the problem seems to have disappeared.
0 responses to “Faster DNS lookups in Ubuntu”
Leave a Reply