Fedora CentOS 關閉 IPV6
1 檢查 IPV6 是否有啟用
1.1 使用 ifconfig 查看自己的 IP 位址是否含有 IPv6 位址
inet addr:192.168.198.128
Bcast:192.168.198.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff: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 位址
1.2 檢查服務中的IP中是否有IPv6格式的位址
[root@centos ~]# 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:*
1.3 使用 lsmod|grep ipv6 查看 ipv6 的模組是否掛載
[root@centos ~]# lsmod|grep ipv6
ipv6 243425 19
2 關閉 / 啟用 IPV6
2.1 關閉 IPV6
#vi
/etc/modprobe.conf
加入下面兩行指令
alias net-pf-10 off
alias ipv6
off
存檔離開,重新開機
2.2 啟用 IPV6
IPv6 預設是開啟的,所以要重新啟用 IPv6 時,將 /etc/modprobe.conf 中的兩行指令拿掉就好了
資料來源:胡杨linux