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

Sources:

https://www.linuxquestions.org/questions/slackware-14/how-do-i-disable-ipv6-in-slackware-14-1-a-4175504618/
https://www.linuxquestions.org/questions/slackware-14/how-to-disable-ipv6-937447/

Disable IPv6 Centos/Debian/Ubuntu

To completely disable IPv6 on your Linux system, side note you shouldn’t but it’s your choice, you can do so simply editing the 99-sysctl.conf file at the location ‘/etc/sysctl.d/99-sysctl.conf’
 
Copy and paste the following 3 lines at the bottom of the file.

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

 
After editing the file you need to then reboot the machine or run the following command as root

sysctl -p

To verify that you have ipv6 disabled you can run

Continue reading “Disable IPv6 Centos/Debian/Ubuntu”