Prefer IPv4 over IPv6

Linux configuration: prefer IPv4 over IPv6


Some applications are not working correctly when IPv6 is the default mode. For instance that's the case of apt-get :(

Change settings for apt-get only

Create a new config file for APT:


Add the follwing option:

Acquire::ForceIPv4 true;

That's all. You can now use apt-get with IPv4 only.

Change default priority

Network priority is set globally in the /etc/gai.conf file.

Edit configuration file

vim /etc/gai.conf

Uncomment the following line (~54) and comment everything else:

precedence ::ffff:0:0/96  100

That's all ! :) Now you rather use IPv4 than IPv6.