A webserver I manage is running Ubuntu 14.04 and is configured for dual stack - ipv6 & ipv4. It is my understanding that ipv6 connections have first priority after which it should fall back to ipv4.
Curiously, when inspecting the Apache server logs, I'm can see the two protocols being used alternately for connections from my office desktop which is ipv6 capable. One minute it uses ipv6, the next ipv4 with seemingly no rhyme or reason to why it chooses one or the other.
There are no apparent problems here - I'm just wondering what factors cause one protocol or the other to be used at different times when nothing has changed that I am aware of?
Modern web browsers do not follow the usual rules for IPv6 preference, because doing so would cause very lengthy delays if the client has broken IPv6 connectivity. Instead they use an algorithm called Happy Eyeballs, (RFC 6555) which tries both IPv6 and IPv4 almost simultaneously, with a brief delay between them, and then uses whichever connection it receives the response from first, dropping the other one. This algorithm was meant to work around situations in which the client has broken IPv6 connectivity.
When Happy Eyeballs is in use, it is quite normal to see both IPv6 and IPv4 connections from the same host to your server.