Linux下開啟和關閉IPv6的方法

來源:互聯網
上載者:User

Linux下開啟和關閉IPv6的方法     在現在的Linux上IPv6已經在預設安裝下被支援,但是對於一些對IPv6支援不是很好的應用伺服器來說,開啟了IPv6反而會影響伺服器的網路效能,畢竟現在的網路交換裝置不是IPv6的。 在Linux下首先確認IPv6是否已經被啟用,可以從三個方面確定。1.使用ifconfig查看自己的IP地址是否含有IPv6地址。[root@localhost ~]# ifconfigeth0      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 -lnptActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program nametcp        0      0 127.0.0.1:199               0.0.0.0:*                   LISTEN      2165/snmpdtcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      2372/mysqldtcp        0      0 113.107.xx.xx:53            0.0.0.0:*                   LISTEN      2397/namedtcp        0      0 127.0.0.1:53                0.0.0.0:*                   LISTEN      2397/namedtcp        0      0 127.0.0.1:953               0.0.0.0:*                   LISTEN      2397/namedtcp        0      0 :::22                    :::*                        LISTEN      2182/sshdtcp        0      0 :::80                       :::*                        LISTEN      2517/(squid) 3.使用lsmod查看ipv6的模組是否被載入[root@localhost ~]# lsmod | grep ipv6ipv6                  435105  274 cnicxfrm_nalgo             43333  1 ipv6 當確定IPv6已經開啟後就可以按照下面的方法將其關閉1.使用vi編輯器,開啟/etc/modprobe.conf 2.在文檔中加入如下的兩條:alias net-pf-10 offalias ipv6 off 儲存退出,並且重新啟動系統。重啟之後可以使用上面的三種方法去驗證IPv6支援是否已經被關閉。 IPv6是預設支援的,所以當你要重新開起IPv6支援時,將/etc/modprobe.conf中的兩條指令注釋掉就可以了。 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.