squid: (101) Network is unreachable when DNS returns IPv6

Posté le mar. 04 avril 2017 dans blog

If you have a Squid proxy configured on a machine that have no IPv6 connectivity, and try to reach an IPv6 compatible site, you squid will try to reach the site using IPv6 (I use squid 3.1.6 from Debian Squeeze) and will fail without even trying IPv4, displaying a nice:

(101) Network is unreachable.

The only trick I found to force squid to use IPv4 (After disabling IPv6 on the interface, after disabling IPv6 in the kernel that leads to nothing better...) is:

tcp_outgoing_address [YOUR PUBLIC IP HERE]

And can enjoy again your plain old IPv4 network!