The following configuration lines belong in the file,
/etc/sysctl.d/40-ipv6.conf to disable IPv6 on all interfaces.
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
Which Linux are we talking about? The GRUB configuration method looks something like the following configuration in, perhaps,
GRUB_CMDLINE_LINUX="ipv6.disable=1 rhgb quiet"
After changing the GRUB configuration, one must reinstall GRUB and reboot.
grub2-mkconfig -o /boot/grub2/grub.cfg
shutdown -r now
Later, check to see that the configuration was successful.
ip addr show | grep net6
Or, to simply prevent the IPv6 module from binding to the IPv6 networking stack, add the line below to
/etc/modprobe.d/blacklist.conf (or a different file name according to the existing directory/file structure):
options ipv6 disable=1
This will allow the loading of the IPv6 module in order to satisfy any other modules that depend on it while disabling support for the IPv6 protocol.
In a RedHat-based OS, one could use the following directive in