CentOS7彻底关闭IPV6

原文地址:https://blog.csdn.net/rznice/article/details/54016689

编辑/etc/default/grub,在GRUB_CMDLINE_LINUX加上的后面句首加上ipv6.disable=1。 
    修改前:
  • 1
  • 2
  • 3
[root@localhost Desktop]# 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="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
    修改后:
  • 1
  • 2
[root@localhost Desktop]# 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 rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
    修改完毕后保存,运行grub2-mkconfig -o /boot/grub2/grub.cfg重新生成grub.cfg文件。
  • 1
  • 2
[root@localhost Desktop]# grub2-mkconfig -o /boot/grub2/grub.cfg 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-514.2.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-514.2.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-327.36.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.36.3.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-d885883cdb4944609bc5e3493dd2b680
Found initrd image: /boot/initramfs-0-rescue-d885883cdb4944609bc5e3493dd2b680.img
done
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
    重启系统,运行lsmod|grep ipv6,可以看到ipv6已经关闭。

猜你喜欢

转载自blog.csdn.net/kepa520/article/details/81330617
今日推荐