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.
It is not the browsers preferring any of the options, it's the operating system. The standard defines the priorities roughly like this:
You can change this by editing the label/precedence blocks in
/etc/gai.conf
(gai stands forgetaddrinfo
, the standard system call for resolving host names).A detailed explanation on
gai.conf
can be found in the man pageThis, 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 inabout:config
should befalse
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).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.
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: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!
OK, I've been looking into this and it's weird.
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.
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 answer is simple: Alter the labels.
This makes them equivalent to "vanilla" ipv6.
If you leave them commented out they'll pick up default values.