IPv6 is enabled by default on most modern Linux distributions, allowing systems to communicate over networks using the latest version of the Internet Protocol and routing. However, not every network or application requires IPv6, and in some cases, an incorrect IPv6 configuration can cause connectivity problems or unnecessary network configurations.
If your Linux VPS only uses IPv4 or you are troubleshooting IPv6-related issues, disabling IPv6 might be a suitable option. On Linux, there are several ways to do this, including using sysctl to temporarily or permanently change network settings and modifying GRUB boot parameters to disable IPv6 at the kernel level. However, the available method depends on your level of control on your VPS, and changes require root access.
In this guide, we’ll explain why you might need to disable IPv6, walk you through different methods of disabling it on Linux, and show you how to verify the changes and enable IPv6 again if needed.
Note:
All methods and solutions in this guide have been tested and verified by the VPSMakers technical team on real VPS environments running various Linux distributions. You can follow these steps on Ubuntu, Debian, and RHEL-based distributions.
Before You Disable IPv6 Address on Linux VPS
Before disabling IPv6 on your VPS, there are a few things you should consider. First, make sure your applications and services do not depend on IPv6 to communicate with other systems. You should also check your firewall rules and SSH configurations, and make sure you have an alternative method to connect to your server because if you are using IPv6, changing its settings can result in getting locked out of the server.
If you are using a public IPv6 on your Linux VPS and serving services with this, disabling it can make those services inaccessible through IPv6, and you may need to reconfigure them.
Also, take a backup of your Linux VPS so that if anything goes wrong, you can have a checkpoint to return to. To take a backup, you can follow this guide:

Learn a complete, step-by-step guide on how to back up your Linux VPS in this article. Protect your data and ensure continuous access to important information using reliable methods and useful tools.
Read the full articleChecking IPv6 Status on Linux
Before disabling IPv6, it is a good idea to check whether it is currently enabled on your Linux system or not. You can do this using the ip command to check the IPv6 addresses assigned to your network interfaces or use sysctl to inspect the kernel’s IPv6 settings.
Run the following command to list the IP addresses assigned to your network interfaces on Linux:
ip -6 addrYou may see multiple network interfaces and IPv6 addresses in the output. These can include the loopback address, link-local addresses, and global IPv6 addresses assigned to your network interfaces, if available.
If IPv6 is enabled, you may see addresses starting with fe80:: (link-local) or 2xxx: (global IPv6 addresses).
You can also check IPv6 status using sysctl:
sysctl net.ipv6.conf.all.disable_ipv6net.ipv6.conf.all.disable_ipv6 = 0If the output you’ve got shows 0 it means IPv6 is enabled on all networks, and if it shows 1 it means it is disabled through kernel settings.
How to Disable IPv6 on Linux VPS?
As mentioned before, there are several ways to disable IPv6 addresses on a Linux VPS depending on whether you want to disable it temporarily, permanently, or at the kernel level. Depending on your preference, you can choose the method, but the easier approach is to use sysctl which allows you to change IPv6 settings.
Alternatively, you can modify the GRUB boot parameters to prevent the Linux kernel from initializing IPv6 during startup. However, this method requires deeper system access, which may not be available in all VPS environments.
You should also have access to your VPS console or recovery environment in case something goes wrong during configuration. Since this approach is more complex and can introduce additional boot or connectivity issues, we don’t recommend it for most VPS users and won’t cover it in this guide.
Before proceeding:
As mentioned, before disabling it, make sure you have a working IPv4 connection on your Linux VPS and that your application is not only depending on IPv6
Temporarily Disable IPv6 Using sysctl
The sysctl command allows you to modify Linux kernel parameters while the system is running; this can make it a convenient option if you want to disable IPv6 without rebooting your VPS.
First, connect to your VPS using SSH with full root access, and run the following command; the changes will take effect immediately.
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1You can check the IPv6 addresses assigned to your network interfaces by running the following command. If IPv6 has been successfully disabled, the network interfaces should no longer display their previously assigned IPv6 addresses. Note that the network interfaces themselves will not be deleted.
ip -6 addrNote:
This method is temporary. The settings will generally return to their default values after a system reboot unless you save them in a persistent configuration file.
Permanently Disable IPv6 Using sysctl
If you want IPv6 to be fully disabled and keep it disabled after restarting your VPS, you can save the settings in a dedicated sysctl configuration file in /etc/sysctl.d/. By creating this file, you will make IPv6 disabled permanently, and note that Linux loads these configuration files automatically during startup, so you don’t need to use cron or manually run a command after reboot.
Create sysctl configuration file
Run the following command to create a new file named 99-disable-ipv6.conf in the /etc/sysctl.d/ with nano. If the file exists, the nano text editor will open it; otherwise, it will create a new file.
sudo nano /etc/sysctl.d/99-disable-ipv6.confAdd IPv6 Configuration Parameters
After opening the file, enter the following lines into the file:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1These parameters control how Linux handles IPv6:
net.ipv6.conf.all.disable_ipv6 = 1: Disables IPv6 on all existing network interfaces.net.ipv6.conf.default.disable_ipv6 = 1: Applies the disabled IPv6 setting to newly created network interfaces.

