Home » Linux » Debian/Ubuntu enable or disable IPv6

Enable / Disable IPv6 in Debian/Ubuntu:

* via /etc/sysctl.conf

# Disable IPv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
# Enable IPv6
net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 0
net.ipv6.conf.lo.disable_ipv6 = 0

* via CLI, as root/su

# Disable IPv6
echo "1" > /proc/sys/net/ipv6/conf/all/disable_ipv6
echo "1" > /proc/sys/net/ipv6/conf/default/disable_ipv6
echo "1" > /proc/sys/net/ipv6/conf/lo/disable_ipv6
# Enable IPv6
echo "0" > /proc/sys/net/ipv6/conf/all/disable_ipv6
echo "0" > /proc/sys/net/ipv6/conf/default/disable_ipv6
echo "0" > /proc/sys/net/ipv6/conf/lo/disable_ipv6