Disable IPv6 on Ubuntu Linux and Windows 10

Submitted by Peter Majmesku on Wed, 12/07/2016 - 19:57

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


Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.