CentOS關閉IPv6報錯解決辦法

來源:互聯網
上載者:User

CentOS關閉IPv6報錯解決辦法

關閉IPv6

1、問題:使用yum下載東西的時候提示有一個IPv6的地址不可達,如下

http://download.fedoraproject.org/pub/epel/6/x86_64/repodata/924f970f6436162727781050e63524af37f891ba57c8a374cdd0a87e53d89180-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 7 - "Failed to connect to 2001:da8:8000:6023::230: Network is unreachable"

Trying other mirror.

Error: failure: repodata/924f970f6436162727781050e63524af37f891ba57c8a374cdd0a87e53d89180-filelists.sqlite.bz2 from epel: [Errno 256] No more mirrors to try.

You could try using --skip-broken to work around the problem

You could try running: rpm -Va --nofiles --nodigest

2、查看本機網卡配置,eth2上的確開了ipv6 inet6

[root@lvs05091 ~]# ifconfig -a

eth2 Link encap:Ethernet HWaddr 00:50:56:A5:2F:9D

inet addr:192.168.5.91 Bcast:192.168.5.255 Mask:255.255.255.0

inet6 addr: fe80::250:56ff:fea5:2f9d/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:522 errors:0 dropped:0 overruns:0 frame:0

TX packets:138 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:42263 (41.2 KiB) TX bytes:19212 (18.7 KiB)

[root@lvs05091 modprobe.d]# netstat -an

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address Foreign Address State

tcp 0 0 :::111 :::* LISTEN

tcp 0 0 :::22 :::* LISTEN

tcp 0 0 ::1:25 :::* LISTEN

tcp 0 0 :::37256 :::* LISTEN

::代表IPv6

3、關閉IPv6

修改sysctl.conf設定檔,加入如下內容

[root@lvs05091 etc]# vi sysctl.conf

#shutdown IPv6

net.ipv6.conf.all.disable_ipv6 = 1

net.ipv6.conf.default.disable_ipv6 = 1

是修改配置生效

[root@lvs05091 etc]# sysctl -p

重啟網卡:service network restart

備忘:上面是永久關閉IPv6

也可以零時關閉,下次開機IPv6還會開啟

echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6

echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6

4、再來查看介面配置,可以看到ipv6地址不在了

[root@lvs05091 etc]# ifconfig -a

eth2 Link encap:Ethernet HWaddr 00:50:56:A5:2F:9D

inet addr:192.168.5.91 Bcast:192.168.5.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:2336 errors:0 dropped:0 overruns:0 frame:0

TX packets:839 errors:0 dropped:0 overruns:0 carrier:0

這個時候使用yum下載東西就正常了。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.