编辑

1
nano /etc/network/interfaces

粘贴

1
2
iface eth0 inet6 static
disable-ipv6 yes

重启后生效   临时:

1
2
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1

永久生效 编辑/etc/sysctl.conf 添加:

1
2
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1