Apple Favours IPv6, Gives IPv4 a 25ms Penalty

Profile image of Mattias Geniar

Mattias Geniar, July 13, 2015

Follow me on Twitter as @mattiasgeniar

This is pretty exciting news for the adoption of IPv6.

Last month, Apple announced that all iOS9 apps need to be “IPv6 compatible”.

Because IPv6 support is so critical to ensuring your applications work across the world for every customer, we are making it an AppStore submission requirement, starting with iOS 9.

In this case, compatible just means the applications should implement the NSURLSession class (or a comparable alternative), which will translate DNS names to either AAAA (IPv6) or A (IPv4) records, depending on which one is available.

It doesn’t mean the actual hostnames need to be IPv6. You can still have a IPv4-only application, as long as all your DNS-related system calls are done in a manner that would allow IPv6, if available.

But to further encourage IPv6 adoption, Apple has just motivated all its app developers to use IPv6 where applicable: IPv4 networks will get a 25ms penalty compared to IPv6 connections.

Apple implemented “Happy Eyeballs”, an algorithm published by the IETF which can make dual-stack applications (those that understand both IPv4 and IPv6) more responsive to users, avoiding the usual problems faced by users with imperfect IPv6 connections or setups.

Since its introduction into the Mac OSX line 4 years ago, Apple has pushed a substantial change to the implementation for the next Mac OSX release “El Capitan”.

  1. Query the DNS resolver for A and AAAA.

If the DNS records are not in the cache, the requests are sent back to back on the wire, AAAA first.

  1. If the first reply we get is AAAA, we send out the v6 SYN immediately

  2. If the first reply we get is A and we’re expecting a AAAA, we start a 25ms timer

– If the timer fires, we send out the v4 SYN

– If we get the AAAA during that 25ms window, we move on to address selection

[v6ops] Apple and IPv6 – Happy Eyeballs

In other words: DNS calls are done in parallel, both for an AAAA record as well as an A record. Before the answer of the A-record is accepted, at least 25ms should have passed waiting for a potential response to the AAAA query.

RFC6555, which describes the Happy Eyeballs algorithm, notes that Firefox and Chrome use a 300ms penalty timer.

  1. Call getaddinfo(), which returns a list of IP addresses sorted by the host’s address preference policy.

  2. Initiate a connection attempt with the first address in that list (e.g., IPv6).

  3. If that connection does not complete within a short period of time (Firefox and Chrome use 300 ms), initiate a connection attempt with the first address belonging to the other address family (e.g., IPv4).

  4. The first connection that is established is used. The other connection is discarded.


Apple’s implementation isn’t as strict as Chrome’s of Firefox’s, but it is making a very conscious move to push for IPv6 adoption. I reckon it’s good news for Belgian app developers, as we’re leading the IPv6 adoption charts.

If you’re interested, here are some IPv6 related blogposts I published a few years ago;

Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.