Disabling IPv6 in Ubuntu/Debian and CentOS/RedHat

Disabling IPv6 in Ubuntu/Debian and CentOS/RedHat

Disabling IPv6 in Linux distributions like Ubuntu/Debian and CentOS/RedHat can be done in a few simple steps. Here is a detailed guide on how to disable IPv6 in these distributions.

General steps for each:

For Ubuntu/Debian:

Edit sysctl.conf:
Open the /etc/sysctl.conf file in a text editor with superuser privileges. For example, use sudo nano /etc/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
net.ipv6.conf.lo.disable_ipv6 = 1

Save and close the file.

Apply Changes:
Run the command sudo sysctl -p to apply the changes without rebooting.

For CentOS/Red Hat:

Edit Network Configuration:
For each network interface, edit the configuration file located in /etc/sysconfig/network-scripts/. For example, for interface eth0, the file is /etc/sysconfig/network-scripts/ifcfg-eth0.
Add the line IPV6INIT=no.

Disable IPv6 Kernel Module:
Edit /etc/default/grub and add ipv6.disable=1 to the GRUB_CMDLINE_LINUX line, so it looks something like: GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet ipv6.disable=1".
Regenerate the GRUB configuration with sudo grub2-mkconfig -o /boot/grub2/grub.cfg (for BIOS systems) or sudo grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg (for UEFI systems).

Restart Network Services or Reboot:
Restart the network services using sudo systemctl restart network or reboot the system for the changes to take effect.

Important Notes:

Disabling IPv6 might not be suitable for all environments. Ensure that it’s compatible with your network requirements.
The steps might slightly vary depending on the specific version of the operating system.
Always backup configuration files before making changes.

This article incorporates information and material from various online sources. We acknowledge and appreciate the work of all original authors, publishers, and websites. While every effort has been made to appropriately credit the source material, any unintentional oversight or omission does not constitute a copyright infringement. All trademarks, logos, and images mentioned are the property of their respective owners. If you believe that any content used in this article infringes upon your copyright, please contact us immediately for review and prompt action.

This article is intended for informational and educational purposes only and does not infringe on the rights of the copyright owners. If any copyrighted material has been used without proper credit or in violation of copyright laws, it is unintentional and we will rectify it promptly upon notification. Please note that the republishing, redistribution, or reproduction of part or all of the contents in any form is prohibited without express written permission from the author and website owner. For permissions or further inquiries, please contact us.

Leave a reply

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