Disable IPv6 Protocol

Current Linux Kernels

I recently had to disable IPv6 on one of my Linux VMs (running Xubuntu 15.04) and realized that the method to disable IPv6 in recent kernels had changed. The current way is to edit the file /etc/sysctl.conf and add the following lines to the end of that file:

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

Then either restart the computer or restart sysctl:

sudo sysctl -p

Older Linux Kernels

Edit /etc/modprobe.conf and add the following line to the file.

alias net-pf-10 off

Then restart the system.