My problem is that when I do an apt-get update is trying to resolve ipv6 ips, and its failing to update/install/etc.

How to disable ipv6 at apt-get?

The ping to www.google.com.ar, resolves to an ipv4.

And this is debian runnung in an OpenVZ container.

This is in a production server and online ONE openvz cluster has this problem! Thats why I want to find other solution than disable ipv6.


2 Answers 2


I assume that you've got ipv6 enabled but a broken ipv6 setup, so, probably what you want to do is blacklist the ipv6 module, and restart.

  • When searching google (before asking here) I came to that solution. The problem is that the server is production cluster running OpenVZ containers, to blacklist ipv6 I need reboot I think. And only one container has the problem!. Anyway I will be trying the blacklist if I cant found the solution
    – llazzaro
    Mar 15, 2010 at 22:38

Unix.SE has two good answers for this:

If you only want to disable IPv4 for APT, and you run Debian wheezy or *buntu saucy, or newer, that is, APT or newer, you can use the Acquire::ForceIPv4 option, either on the command line (-o Acquire::ForceIPv4=true) or in apt.conf (Acquire::ForceIPv4 "true";).

If you want to prefer IPv4 over IPv6 systemwide you can uncomment (or append) the line precedence ::ffff:0:0/96 100 in /etc/gai.conf. I think that this is what applies to your usecase.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.