歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> Linux下開啟和關閉IPv6的方法

Linux下開啟和關閉IPv6的方法

日期:2017/3/1 16:21:19   编辑:關於Linux
Linux下開啟和關閉IPv6的方法 在現在的Linux上IPv6已經在默認安裝下被支持,但是對於一些對IPv6支持不是很好的應用服務器來說,開啟了IPv6反而會影響服務器的網絡性能,畢竟現在的網絡交換設備不是IPv6的。 在Linux下首先確認IPv6是否已經被啟用,可以從三個方面確定。 1.使用ifconfig查看自己的IP地址是否含有IPv6地址。 [root@localhost ~]# ifconfig eth0 Link encap:Ethernet HWaddr 00:EA:01:09:73:AB inet addr:113.107.xx.xx Bcast:113.107.42.255 Mask:255.255.255.0 inet6 addr: fe80::2ea:1ff:fe09:73ab/64 Scopeink UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:75967 errors:0 dropped:0 overruns:0 frame:0 TX packets:43331 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:7847346 (7.4 MiB) TX bytes:159737697 (152.3 MiB) Interrupt:169 2.查看服務監聽的IP中是否有IPv6格式的地址 [root@localhost ~]# netstat -lnpt Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:199 0.0.0.0:* LISTEN 2165/snmpd tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2372/mysqld tcp 0 0 113.107.xx.xx:53 0.0.0.0:* LISTEN 2397/named tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 2397/named tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 2397/named tcp 0 0 :::22 :::* LISTEN 2182/sshd tcp 0 0 :::80 :::* LISTEN 2517/(squid) 3.使用lsmod查看ipv6的模塊是否被加載 [root@localhost ~]# lsmod | grep ipv6 ipv6 435105 274 cnic xfrm_nalgo 43333 1 ipv6 當確定IPv6已經開啟後就可以按照下面的方法將其關閉 1.使用vi編輯器,打開/etc/modprobe.conf 2.在文檔中加入如下的兩條: alias net-pf-10 off alias ipv6 off 保存退出,並且重新啟動系統。 重啟之後可以使用上面的三種方法去驗證IPv6支持是否已經被關閉。 IPv6是默認支持的,所以當你要重新開起IPv6支持時,將/etc/modprobe.conf中的兩條指令注釋掉就可以了。
Copyright © Linux教程網 All Rights Reserved