How do client applications know to use IPv4 or IPv6?

The first thing that a client determines is which protocols are available. Let's assume that both IPv4 and IPv6 are available (otherwise the answer to which protocol to choose is trivial ;) It will then do a DNS lookup for both the A (IPv4 address) and AAAA (IPv6 address) records. If only one type is returned then it will use that. If both IPv4 and IPv6 addresses are returned the default behaviour depends a bit on the client software. Usually RFC 3484 is used.

According to the official standards it should prefer IPv6, but because there are some (0.01% or less) machines that have misconfigured IPv6 the clients have become smarter. Most browsers these days will try to connect over IPv6, but if they don't get a working connection within 300 milliseconds they will try to connect over IPv4 in parallel. The first connection that succeeds is then used. This is covered in the Happy Eyeballs RFC.

Apple changed this in Lion. There the operating system actually keeps track of the performance of all connections, and if it determines that the IPv4 connection has lower latency than the IPv6 connection it will start preferring IPv4. But if the IPv4 connection becomes slower it might switch back to IPv6. Take a look at this mailing list thread for a discussion of this feature.

For the user it shouldn't matter if IPv4 or IPv6 is used, as long as it works. IPv4 and IPv6 should be provided equally well. Websites should work exactly the same over IPv4 as over IPv6, etc.

IPv4 will remain is use for many years to come. It will become unusable once new services (websites, games, etc) are deployed only over IPv6 because there are no more new IPv4 addresses to be used. And at some point everything that works over IPv4 will also work over IPv6. At that point in time disabling IPv4 will save time and money (why maintain two protocols when one is enough?).


The intermediate step that's being used now is known as tunneling. Essentially IPv6 packets travel inside IPv4 packets until they reach a point at which they can be stripped of the IPv4 encapsulation and sent out the other side on a full IPv6 network. Of course there's a lot more complexity than that, but the basic concept by-in-large is the same across the board.

As more and more devices become IPv6 capable, and people become more familiar with using the addresses, IPv6 will see increased usage. I don't believe (personal opinion) that IPv6 will truly be embraced and see a large-scale roll-out in the SMB and personal market until IPv4 space becomes an expensive commodity.

At some point in the fairly distant future when IPv6 powers an overwhelming majority of traffic, I could see a reversal of fate for IPv4, where IPv4 traffic must be encapsulated inside regular IPv6 packets and tunnel brokers serve a similar (but reversed) role due to the lack of broad IPv4 routing/IP assignments.