> For the complete documentation index, see [llms.txt](https://technobureau.com/llms.txt).
> Use it to discover all available pages before exploring further.

# How to Disable IPv6 on CentOS

IPv6 is the next-generation internet protocol that provides a larger address space compared to IPv4. However, there may be situations where you need to disable IPv6 on your CentOS server. Disabling IPv6 can help resolve compatibility issues or improve network performance. This guide provides two methods to disable IPv6 on CentOS: using sysctl and using the kernel boot option. By following these steps, you can effectively disable IPv6 on your CentOS system.


## Introduction

IPv6 is the next-generation internet protocol that provides a larger address space compared to IPv4. However, there may be situations where you need to disable IPv6 on your CentOS server. Disabling IPv6 can help resolve compatibility issues or improve network performance. This guide provides two methods to disable IPv6 on CentOS: using sysctl and using the kernel boot option. By following these steps, you can effectively disable IPv6 on your CentOS system.

## Method 1: Disable IPv6 Using sysctl

1. Open the sysctl configuration file /etc/sysctl.d/90-ipv6.conf using the following command:

    ```bash
    vi /etc/sysctl.d/90-ipv6.conf
    ```

2. Add the following lines to the file and save it:

    ```bash
    net.ipv6.conf.all.disable_ipv6 = 1
    net.ipv6.conf.default.disable_ipv6 = 1
    ```

3. Apply the changes by running the following command:

    ```bash
    sysctl --load /etc/sysctl.d/90-ipv6.conf
    ```

4. To verify that IPv6 is disabled, use the following command:

    ```bash
    ip a | grep inet6
    ```

    If the command does not return any output, it means that IPv6 has been disabled on all your network interfaces.

!!! note

    If you are using CentOS 8 with Network Manager, some network interfaces may still use IPv6 after a system reboot. To completely stop using IPv6, proceed to Method 2.

## Method 2: Disable IPv6 Using the Kernel Boot Option

1. Open the default GRUB configuration file **`/etc/default/grub`** using the following command:

    ```bash
    vi /etc/default/grub
    ```

2. Locate the line that begins with **`GRUB_CMDLINE_LINUX`** and append **`ipv6.disable=1`** to the existing parameters. The line should look like this:

    ```bash
    GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX ipv6.disable=1"
    ```

3. Save and exit the configuration file.
4. Update the GRUB configuration files by running the following commands:

    ```bash
    grub2-mkconfig -o /boot/grub2/grub.cfg
    grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
    ```

5. Reboot your CentOS machine for the changes to take effect:

    ```bash
    reboot
    ```

6. After the reboot, use the following command to verify whether IPv6 is disabled:

    ```bash
    ip a | grep inet6
    ```

    If no IPv6 addresses are displayed, it indicates that IPv6 has been successfully disabled.

## Conclusion

Disabling IPv6 on CentOS can be necessary in certain scenarios. By following the methods outlined in this guide, you can effectively disable IPv6 on your CentOS system. Choose the method that best suits your requirements and verify the success of the disabling process. Disabling IPv6 can help resolve compatibility issues and improve network performance if IPv6 is not required in your environment.
