Disable IPv6 on Linux Via Kernel Blacklisting

If for any reason you want to disable ipv6 and don’t want to do it with the sysctl directive, if your kernel was compiled with ipv6 support as a module one easy route is to blacklist the ipv6 kernel module.

All you need to do is create/update the ‘/etc/rc.modules.d/blacklist.conf’ file and add the line ‘blacklist ipv6’.

alternatively you can run the following command as root.

echo '
#Disabling IPv6
blacklist ipv6
' >>  /etc/modprobe.d/blacklist.conf