Disable IPv6 on Ubuntu to Speed Up Browsing

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:

network.dns.disableIPv6

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.

Related posts:

By Brian Yang Brian is the co-founder of TechAirlines. He is a developer currently focusing on mobile and web development. He is currently a sophomore at Stony Brook University, majoring in Computer Science.

http://techied.net TechGyani

Thanks for the nice tutorial. :)

To edit sysctl.conf run this command in terminal sudo gedit /etc/sysctl.conf to

http://tripideas.org/ Slava

I don’t think it’s a good idea in a world scale. We’re running out of IPv4 addresses and migration to IPv6 is pretty unavoidable by now. Disabling it would mean you’d have to re-enable it quite soon (hopefully remembering where did you turn it off :) ). In short: leaving IPv6 on is good karma :)

http://www.techairlines.com Brian Yang

Hi Slava,

That is indeed true.

My article was intended for individuals using Ubuntu who own older routers that simply don’t support IPv6 currently, such as my own. If a router supports IPv6 connections, then leaving it on would work just fine.

Thanks for visiting, Brian

http://NicholasScalice.com Nicholas Scalice

Thank you for this very informative info! Just another reminder of why I like Chrome.

http://bredsaal.dk/ Jannich

Another solution would be to install and use an IPv6 tunnel service, like the miredo package. :-)

Don Christensen

On a Maverick system, I modified my /etc/sysctl.conf as above and noticed this in the /etc/sysctl.d/README file:

‘After making any changes, please run “start procps”.’

I did that and it seems to have applied the changes. No more AAAA DNS requests, without rebooting. IPv6 shows as disabled. Nice.

Mark S

It doesn’t work on Ubuntu 10. I have ipv6 disabled in /etc/sysctl.conf and now I don’t even have ipv6 anywhere in /proc. Everything except Firefox is still trying to do DNS lookups of AAAA records and waiting for multiple timeouts before connecting.

I’m still waiting for ipv6 to solve a problem – so far, it only breaks things for me… :(

http://mcgi.org Arnold Martin

Sir, I would like to ask if you know any multi-threaded, IDM-like downloader for Ubuntu? TIA Best Regards Arnold

Jean Debogue

I agree that my first experience with firefox and ipv6 was that it’s true it seems some sites are slower. It felt like the SSL enable sites were in general slower.