Shammer's Philosophy

My private adversaria

Disable IPv6 access when executing apt-get

Here is a reference.
http://unix.stackexchange.com/questions/9940/convince-apt-get-not-to-use-ipv6-method
I think these 2 methods are reasonable.

  • Using -o Acquire::ForceIPv4=true like apt-get -o Acquire::ForceIPv4=true update
  • Generate /etc/apt/apt.conf.d/99force-ipv4 by echo Acquire::ForceIPv4=true\; > /etc/apt/apt.conf.d/99force-ipv4

But, these methods are not available in my environment. So, I select to edit /etc/gai.conf. In detail, remove comment of the line precedence ::ffff:0:0/96 100 disables IPv6 when executing apt-get. There is no need to reboot or re-login, this change is available after saving this file.

I worry that this change makes all IPv6 access disabled if I would like to use IPv6.