5.3.10. Disable IPv6 on VPS

In Linux-based operating systems, you can disable IPv6 either for all interfaces or for a specific one. There are general methods that can be applied to all operating systems.

  1. Go to the /etc/sysctl.d/ directory:
    cd /etc/sysctl.d/
  2. Add the necessary settings to the 99-sysctl.conf file to disable IPv6 using any of the following methods:
    • Or edit the file manually using an editor:
      vi 99-sysctl.conf

      Add the following lines to the end of the file:

      net.ipv6.conf.all.disable_ipv6 = 1
      net.ipv6.conf.default.disable_ipv6 = 1
    • Or run the command to insert the desired lines at the end of the file:
      printf "\n net.ipv6.conf.all.disable_ipv6 = 1 \n net.ipv6.conf.default.disable_ipv6 = 1" >> 99-sysctl.conf
  3. Apply the changes:
    sysctl -p 
  4. Check that IPv6 is not configured on the server:
    ifconfig
  1. Determine which interface you need to disable IPv6 on. You can list all interfaces using the following command:
    ifconfig

    The output of the command will look something like this:For example, the desired interface will be named eth0.

  2. Go to the /etc/sysctl.d/ directory:
    cd /etc/sysctl.d/
  3. Add the necessary settings to the 99-sysctl.conf file to disable IPv6 using any of the following methods:
    • Or edit the file manually using any text editor:
      vi 99-sysctl.conf

      Add the following line to the end of the file:

      net.ipv6.conf.eth0.disable_ipv6 = 1

      Replace eth0 with the appropriate interface.

    • Or run the following command to append the necessary lines to the end of the file:
      printf "\n net.ipv6.conf.eth0.disable_ipv6 = 1" >> 99-sysctl.conf

      Replace eth0 with the appropriate interface.

  4. Apply the changes:
    sysctl -p 
  5. Check that IPv6 is not configured on the server:
    ifconfig
Content