With IPv4 addresses being recycled / reassigned all the time, having
software prefer IPv4 may cause problems in some cases.
After all, with an old IPv4 address comes the reputation of the previous user.
Which may include outdated GEO-IP data and blacklisting due to abuse
committed by the previous user. This can make certain content inaccessible
via IPv4.
IPv6 is rarely recycled and therefore doesn't have these problems.
Unfortunately, starting with Squid 5, Squid prefers IPv4!
Apparently, this is because squid now asks for the IPv4 address first,
when asking for the IPv6 address first is preferred!
Below a way to make Squid behave more appropriately.
The idea is to set up a nameserver
which refuses to answer 'A' queries.
And then let Squid try this nameserver before a 'regular' nameserver.
In /etc/squid/squid.conf;
dns_nameservers Ip_Address_of_IPv6_Only_NameServer Ip_Address_of_Regular_NameServer
Fore instance:
dns_nameservers 2001:db8:1234::1 2001:db8:5678::1
Where '2001:db8:1234::1' refuses to answer IPv4 address queries.
And '2001:db8:5678::1' answers all queries.
This way Squid is forced to try IPv6 first.
An IPv6 only Bind setup here.
You can combine this with a regular Bind setup by means of views.
If you know of a more convenient way of achieving this, please let me know.