使用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便捷地安装卸载应用程序了。

上一篇:Oracle数据库内置函数


下一篇:解决:install service error: InstallAsEventCreate() failed: xxx registry key already exists