disable ipv6 in linux
General

How to Disable IPv6 in Linux?

For network administrators managing Linux server or system, it may be necessary to disable IPv6 permanently or temporarily.

You can disable IPv6 in Linux by editing /etc/sysctl.conf (in Debian-based distros) or using sysctl command (in Red Hat-based distros), followed by a system reboot.

Permanently Disable IPv6 on Debian-Based Systems (Ubuntu, Mint)

On Debian and its derivatives (Ubuntu, Mint, etc.), modifying the /etc/sysctl.conf file offers a persistent approach. Escalate your privileges to root and utilize nano to edit the configuration:

sudo nano /etc/sysctl.conf

Append the following lines at the file’s end, effectively disabling IPv6 for all interfaces, the default interface, and the loopback interface:

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

Save the file and reboot the system for the changes to take effect.

Disabling IPv6 on Red Hat-Based Systems (CentOS, Fedora)

How to Temporarily Disable IPv6 in Linux CentOS and Fedora?

Red Hat and distributions based on it offer a more streamlined approach using the sysctl command directly.

In your terminal, execute the following command to disable IPv6 globally:

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

This modification persists until the next system reboot.

For Permanent Disabling IPv6 in CentOS and Fedora

For a permanent solution, edit the /etc/default/grub file with sudo nano /etc/default/grub . Add the following line to the GRUB_CMDLINE_LINUX_DEFAULT parameter:

GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 quiet splash"

Remember to run sudo update-grub to update the GRUB configuration. Reboot your system to finalize the changes.

Conclusion

This guide equips you with the knowledge to disable IPv6 on various Linux distributions. Remember, disabling IPv6 should be a deliberate decision based on your network configuration.

If you encounter any complexities, refer to your distribution’s documentation or seek assistance from the Linux community.

Leave a Reply

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