标签:centos关闭ipv6 yum报错cannot retrieve metalink for repository: epel.
问题一:关闭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下载东西就正常了。
问题二:运行yum报Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
1、解决办法:
vi /etc/yum.repos.d/epel.repo
编辑[epel]下的baseurl前的#号去掉,mirrorlist前添加#号。正确配置如下:
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
注意:上面的说有的baseurl都放行
所有的mirrorlist都在用#注销掉
2、再运行
yum makecache
本文出自 “飞翔的猪” 博客,请务必保留此出处http://thinkpig007.blog.51cto.com/971471/1578451
标签:centos关闭ipv6 yum报错cannot retrieve metalink for repository: epel.
原文地址:http://thinkpig007.blog.51cto.com/971471/1578451