Save configuration file
Press Ctrl + O to save the file, then press Enter to confirm the filename after saving, press Ctrl + X to exit Nano.
Apply the Configuration
After saving, the settings won’t apply automatically. Run the following command to load the new settings without restarting your VPS:
sudo sysctl --systemThis command loads the system-wide sysctl configuration files, including the one you just created.
Re-Enable IPv6 on Linux
If you have previously disabled IPv6 on your Linux VPS and want to restore it, you can re-enable it by reversing the configuration changes. The steps depend on the method you used to disable IPv6. If you used sysctl, you can enable IPv6 again by changing the kernel parameters to 0.
If you’ve created a persistent configuration file, you should also remove or modify it to prevent IPv6 from being disabled again after reboot.
Note:
Re-enabling IPv6 does not guarantee that your VPS will automatically receive a public IPv6 address. Your hosting provider must supply IPv6 connectivity, and your network configuration must be set up to use it.
Re-enable IPv6 Using sysctl
Run the following commands to enable IPv6 on existing and newly created network interfaces:
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=0Remove the Persistent IPv6 Configuration File
If you previously created a configuration file in /etc/sysctl.d/99-disable-ipv6.conf, remove it using the command below:
sudo rm /etc/sysctl.d/99-disable-ipv6.confAfter removing the file, run the command below to apply the changes without requiring a restart of the server.
sudo sysctl --systemNote:
Instead of removing the persistent configuration file, you can open it with a text editor like Nano and change the 1 values to 0 to enable IPv6 again and then run the command above to apply changes.
Reasons to Disable IPv6 on Linux
IPv6 is enabled by default on most modern Linux distributions, but not every server or network needs it. If your Linux VPS only uses IPv4, disabling IPv6 can help simplify network configuration and avoid potential connectivity issues caused by incorrect IPv6 settings.
There are also situations where applications or network services don’t work properly with IPv6, or where you simply don’t need IPv6 connectivity. Here are some common reasons to disable IPv6 on Linux VPS.
Common reasons to disable IPv6 on Linux VPS
- Troubleshooting IPv6 Connectivity Issues: Some networks have incorrect or incomplete IPv6 configurations, which can cause problems.
- Working with IPv6-only applications: Some older applications and services may not properly support IPv6.
- Simplifying Firewall Configuration: If your server doesn’t use IPv6, disabling it can reduce the number of firewall rules and network settings you need to manage.
- Reducing Unnecessary Network Configuration: If your VPS only uses IPv4, disabling IPv6 can simplify network management by removing an unused network protocol.
Frequently Asked Questions About Disabling IPv6
Will disabling IPv6 speed up my internet?
No, disabling IPv6 generally does not improve your internet speed or reduce latency. Both IPv4 and IPv6 can provide similar network performance. However, if your network has IPv6 configuration or routing problems, disabling it may help resolve connection delays or failures in some applications.
Does deactivating IPv6 improve security?
Not necessarily. Disabling IPv6 does not automatically make your Linux server more secure. However, if you don’t use IPv6, disabling it reduces the number of network protocols and potential entry points you need to manage.
However, proper firewall configuration for both IPv4 and IPv6 is generally a better security practice than simply disabling it.
Will applications work after disabling IPv6?
Most applications will continue to work, but some may rely on IPv6, especially for local communication. Applications such as Kubernetes, Docker, and newer versions of some databases may require additional configuration.
Is disabling IPv6 a permanent solution?
No. IPv6 adoption continues to grow, so disabling it should be considered a temporary workaround rather than a long-term solution.
Can I disable IPv6 for specific applications only?
Most applications do not provide built-in options to disable IPv6. However, you can often configure them to be explicitly bound to IPv4 addresses.
Conclusion
Disabling IPv6 on Linux can be useful in certain situations, especially when troubleshooting network connectivity or working with IPv4-only environments. In this guide, we’ve discussed disabling it temporarily and permanently by changing kernel parameters with sysctl. You can also re-enable it when required.
Keep in mind that IPv6 is an important part of modern networking, and disabling it is not necessary for most systems. If your network and applications support IPv6, we recommend keeping it enabled for better compatibility with modern services and networks.

