使用yum安裝應用程序時候,報錯:[Errno 14] PYCURL ERROR 7 - "Failed to connect to 2001:da8:8000:6023::230: 網絡不可達"


使用yum安裝應用程序時候,報錯:[Errno 14] PYCURL ERROR 7 - "Failed to connect to 2001:da8:8000:6023::230: 網絡不可達"

1、系統環境

  • 物理機:Windows 7(32位)旗艦版
  • 虛擬機:CentOS 6.5

2、問題描述

從安裝好系統之后,用yum源安裝軟件,一直可以用,今天突然就報了如下的錯誤,yum也無法使用了:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.cqu.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
http://mirrors.cqu.edu.cn/CentOS/6.8/os/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
Trying other mirror.
http://mirror.bit.edu.cn/centos/6.8/os/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "Failed to connect to 2001:da8:204:2001:250:56ff:fea1:22: 網絡不可達"
Trying other mirror.
http://mirror.lzu.edu.cn/centos/6.8/os/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "Failed to connect to 2001:da8:c000::160: 網絡不可達"
Trying other mirror.
http://mirrors.nwsuaf.edu.cn/centos/6.8/os/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
Trying other mirror.
http://mirrors.neusoft.edu.cn/centos/6.8/os/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "Failed to connect to 2001:da8:a807::25: 網絡不可達"
Trying other mirror.
http://ftp.sjtu.edu.cn/centos/6.8/os/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "Failed to connect to 2001:da8:8000:6023::230: 網絡不可達"
Trying other mirror.
http://centos.ustc.edu.cn/centos/6.8/os/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "Failed to connect to 2001:da8:d800:95::102: 網絡不可達"
Trying other mirror.
http://mirrors.aliyun.com/centos/6.8/os/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
Trying other mirror.
http://mirrors.163.com/centos/6.8/os/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
Trying other mirror.
http://mirrors.yun-idc.com/centos/6.8/os/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
Trying other mirror.
http://mirrors.aliyun.com/epel/6/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
Trying other mirror.
http://mirrors.tuna.tsinghua.edu.cn/centos/6.8/extras/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "Failed to connect to 2402:f000:1:416:166:111:206:178: 網絡不可達"
Trying other mirror.
http://mirrors.cqu.edu.cn/CentOS/6.8/extras/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
Trying other mirror.
http://mirror.bit.edu.cn/centos/6.8/extras/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "Failed to connect to 2001:da8:204:2001:250:56ff:fea1:22: 網絡不可達"
Trying other mirror.
http://mirror.lzu.edu.cn/centos/6.8/extras/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "Failed to connect to 2001:da8:c000::160: 網絡不可達"
Trying other mirror.
http://mirrors.nwsuaf.edu.cn/centos/6.8/extras/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
Trying other mirror.
http://mirrors.zju.edu.cn/centos/6.8/extras/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "Failed to connect to 2001:da8:e000:1410:216:3eff:fe75:6c73: 網絡不可達"
Trying other mirror.

3、解決方法

3.1原因

我們來查看一下,當前用來上網的網卡eth1的信息:

[root@promote ~]# ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 00:0C:29:D4:EA:E2  
          inet addr:192.168.1.115  Bcast:255.255.255.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fed4:eae2/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4599 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2628 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:575396 (561.9 KiB)  TX bytes:278925 (272.3 KiB)
          Interrupt:19 Base address:0x2000 

我們清楚地看見了inet6 addr: fe80::20c:29ff:fed4:eae2/64 Scope:Link,這一行信息,這個正是影響我們使用yum的罪魁禍首!!!下面我們就來關閉網卡的IPV6

3.2臨時解決方法

臨時關閉網卡的IPV6,並重啟網絡服務:

[root@promote ~]# echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
[root@promote ~]# echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6
[root@promote ~]# service network restart
正在關閉接口 eth1:                                        [確定]
關閉環回接口:                                             [確定]
彈出環回接口:                                             [確定]
彈出界面 eth1: 
正在決定 eth1 的 IP 信息...完成。
                                                           [確定]

此時,再查看網卡eth1的信息:

[root@promote ~]# ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 00:0C:29:D4:EA:E2  
          inet addr:192.168.1.115  Bcast:255.255.255.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5563 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3388 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:676945 (661.0 KiB)  TX bytes:414358 (404.6 KiB)
          Interrupt:19 Base address:0x2000 

沒錯,我們發現inet6 addr: fe80::20c:29ff:fed4:eae2/64 Scope:Link這一行信息沒有了,此時yum就可以正常使用了;

3.3永久生效方法

需要在文件/etc/sysctl.conf中,添加如下的內容:

#shutdown IPv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

4、結語

至此,我們已經解決了這次遇到的問題,能夠繼續通過yum便捷地安裝卸載應用程序了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM