禁用 Ubuntu 18.04 的 IPV6

取消 Ubuntu 18.04 的 IPV6
Hadoop 集群对 IPV6的兼容性不高,存在许多无法定义的问题,因此取消系统的 IPV6
参考:https://askubuntu.com/questions/1046057/disabling-ipv6-in-ubuntu-server-18-04

Ubuntu 16.04

Edit /etc/sysctl.conf, and add follow context to file

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

Ubuntu 18.04

Edit /etc/default/grub ,Modify the GRUB_CMDLINEs to look like:

1
2
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1"
GRUB_CMDLINE_LINUX="ipv6.disable=1"

Then execute:

1
2
sudo update-grub
sudo reboot