How To Disable IPv6 DNS Querries in Ubuntu

Lately I had some issues with the Internet connectivity being a bit slow and while working the issue I discovered an unrelated but also interesting thing: When using Firefox and other applications on Ubuntu (10.04 in my case) the DNS resolver always queries for an IPv6 address for a domain name first (AAAA record). Only once a (negative) answer gets back to the system does the resolver ask for the IPv4 address (A record). This is strange for two reasons: First, I don't have any network interface on which IPv6 is enabled so even if the resolver returns an IPv6 address, the application couldn't do anything with it. And second, the vast majority of the servers I contact don't have an IPv6 address yet. So why slow me down that much by asking for an IPv6 address in the first place? Why not only ask for it if no IPv4 address is found? A bit of a mystery to me. But here's a simple fix for it in Firefox: Type in about:config in the address bar, search for network.dns.disableIPv6 and set it to true. That at least fixes things for Firefox and saves you a needless DNS query for each domain. Same kludge works for Thunderbird as well.