Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question

5 Answers 5

up vote 4 down vote accepted

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.

share|improve this answer

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).

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

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!

share|improve this answer
This will just unlabel 6to4, wouldn't it? –  freddyb May 30 '11 at 17:00

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.

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.