Disable ipv6 built-in kernel module.
Edit /etc/default/grub and append ipv6.disable=1 to GRUB_CMDLINE_LINUX like the following sample:
1)
GRUB_CMDLINE_LINUX="rd.lvm.lv=rhel/swap crashkernel=auto rd.lvm.lv=rhel/root ipv6.disable=1"
Run the grub2-mkconfig command to regenerate the grub.cfg file:
2)
# grub2-mkconfig -o /boot/grub2/grub.cfg
Alternatively, on UEFI systems, run the following:
or
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.<interface>.disable_ipv6 = 1
sysctl -p /etc/sysctl.d/ipv6.conf
or
sysctl -p