Are you a user of Ubuntu or variant of it? When you’re browsing the web, do websites seem to load incredibly slowly? Looking that the status bar of your browser, does it constantly say that its looking up a certain website?
This process is called DNS lookup. Whenever you visit a website, your computer needs to perform a DNS lookup on every domain and domain hosts (subdomains) that the site uses. On most websites, this could be dozens as many websites. techairlines.com, www.techairlines.com, and s.techairlines.com are different hosts, therefore three different DNS lookups.
DNS lookups translate the website URL to an IP address, which would direct your computer to connect to a certain server.
Normally, DNS lookups don’t take more than half a second and the extra load time can’t be noticable.
But if you’re on Ubuntu, you may notice that your browser looks up each domain for a long time, such as 30 seconds each.
What’s the Problem?
By default, Ubuntu has a setting to use IPv6 turned on. Many routers, such as my own, do not support the IPv6 protocol and for most people, its not needed. But since the setting is turned on, Ubuntu will try to use it anyway and attempt to use it when looking up websites.
Unfortunately, if your router doesn’t support it, this process doesn’t work and Ubuntu finally falls back to IPv4, which is when the DNS lookup is successful, or sometimes the site just won’t load.
But when it begins the next lookup, IPv6 is still enabled, so this starts again. The result? A horribly slow connection to websites.
The fix? Disable IPv6 of course!
The Easy Fix (Firefox Only)
If you only run Firefox, then you can just use the easy fix instead of editing system files.
Visit about:config in Firefox.
In the Filter box, type in the following string:
Double click on the result or right click on it and toggle it to True. Restart your browser and enjoy the faster speed!
The System-Wide Fix
If you use another browser or application that does not provide access to all the settings like Firefox does, you would have to change the setting system-wide.
First, check if IPv6 is enabled by running the following command. If the output is 0, it means its enabled. If it’s 1, then its disabled already.
You need to add the following lines to the file at /etc/sysctl.conf:
net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1
Alternatively, you can just open up a terminal, elevate it with sudo, and run the following commands:
echo "#disable ipv6" | sudo tee -a /etc/sysctl.conf echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf echo "net.ipv6.conf.default.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf echo "net.ipv6.conf.lo.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
Restart your computer and then run the first command to check if its disabled. The output should be a 1.
For Firefox, you will still need to toggle the value explained in the above section.
Are you using Ubuntu and suffering from slow DNS lookups? Does this tutorial help solve your problem? Have another method? Share with us in the comments!