Menu

Disable IPv6 in Ubuntu

Few days ago I was trying to do my first steps with Docker. I used Parallels & Ubuntu 16.04 on my computer. First of all – I wanted to start running my “Hello World” project under Apache server. I used Composer to manage project dependencies. I created a file named “composer.json”, added some dependencies and then I wanted to install them. It was not so easy, because I focused with mysterious error.

The “https://packagist.org/packages.json” file could not be downloaded: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution

Why is it mysterious? Because using curl command – everything was ok. Then I spent couple of hours to solve this issue.

Solution

Open the fileĀ /etc/sysctl.conf using command:

nano /etc/sysctl.conf

 

Insert the following lines at the end:

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

 

Press Ctrl+X and save the file. After that execute command:

cat /proc/sys/net/ipv6/conf/all/disable_ipv6

 

If you see 1 – then IPv6 was successfully disabled.

Leave a Reply

Your email address will not be published. Required fields are marked *