Ipv6 connection problems with apt-get

I’m having difficulties to connect Debian archive through IPV6.

When I try to apt-get update, I’m getting errors like this:

Cannot initiate the connection to security.debian.org:80 (2610:148:1f10:3::73)
 - connect (101: Network is unreachable) [IP: 2610:148:1f10:3::73 80]

How can I force apt to connect only the IPV4 addresses of the security.debian.org?

You can force apt to use only IPV4 networks with -o Acquire::ForceIPv4=true parameter.

Because of it is a long parameter which is hard to remember, it is better to set through a config file. To do this, create a config file named with /etc/apt/apt.conf.d/99force-ipv4 with following line included:

Acquire::ForceIPv4 "true";

Now, apt will only use IPV4 links.