天天看点

yum报错网络不可达,但是配置的网络能够ping通

报错

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=container error was
14: curl#7 - "Failed to connect to 2a05:d012:8b5:6503:9efb:5cad:348f:e826: Network is unreachable"


Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=container error was
14: curl#7 - "Failed to connect to 2001:4178:5:200::10: Network is unreachable"

http://vault.centos.org/centos/7/os/Source/repodata/repomd.xml: [Errno 12] Timeout on http://vault.centos.org/centos/7/os/Source/repodata/repomd.xml: (28, 'Connection timed out after 30000 milliseconds')
           

但我配置的路径是这样的

baseurl=http://mirrors.mycompany.org/centos/$releasever/extras/$basearch/

而且我能够ping 通

mirrors.mycompany.org

原因

目录下有多个

Base.repo

*.repo

-rw-r--r-- 1 root root 1.2K Apr 30  2019 /etc/yum.repos.d/Centos-Base.repo
-rw-r--r-- 1 root root 1.7K Nov 23  2020 /etc/yum.repos.d/CentOS-Base.repo
-rw-r--r-- 1 root root 1.3K Sep  3 16:49 /etc/yum.repos.d/CentOS-CR.repo
-rw-r--r-- 1 root root  649 Nov 23  2020 /etc/yum.repos.d/CentOS-Debuginfo.repo
-rw-r--r-- 1 root root  314 Nov 23  2020 /etc/yum.repos.d/CentOS-fasttrack.repo
-rw-r--r-- 1 root root  630 Nov 23  2020 /etc/yum.repos.d/CentOS-Media.repo
-rw-r--r-- 1 root root 1.3K Nov 23  2020 /etc/yum.repos.d/CentOS-Sources.repo
-rw-r--r-- 1 root root 8.4K Nov 23  2020 /etc/yum.repos.d/CentOS-Vault.repo
-rw-r--r-- 1 root root  616 Nov 23  2020 /etc/yum.repos.d/CentOS-x86_64-kernel.repo
-rw-r--r-- 1 root root  924 Oct 30  2020 /etc/yum.repos.d/epel.repo
           

解决办法

挨个查看

*.repo

文件,然后删除掉自己不用的,以及含有报错链接的文件

vim CentOS-CR.repo
rm CentOS-CR.repo
# 等等类似操作
           

之后再

yum makecache
           

继续阅读