Disabling ipv6 on Debian


What is the correct way to disable ipv6 on Debian?


Append ipv6.disable=1 to the GRUB_CMDLINE_LINUX variable in /etc/default/grub and run update-grub and reboot.

Another option is to setting sysctl options like this:

cat << EOF > /etc/sysctl.d/00-disable-ipv6.conf
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.eth0.disable_ipv6 = 1

Repeat for other network interfaces too.

To activate new sysctl settings you can run sysctl -p or reboot the system.

You may want to disable ipv6 in exim4 too, otherwise you can continue to get following warnings:

2014-12-15 16:08:49 1Y0dov-0000KP-8d IPv6 socket creation failed: Address family not supported by protocol

To disable ipv6 lookup in exim4, you have to append disable_ipv6='true' line to /etc/exim4/update-exim4.conf.conf and run update-exim4.conf and restart exim4.


Or you can also append this to /etc/rc.local (before exit 0) : echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
Writing “1” to this file disables IPv6.