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

时间:2025-03-18 09:58:02

报错

Could not retrieve mirrorlist /?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 /?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"

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

但我配置的路径是这样的
baseurl=/centos/$releasever/extras/$basearch/

而且我能够ping 通

原因

目录下有多个*.repo

-rw-r--r-- 1 root root 1.2K Apr 30  2019 /etc//
-rw-r--r-- 1 root root 1.7K Nov 23  2020 /etc//
-rw-r--r-- 1 root root 1.3K Sep  3 16:49 /etc//
-rw-r--r-- 1 root root  649 Nov 23  2020 /etc//
-rw-r--r-- 1 root root  314 Nov 23  2020 /etc//
-rw-r--r-- 1 root root  630 Nov 23  2020 /etc//
-rw-r--r-- 1 root root 1.3K Nov 23  2020 /etc//
-rw-r--r-- 1 root root 8.4K Nov 23  2020 /etc//
-rw-r--r-- 1 root root  616 Nov 23  2020 /etc//CentOS-x86_64
-rw-r--r-- 1 root root  924 Oct 30  2020 /etc//

解决办法

挨个查看 *.repo 文件,然后删除掉自己不用的,以及含有报错链接的文件

vim 
rm 
# 等等类似操作

之后再

yum makecache