Could not resolve host: mirrorlist.centos.org Centos 7 Unkown error

网友投稿 1641 2022-09-26

Could not resolve host: mirrorlist.centos.org Centos 7 Unkown error

Could not resolve host: mirrorlist.centos.org Centos 7 Unkown error

问题

安装Centos7(core)以后,网卡默认不会启用。这是一个大坑,直接报错,这是一个过度优化,有几个开发人员/运维人员安装centos7(core)不用ssh去连接服务器的。

报错如下:

Loaded plugins: fastestmirrorCould not retrieve mirrorlist error was14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"[Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"Trying other mirror. One of the configured repositories failed (CentOS-7 - Base), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this: 1. Contact the upstream for the repository and get them to fix the problem. 2. Reconfigure the baseurl/etc. for the repository, to point to a working upstream. This is most often useful if you are using a newer distribution release than is supported by the repository (and the packages for the previous distribution release still work). 3. Run the command with the repository temporarily disabled yum --disablerepo=base ... 4. Disable the repository permanently, so yum won't use it by default. Yum will then just ignore the repository until you permanently enable it again or use --enablerepo for temporary usage: yum-config-manager --disable base or subscription-manager repos --disable=base 5. Configure the failing repository to be skipped, if it is unavailable. Note that yum will try to contact the repo. when it runs most commands, so will have to try and fail each time (and thus. yum will be be much slower). If it is a very temporary problem though, this is often a nice compromise: yum-config-manager --save --setopt=base.skip_if_unavailable=truefailure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try.[Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"[root@localhost ~]#

解决办法

1、故障发生以后,第一看看网络是否通畅

ping baidu.com#google dnsping 8.8.8.8

以上均无反应,于是想起来前一段时间设置过一次centos网卡,让他开机自动启动。命令如下

vi /etc/sysconfig/network-scripts/ifcfg-ens33

修改里面的Boot=yes

Boot=no (开机引导的时候不启动网卡)#改成yes

启动网卡

ifup ens33

查看ip地址

ip addr1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever2: ens33: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0c:29:63:c2:ca brd ff:ff:ff:ff:ff:ff inet 192.168.152.141/24 brd 192.168.152.255 scope global noprefixroute dynamic ens33 valid_lft 1319sec preferred_lft 1319sec inet6 fe80::fdb9:c978:ff44:dbc5/64 scope link noprefixroute

虚拟机ip地址是 192.168.152.141

2、更新本地缓存:

yum makecache[root@promote ~]# yum makecacheLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile * base: mirrors-99.com * extras: mirrors.njupt.edu- * updates: mirrors-99.combase | 3.6 kB 00:00:00extras | 3.4 kB 00:00:00updates | 3.4 kB 00:00:00(1/8): extras/7/x86_64/other_db | 127 kB 00:00:00(2/8): extras/7/x86_64/filelists_db | 246 kB 00:00:00(3/8): updates/7/x86_64/prestodelta | 797 kB 00:00:00(4/8): updates/7/x86_64/other_db | 641 kB 00:00:00(5/8): base/7/x86_64/other_db | 2.6 MB 00:00:01(6/8): base/7/x86_64/filelists_db | 7.1 MB 00:00:02(7/8): updates/7/x86_64/filelists_db | 4.4 MB 00:00:03extras/7/x86_64/prestodelta FAILED[Errno 14] HTTP Error 302 - FoundTrying other mirror.(8/8): extras/7/x86_64/prestodelta | 65 kB 00:00:00Metadata Cache

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:企业营销数字化转型,能实现什么效果?(客户运营数字化本质上是营销模式的转型升级)
下一篇:Tomcat9报错 The valid characters are defined in RFC 7230 and RFC 3986
相关文章

 发表评论

暂时没有评论,来抢沙发吧~