CentOS关闭IPv6
1、使用ifconfig查看自己的IP地址是否含有IPv6地址
inet addr:192.168.. Bcast:192.168.198.255 Mask:255.255.255.0inet6 addr: fe90::20c:k96f:fee4:1d8/64
Scope:Link UP BROADCAST RUNNING
MULTICAST MTU:1500 Metric:1 RX packets:1080 errors:0 dropped:0
overruns:0 frame:0 TX packets:890 errors:0 dropped:0 overruns:0
carrier:0 collisions:0 txqueuelen:1000 RX bytes:89517 (87.4 KiB) TX
bytes:122147 (119.2 KiB) Interrupt:185 Base address:0x1400
红色标识部分即为IPV6地址。
2、查看服务监听的IP中是否有IPv6格式的地址
netstat -tuln
Active Internet connections (only servers) Proto Recv-Q Send-Q Local
Address Foreign Address State tcp 0
0 0.0.0.0:613 0.0.0.0:* LISTEN tcp
0 0 0.0.0.0:3306 0.0.0.0:*
LISTEN tcp 0 0 0.0.0.0:111 0.0.0.0:*
LISTEN tcp 0 0 0.0.0.0:21 0.0.0.0:*
LISTEN tcp 0 0 127.0.0.1:631 0.0.0.0:*
LISTEN tcp 0 0 127.0.0.1:25 0.0.0.0:*
LISTEN tcp 0 0 :::80 :::*
LISTEN tcp 0 0 :::22 :::*
LISTEN udp 0 0 0.0.0.0:68 0.0.0.0:* udp
0 0 0.0.0.0:607 0.0.0.0:* udp 0 0
0.0.0.0:610 0.0.0.0: udp 0 0 0.0.0.0:111 0.0.0.0: udp 0 0 0.0.0.0:631 0.0.0.0:*
3、查看ipv6的模块是否被加载
lsmod|grep ipv6
ipv6 243425 19
4、关闭IPV6
vi /etc/modprobe.conf
添加下面两行内容
alias net-pf-10 off
alias ipv6 off
保存退出,并且重新启动系统,注意一定是重启系统
,重启网卡是不生效的。
重启之后可以使用上面的三种方法去验证IPv6支持是否已经被关闭。
5、开启IPV6
IPv6是默认支持的,所以当你要重新开起IPv6支持时,将/etc/modprobe.conf
中的两条指令注释掉就可以了。
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。
评论已关闭