Skip to main content

How to Enable or Disable IPv6 on a Linux Virtual Machine

IPv6 is the latest version of the Internet Protocol, designed to address the limitations of IPv4. In some scenarios, such as managing Docker Hub rate limits, disabling IPv6 may be necessary to ensure smooth operation. This guide provides step-by-step instructions for enabling or disabling IPv6 on a Linux VM.
If you are encountering issues with the Docker Hub rate limit, it is recommended to disable IPv6 on your VM by following the steps outlined in the "Disabling IPv6" section below.

First, open the terminal by selecting the "Open Terminal" option located at the top-right corner of the service details overview. Then, proceed with the steps for either enabling or disabling IPv6, depending on your requirement.
Enabling IPv6
If IPv6 is currently disabled on your VM and you want to enable it, follow these steps:

1. Temporarily Enable IPv6: To enable IPv6 without rebooting:

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=0

This change will revert after a system reboot.

2. Permanently Enable IPv6To enable IPv6 persistently:

  • Edit the `sysctl.conf` file:
   sudo nano /etc/sysctl.conf
  • Locate and comment out the following lines (if present):
   # net.ipv6.conf.all.disable_ipv6 = 1
   # net.ipv6.conf.default.disable_ipv6 = 1
  • Apply the changes:
 sudo sysctl -p

IPv6 will now remain enabled even after a reboot.


Disabling IPv6

If IPv6 is causing issues, such as with Docker Hub rate limits, follow these steps to disable it.

1. Temporarily Disable IPv6:  To disable IPv6 without rebooting:

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1

This change is not permanent and will be reset after a reboot.

2. Permanently Disable IPv6:  To disable IPv6 persistently:

  • Edit the `sysctl.conf` file:
   sudo nano /etc/sysctl.conf
  • Add the following lines to the file:
   net.ipv6.conf.all.disable_ipv6 = 1
   net.ipv6.conf.default.disable_ipv6 = 1
  • Apply the changes:
   sudo sysctl -p

IPv6 will now remain disabled even after a reboot.