Tell me more x
, there is a new speed test available. Give it a try, leave feedback!
dslreports logo
    All Forums Hot Topics Gallery


Search Topic:
share rss forum feed


Force OS X Mountain Lion to use IPv6 when available?

Background: I've been a Linux user forever. Be default, both Windows and Linux use IPv6 for connecting to a host's address when it is available (in a dual-stack environment, at least). It appears that OS X Mountain Lion does some sort of latency checking and will regularly flip back and forth between IPv4 and IPv6 for address resolution of the same host.

In theory this should be a fine approach, but I've seen some weirdness with the combination of Chrome, SPDY, and opening a lot of connections at the same time. Does anyone know of a hidden flag to force it to use IPv6 when available for a host?

Some quick Google searching yields limited coverage and no success:
» ··· ain-lion
If you can't open it, you don't own it.

Sunnyvale, CA

1 recommendation

The order in which IPv4 or IPv6 are selected is not fully under the control of the operating system itself. This decision is primarily under the control of the application establishing the connection.

Operating systems may influence this decision by ordering the results in the dns resolver library before passing them on to the application. Such reordering is however ineffective if the application uses its own resolver or does its own sorting of the search results or if it specifies a particular address family (AF_INET, AF_INET6) instead of AF_UNSPEC when making calls to the OS provided dns resolver.

As a result, even if there were an option to tune the behavior of the resolver library (there doesn't appear to be one) on OS X Mountain Lion not all of the applications may be effected by that configuration change. In some cases the application itself may have a configuration option for IPv4/IPv6 preference or it may not be configurable at all.

Another thing to watch out for is that the earlier recommendations to prefer IPv6 over IPv4 have been changed to a much more complex set of priorities (RFC3484) that includes not only native IPv4 and native IPv6 but also a number of transitional protocols such as 6to4 and teredo. The recommended priorities are such that native connections are preferred over transitional protocols. This means that a connection between a dual-stack (native IPv4 and native IPv6) host and a 6to4 (native IPv4 but tunneled IPv6) host would use IPv4 instead of IPv6. From the few comments I find about mac and IPv4/IPv6 dns resolution it appears that RFC3484 is not implemented at all or if it is then it is not configurable (as it is in Linux with /etc/gai.conf or BSD with ip6addrctl).

If all of the above wasn't complicated enough, there is one more thing that effects whether IPv4 or IPv6 is used to establish the connection between client and server: RFC6555 (Happy Eyeballs). The way this standard works is by applications explicitly asking for both an IPv6 and an IPv4 address and then attempting both connections in parallel (the standard suggests to give IPv6 a headstart in the race) using whichever connection succeeds first. Mac OS X implements this since Lion (10.7) in at least some applications. If an application implements RFC6555 then any dns resolver based prioritization of IPv4 vs. IPv6 will have no effect.
Got some spare cpu cycles ? Join Team Helix or Team Starfire!