方法一:
修改grub,在引导时就不加载IPV6模块
/etc/default/grub
GRUB_CMDLINE_LINUX="ipv6.disable=1 ..."
grub2-mkconfig -o {grub.cfg 路径}
路径可为:
/boot/grub2/grub.cfg
或
/boot/efi/EFI/centos/grub.cfg
方法二:
禁用IPV6的操作步骤(不如方法一彻底, 推荐)
Step 1: add this rule in /etc/sysctl.conf : net.ipv6.conf.all.disable_ipv6=1
Step 2: add this rule in /etc/sysconfig/network: NETWORKING_IPV6=no
Step 3: add this setting for each nic X (X is the corresponding number for each nic) in /etc/sysconfig/network-scripts/ifcfg-ethX: IPV6INIT=no
Step 4: disable the ip6tables service : chkconfig ip6tables off
Step 5: Reload the sysctl configuration:
# sysctl -p
or
# reboot
注意:禁用IPV6后,可能会导致某些服务无法启动,比如VSFTP,对于VSFTP,需要修改/etc/vsftpd/vsftpd.conf文件中的listen和listen_ipv6两个选项:
listen=YES
listen_ipv6=NO
修改grub,在引导时就不加载IPV6模块
/etc/default/grub
GRUB_CMDLINE_LINUX="ipv6.disable=1 ..."
grub2-mkconfig -o {grub.cfg 路径}
路径可为:
/boot/grub2/grub.cfg
或
/boot/efi/EFI/centos/grub.cfg
方法二:
禁用IPV6的操作步骤(不如方法一彻底, 推荐)
Step 1: add this rule in /etc/sysctl.conf : net.ipv6.conf.all.disable_ipv6=1
Step 2: add this rule in /etc/sysconfig/network: NETWORKING_IPV6=no
Step 3: add this setting for each nic X (X is the corresponding number for each nic) in /etc/sysconfig/network-scripts/ifcfg-ethX: IPV6INIT=no
Step 4: disable the ip6tables service : chkconfig ip6tables off
Step 5: Reload the sysctl configuration:
# sysctl -p
or
# reboot
注意:禁用IPV6后,可能会导致某些服务无法启动,比如VSFTP,对于VSFTP,需要修改/etc/vsftpd/vsftpd.conf文件中的listen和listen_ipv6两个选项:
listen=YES
listen_ipv6=NO