官方给了两种方法。
第一种:
在/etc/default/grub文件的GRUB_CMDLINE_LINUX变量中添加IPV6_DISABLE=1,然后运行update-grub,最后重启服务器。
第二种:
编辑/etc/sysctl.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
最后sysctl -p即可。
附上官方原文:
How to turn off IPv6 Append IPV6_DISABLE=1 to the GRUB_CMDLINE_LINUX variable in /etc/default/grub. Run update-grub and reboot. or better, edit /etc/sysctl.conf and add those parameters to kernel. Also be sure to add extra lines for other network interfaces you want to disable IPv6. 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 After editing sysctl.conf, you should run sysctl -p to activate changes or reboot system.
原文地址:https://wiki.debian.org/DebianIPv6