Disable IPv6 On Ubuntu/Debian

The more formal way of doing this, which fits in with the don’t-change-a-core-system-file-otherwise-it-could-be-replaced-when-you-upgrade-packages-and-your-changes-could-be-lost methodology, and such that it continues across a reboot, is as follows:

# create the long-life config file

echo "net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1" | sudo tee /etc/sysctl.d/99-my-disable-ipv6.conf

# ask the system to use it

sudo service procps reload

# check the result

cat /proc/sys/net/ipv6/conf/all/disable_ipv6

 

Bad Behavior has blocked 154 access attempts in the last 7 days.