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

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 beautiful : (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 !

This entry was posted in Sysadmin. Bookmark the permalink.

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

  1. anon says:

    thank you sir, save my ass

  2. Alexandre says:

    save my ass too :)

  3. gurzaf says:

    Save my ass too :) …. y el de mi amigo también

  4. tony says:

    I love you! Adding that line to the squid.conf did the trick!

  5. grimneko says:

    Didn’t worked out for me. Using a Squid 3.2.6 on Archlinux. What solved the problem for me was using dns_v4_first with the value “on”. This forces Squid to try first the IPv4 DNS entrys returned by the DNS server instead as usually where he tries the IPv6 and so ask for trouble on a non IPv4 network.

    More information on the option can be found in the offical documentation: http://www.squid-cache.org/Doc/config/dns_v4_first/


  6. saved says:

    You did save one here too.

  7. Norbert Poellmann says:

    Saved our ass, too, thank you.
    squid-3.1.19 on FreeBSD 9.0-STABLE

  8. gianpaolo racca says:

    Thanks a lot indeed!

  9. Nice trick, thank you!

  10. alp erkin says:

    thank you, thank you, thank you :)

  11. Tamas Pisch says:


  12. Anonymous says:

    Saved me. Thanks!

  13. Anonymous says:

    This works fine too:

  14. ducseb says:

    Good share, fixed my problem :)

  15. Frenchy from France says:

    Thx !!

  16. michel says:

    tks, save my ass!

  17. guna says:

    thanks, saved my ass too!

  18. Mantap! says:

    Save our Ass!! Thank you.
    I thought Google banned my IP.

    I don’t know why now Squid prefer to use IPV6 over IPV4 to connect to Google, before it always works with initial configuration.

  19. Chris says:

    saved an ass here too!

  20. istas says:

    thanks ….

  21. jose says:

    I am using Squid 3.3.8 and it doesn’t work for me
    it continues trying to contact with the address ipv6

  22. randolf says:

    Putting both
    did it for me!

Leave a Reply to michel Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>