I installed miredo and have IPv6 up and running it seems. I can ping6 hosts and download webpages with wget or my webbrowser when I specify IPv6 addresses, however whenever I specify a hostname that is offered over both IPv4 and IPv6 the browser picks the IPv4 address for the connection.

How can I change that and let the browser use IPv6 instead of IPv4 if available?

Googling around I found a hint that browsers will prefer IPv4 over IPv6 for 6to4/teredo tunnels, but so far I haven't found an explanation why or how to change that.

6 Answers 6


It is not the browsers preferring any of the options, it's the operating system. The standard defines the priorities roughly like this:

  1. ipv6
  2. ipv4
  3. 6to4-Traffic

You can change this by editing the label/precedence blocks in /etc/gai.conf (gai stands for getaddrinfo, the standard system call for resolving host names).

A detailed explanation on gai.conf can be found in the man page

This, by the way, also explains Jonathon's experience that the SiXXS tunnel was preferred over 6to4.


For Firefox & other Mozilla/Gecko-based browsers, the network.dns.disableIPv6 setting in about:config should be false if you have IPv6 (it's set to true by default in Ubuntu, because otherwise lots of people get issues with buggy DNS proxies in home routers).

  • I take it this is for Firefox?
    – Roger Pate
    Commented Oct 24, 2010 at 22:30
  • Yes, sorry, will update my answer.
    – JanC
    Commented Oct 24, 2010 at 23:42
  • 3
    Just checked. There's no need to touch the pref. It nowadays defaults to true in Firefox - also for Ubuntu's Firefox.
    – freddyb
    Commented Dec 11, 2013 at 16:57

As of recent, Chrome, Firefox as well as derived browsers actually avoid IPv6 if a site responds faster over IPv4. It is not possible to change this behavior by means of a configuration setting.

The feature itself is probably reasonable for the common user but it almost drives me mad that you cannot disable it. IPv6 connectivity is pretty good nowadays and sometimes IPv6 has several advantages over connecting through IPv4 even if latency - due to tunneling - is higher. I've been browsing over IPv6 for years and despite IPv6 routing and performance has been getting much better, this damn browser "hack" feature throws me back a decade.

  • 3
    That behavior is recommended in RFC 6555. It has been a common practice since around 2010. And to provide a decent user experience, It is absolutely the right behavior to use by default. If browsers hadn't done this, then most websites would have refused to publish AAAA records at all. That said, a setting to tweak have many milliseconds of head-start to give IPv6 would be a good idea. Being able to choose that head-start per site would be even better. The per site setting could be added to the browser as a possible return value from a proxy script.
    – kasperd
    Commented Aug 12, 2015 at 7:09

Just as freddyb pointed out, this depends on the configuration of the standard system call to resolve host names, getaddrinfo.

To solve your problem, replace the content of your /etc/gai.conf with the following lines:

label ::1/128       0
label ::/0          1
label 2002::/16    2
label ::/96         3
label ::ffff:0:0/96 4
label fec0::/10     5
label fc00::/7      6
#label 2001:0::/32   7

updated: thx to freddyb for pointing out that my previous response was wrong: We need to comment the last line, not the 3rd. Now it works for me!


The answer is simple: Alter the labels.

label 2002::/16    1
label 2001:0::/32   1

This makes them equivalent to "vanilla" ipv6.

If you leave them commented out they'll pick up default values.


OK, I've been looking into this and it's weird.

  1. Use a local proxy
    If I set Firefox to proxy through Squid running on my machine, Firefox (or more precisely, Squid) will connect through the miredo tunnel. If I have miredo installed but Firefox set to "no proxy" Firefox uses IPV4 first.

  2. Install aiccu
    If I install aiccu and set it up with a tunnel (e.g. SiXXS) then no matter my proxy settings IPV6 is used first by Firefox.

It may be that as miredo is there to connect to IPV6 sites it is only used when IPV4 is not available, in which case try aiccu.

  • the second - installing aiccu is nonnsence after of decreating SiXXS, you even can't get package from Debian reposiroty Commented Jul 1, 2022 at 1:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .