1、临时禁用
echo "1" > /proc/sys/net/ipv6/conf/all/disable_ipv6 临时禁用所有接口的ipv6
echo "1" > /proc/sys/net/ipv6/conf/eth0/disable_ipv6 临时禁用eth0接口的ipv6
2、永久禁用
vi /etc/sysctl.conf改内容:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
生效sysctl -p
3、grub方式,未在debian9上测试过,需验证
/etc/default/grub中 GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 quiet" update-grub生效