2

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?

  • “Curiously, I'm seeing the two protocols being used alternately in my logs from my machine here at the office which is ipv6 capable.” Your question is confusing. Can you clearly state where these logs are coming from? Client or server? – Giacomo1968 Aug 30 '14 at 04:04
  • Can you tell us the OS if the client machine? Its behaviour sounds like an Apple device... – Sander Steffann Aug 30 '14 at 06:44
  • 1
    Related question : [When do browsers request and use IPv6 DNS records?](http://serverfault.com/questions/617406/when-do-browsers-request-and-use-ipv6-dns-records) –  Aug 30 '14 at 07:20
  • @JakeGuold - The logs I'm referring to are the apache server logs. – But those new buttons though.. Aug 30 '14 at 15:32
  • @Sander - You are correct, the client is an Apple. For clarity's sake I'll mention, I have a launched job which curls the host every so often. I've seen this behaviour in both the curl connection and browser connections. – But those new buttons though.. Aug 30 '14 at 15:33

1 Answers1

4

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.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • Does Happy Eyeballs get used by curl as well? I've been seeing this happen with curl as well as browser connections. – But those new buttons though.. Aug 30 '14 at 15:35
  • Apple devices use a more complicated algorithm than Happy Eyeballs. Happy Eyeballs prefers IPv6 except when it breaks or is much slower than IPv4. Apple devices measure the performance of both protocols and can prefer IPv4 if they think it might be faster. That makes them less predictable though... – Sander Steffann Aug 30 '14 at 15:39