2

I'm currently running Debian 8 and I'm trying to force applications like Google Chrome to use IPv4 over IPv6 only for certain sites. My ISP natively offers IPv6 and it's amazing on all websites that support it except for Facebook. If I browse Facebook when I'm using an IPv6 connection the site is really slow and if I completely disable IPv6 everything start working again. So my aim is to automatically force an IPv4 connection only for Facebook and to keep it default for every other IP/domain. I tried to look online and the only method that I've found is to edit gai.conf but I'm unable to make it work. It seems that the file is being ignored. This is what I've added:


label 0:0:0:0:0:FFFF:ADFC:7806/128 5 precedence 0:0:0:0:0:FFFF:ADFC:7806/128 100


I converted the original IPv4 (173.252.120.6) to an IPv6 address and used that in the configuration file. Except for the two lines that I've added the rest of the file was commented. Can someone help me?

  • 1
    I think that you're on the right path by shifting the question to forcing IPv4 for certain IP addresses instead of for certain domains, and editing gai.conf is indeed the right way to do that. But you will certainly want to be configuring Facebook's IPv6 addresses into that file. I'm at a loss trying to figure out why you are using IPv6-mapped-IPv4 addresses in there (addresses of the form ::ffff:xxxx:yyyy) as I'm not sure what such addresses even mean in this context. – Celada Jun 3 '15 at 14:39
  • @Celada Doing it based on IP address does mean that the choice between the addresses can only be done after DNS resolution. That might cost an extra roundtrip - unless the A and AAAA records are looked up in parallel. – kasperd Jun 3 '15 at 15:43
  • @kasperd I've also just realised that this method is not efficient because Facebook has numerous hostnames and IP addresses, as part of their CDN network, and I just can't insert all of them. So I don't think that the gai.conf way is the right one. – LookedPath Jun 3 '15 at 15:56
  • 1
    @LookedPath It is indeed tricky to produce a full list of all the domains and IP addresses which they use. But what you really want is not necessarily a full list, but just a list of those which are slow when accessed over IPv6. It sounds very plausible that access to the host being slow over IPv6 is more likely to be correlated with the IP address than with the hostname. That's one good argument for going for the IP addresses, and for a start you could just add IP address one range at a time as you notice slow connections. – kasperd Jun 3 '15 at 16:04
  • 1
    @LookedPath Chrome is supposed to automatically detect whether IPv4 or IPv6 is faster and use that. There is a few caveats though. For a start only the time to complete a handshake will be considered, and sometimes the one completing a handshake fastest isn't the fastest for the rest of the connection. If a browser tries to remember which protocol gave fastest responses on previous connections, it is tricky to figure out what exactly is the useful scope of those measurements. – kasperd Jun 3 '15 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.