CentOS 6/7 禁用ipv6

CentOS 6 

1、编辑/boot/grub/grub.conf在以下行结尾加上ipv6.disable=1

kernel /vmlinuz-2.6.32-279.el6.x86_64 ro root=UUID=5bd71e9a-7b05-45f8-8928-ce88a2921fa0 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet ipv6.disable=1


2、重启生效


CentOS 7


1、编辑/etc/default/grub,在GRUB_CMDLINE_LINUX加上的后面句首加上ipv6.disable=1。

cat /etc/default/grub 

GRUB_TIMEOUT=5

GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"

GRUB_DEFAULT=saved

GRUB_DISABLE_SUBMENU=true

GRUB_TERMINAL_OUTPUT="console"

GRUB_CMDLINE_LINUX="ipv6.disable=1 crashkernel=auto rhgb quiet net.ifnames=0"

GRUB_DISABLE_RECOVERY="true"


修改完毕后保存,运行grub2-mkconfig -o /boot/grub2/grub.cfg重新生成grub.cfg文件。

grub2-mkconfig -o /boot/grub2/grub.cfg

Generating grub configuration file ...

Found linux image: /boot/vmlinuz-3.10.0-514.el7.x86_64

Found initrd image: /boot/initramfs-3.10.0-514.el7.x86_64.img

Found linux image: /boot/vmlinuz-0-rescue-17d22e95741e42659fb29b8c611d8b33

Found initrd image: /boot/initramfs-0-rescue-17d22e95741e42659fb29b8c611d8b33.img

done

2、重启生效


本文转自 baby神 51CTO博客,原文链接:http://blog.51cto.com/babyshen/1974257,如需转载请自行联系原作者

上一篇:phonon的使用


下一篇:Radware积极推动云安全服务落地,为网络安全保驾护航