How to disable IPv6 on Linux
This article walks you through the steps to manually disable IPv6 on your Linux device.
On Linux devices, it is possible to disable IPv6 on all network interfaces.
General Method (All Distributions)
- Log in with root privileges.
- Edit the sysctl configuration file:
sudo nano /etc/sysctl.conf - Add these lines (or update if they exist):
net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1
- Save the file.
- Reboot the system:
sudo reboot
To re-enable later, remove the added lines (or change the values to 0) and reboot.
Red Hat Based Distributions (RHEL / CentOS / Fedora)
- Open a terminal.
- Switch to the root user (if needed):
sudo -i - Disable IPv6 immediately (runtime):
sysctl -w net.ipv6.conf.all.disable_ipv6=1 sysctl -w net.ipv6.conf.default.disable_ipv6=1 sysctl -w net.ipv6.conf.tun0.disable_ipv6=1
- Persist the change by adding the same lines to /etc/sysctl.conf and then run:
sysctl -p
Re-enable with:
sysctl -w net.ipv6.conf.all.disable_ipv6=0 sysctl -w net.ipv6.conf.default.disable_ipv6=0 sysctl -w net.ipv6.conf.tun0.disable_ipv6=0 sysctl -p
Debian Based Distributions (Debian / Ubuntu / Linux Mint)
- Open a terminal.
- Edit sysctl.conf:
sudo nano /etc/sysctl.conf - Append these lines at the bottom:
net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1 net.ipv6.conf.tun0.disable_ipv6 = 1
- Save and close the file.
- Reboot:
sudo reboot
To re-enable IPv6, remove those lines (or change values to 0) and reboot.
Need More help?
If you are experiencing issues, please reach out to our support team for assistance.