天天看點

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
           

繼續閱讀