查看是否有TCP6协议

> netstat -lanput

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1129/sshd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1293/master
tcp        0     36 192.168.1.28:22         192.168.1.3:1947        ESTABLISHED 1617/sshd: root@pts
tcp6       0      0 :::22                   :::*                    LISTEN      1129/sshd
tcp6       0      0 ::1:25                  :::*                    LISTEN      1293/master
udp        0      0 127.0.0.1:323           0.0.0.0:*                           737/chronyd
udp        0      0 0.0.0.0:68              0.0.0.0:*                           940/dhclient
udp6       0      0 ::1:323                 :::*                                737/chronyd

编辑 grub 文件

> vim /etc/default/grub

#---------------------------
... ...
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
... ...
#---------------------------

改为

#---------------------------
... ...
GRUB_CMDLINE_LINUX="crashkernel=auto ipv6.disable=1 rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
... ...
#---------------------------

在GRUB_CMDLINE_LINUX加上 ipv6.disable=1

重新生成grub.cfg文件

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

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-1062.18.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1062.18.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1062.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1062.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-eba9c4026eaa46eb9c1467a1afc213ca
Found initrd image: /boot/initramfs-0-rescue-eba9c4026eaa46eb9c1467a1afc213ca.img
done

重启系统

> shutdown -r now

# 查看ip6是否关闭
> netstat -lanput

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1081/sshd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1323/master
tcp        0     36 192.168.1.28:22         192.168.1.3:2506        ESTABLISHED 1594/sshd: root@pts
udp        0      0 127.0.0.1:323           0.0.0.0:*                           728/chronyd
udp        0      0 0.0.0.0:68              0.0.0.0:*                           907/dhclient

标签: Centos7,TCP6

添加新评论