I've implemented IPv6 on my home network and noticed that several of my Ubuntu machines have trouble updating via apt-get
when it tries to reach out to the update servers via their IPv6 address, especially the security.ubuntu.org
repository. As a result, these servers have to wait for a lengthy timeout whenever I'm downloading updates of any sort. This has been going on for years at this point and doesn't appear to be a high priority issue, so I started looking for a way
to force apt-get
to use only IPv4.
To enable on a one time basis, add -o Acquire::ForceIPv4=true
when running apt-get.
If you want to make the setting persistent, which is what I wanted, create /etc/apt/apt.conf.d/99force-ipv4
and put Acquire::ForceIPv4 “true”;
in it.