Disable IPv6 on Ubuntu and Windows 10

I had this issue with “sudo apt update” or at trying to install something with composer in the WSL. The issue has been connected with IPv6. So I have disabled IPv6 and the requests where working much faster.

In Ubuntu (not Windows 10) disable IPv6 that way: Add the following lines at the bottom of /etc/sysctl.conf:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

Run sudo sysctl -p to reload the /etc/sysctl.conf settings.

To disable IPv6 only for apt-get:

sudoedit /etc/apt/apt.conf.d/99force-ipv4

Put the following contents in it:

Acquire::ForceIPv4 “true”;

Save the file, and you’re good to go. If you want to force IPv6 instead, change the 4 to 6 in the file name and settings. To choose between one of them, test with the fast method and see which works better.

In Windows 10 I could fix my issue for the Bash by the execution of a small program from Microsoft: https://support.microsoft.com/en-us/kb/929852

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s