天天看點

RHEL 7 & CentOS 7禁用IPV6

首先,我們必須給出最根本的解決方法:修改grub,在引導時就不加載IPV6子產品

RHEL 7 & CentOS 7禁用IPV6

這樣修改之後,使用

# lsmod | grep ipv6

進行驗證!

下面我們再看一種處理方式,它不如上面提到的方式徹底,但也是有效的!

驗證IPV6是否關閉

1. 通過指令:

Check to see if you’re installation is currently set up for IPv6:

# cat /proc/sys/net/ipv6/conf/all/disable_ipv6

If the output is 0, IPv6 is enabled.

If the output is 1, IPv6 is already disabled.

需要特别說明的是:在這種方法下,使用# lsmod | grep ipv6依然會有一些相關子產品列出。

2. 通過ifconfig檢視網卡資訊,以下打開和關閉ipv6的差别:

RHEL 7 & CentOS 7禁用IPV6

禁用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

本文轉自 yntmdr 51CTO部落格,原文連結:http://blog.51cto.com/yntmdr/1698699,如需轉載請自行聯系原作者

繼續閱讀