Bizzard's Hackshop
Always under construction!
22th
Feb
2018

Force apt / apt-get to use IPv4

At times, in systems configured to use both IPv4 and IPv6 addresses the debian package manager (apt / apt-get / aptitude) uses IPv6 by default for outgoing connections and fails to resolve/connect. The solution is to force it to use IPv4

Add -o Acquire::ForceIPv4=true when running apt-get or apt.

If you want to make the setting persistent just create /etc/apt/apt.conf.d/99force-ipv4 and put Acquire::ForceIPv4 "true"; in it:

echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4

Tagged with: , , , ,

Leave a Reply