RHEL 8 / CentOS 8 enable/disable IPv6

An Internet Protocol Version 6 (IPv6) address is an identifier of a network interface of a computer or a network node involved in an IPv6 computer network. This article will guide the user via simple steps on how to disable or re-enable IPv6 network addresses on RHEL 8 / CentOS 8. To temporarily enable/disable the IPv6 address on RHEL 8 / CentOS 8 we will use the sysctl command. Additionally, to permanently disable the IPv6 address we will modify the GRUB boot options.

In this tutorial you will learn:

  • How to temporarily disable the IPv6 address.
  • How to permanently disable IPv6 by modifying the GRUB boot options.

Enabled IPv6 on RHEL 8 Linux system.

Enabled IPv6 on RHEL 8 Linux system.

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System RHEL 8 / CentOS 8
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to disable IPv6 on RHEL 8 / CentOS 8 step by step instructions

  1. To temporarily disable IPv6 address execute the following command from your terminal with administrative privileges:
    # sysctl -w net.ipv6.conf.all.disable_ipv6=1
    


  2. Confirm that IPv6 network addresses are disabled. Run the ip command and check for any inet6 IP address allocations:
    # ip a 
    
  3. Disabled IPv6 network addresses on RHEL 8 Linux Server/Workstation

    Disabled IPv6 network addresses on RHEL 8 Linux Server/Workstation.

  4. Permanently disable IPv6 network address allocations by modifying the GRUB boot menu. First obtain the current kernelopts argument list: For example:
    # grub2-editenv - list | grep kernelopts
    kernelopts=root=/dev/mapper/rhel-root ro crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet
    

    Next, append a new argument ipv6.disable=1 to the previously received kernelopts argument list: For example:

    # grub2-editenv - set "kernelopts=root=/dev/mapper/rhel-root ro crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet ipv6.disable=1"
    


    Modify GRUB boot arguments do disable IPv6 on RHEL 8 Linux system

    How to modify GRUB boot arguments do disable IPv6 on the RHEL 8 Linux system.

  5. Reboot your system to apply changes. Alternatively simply disable IPv6 as per STEP 1
  6. In case you need to re-enable the IPv6 address execute:
    # sysctl -w net.ipv6.conf.all.disable_ipv6=0
    

    If you have also modified GRUB boot to disable IPv6 as per above instructions use the grub2-editenv command to remove the ipv6.disable=1 argument.