博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
centos6.5 yum update 报错Couldn't resolve host 'centos.ustc.edu.cn'
阅读量:4452 次
发布时间:2019-06-07

本文共 3680 字,大约阅读时间需要 12 分钟。

异常信息

[root@localhost ~]# yum -y updateLoaded plugins: fastestmirror, refresh-packagekit, securitySetting up Update ProcessLoading mirror speeds from cached hostfile * base: centos.ustc.edu.cn * extras: ftp.sjtu.edu.cn * updates: centos.ustc.edu.cnhttp://centos.ustc.edu.cn/centos/6.8/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'centos.ustc.edu.cn'"Trying other mirror.http://ftp.sjtu.edu.cn/centos/6.8/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'ftp.sjtu.edu.cn'"Trying other mirror.http://mirror.bit.edu.cn/centos/6.8/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirror.bit.edu.cn'"Trying other mirror.http://mirrors.163.com/centos/6.8/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.163.com'"Trying other mirror.http://mirrors.aliyun.com/centos/6.8/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.aliyun.com'"Trying other mirror.http://mirrors.cn99.com/centos/6.8/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.cn99.com'"Trying other mirror......sssd-krb5-common-1.13.3-22.el6_8.6.x86_64: failure: Packages/sssd-krb5-common-1.13.3-22.el6_8.6.x86_64.rpm from updates: [Errno 256] No more mirrors to try.  nss-tools-3.21.3-2.el6_8.x86_64: failure: Packages/nss-tools-3.21.3-2.el6_8.x86_64.rpm from updates: [Errno 256] No more mirrors to try.  iscsi-initiator-utils-6.2.0.873-22.el6_8.x86_64: failure: Packages/iscsi-initiator-utils-6.2.0.873-22.el6_8.x86_64.rpm from updates: [Errno 256] No more mirrors to try.  db4-4.7.25-20.el6_8.1.x86_64: failure: Packages/db4-4.7.25-20.el6_8.1.x86_64.rpm from updates: [Errno 256] No more mirrors to try.

 1.服务器解析不了域名, ping mirrors.ustc.edu.cn 这个地址,发现 unknown host mirrors.ustc.edu.cn,ping www.baidu.com同样不行

[root@localhost ~]# ping mirrors.ustc.edu.cnping: unknown host mirrors.ustc.edu.cn

2.查看 /etc/resolv.conf 文件,发现没有设置域名服务

[root@localhost ~]# cat /etc/resolv.conf# Generated by NetworkManager# No nameservers found; try putting DNS servers into your# ifcfg files in /etc/sysconfig/network-scripts like so:## DNS1=xxx.xxx.xxx.xxx# DNS2=xxx.xxx.xxx.xxx# DOMAIN=lab.foo.com bar.foo.comsearch localhost

3.查看网络配置文件,发现没有配置默认网关

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0IPADDR=192.168.200.105NETMASK=255.0.0.0NETWORK=127.0.0.0# If you're having problems with gated making 127.0.0.0/8 a martian,# you can change this to something else (255.255.255.255, for example)BROADCAST=127.255.255.255ONBOOT=yesNAME=eth0

3.查看当前网关信息,发现默认网关不对

[root@localhost ~]# routeKernel IP routing tableDestination     Gateway         Genmask         Flags Metric Ref    Use Ifacelink-local      *               255.255.0.0     U     1002   0        0 eth0192.0.0.0       *               255.0.0.0       U     0      0        0 eth0

4.添加默认网关(虚拟机选择桥接模式配置下面信息)

vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 #网卡名称#HWADDR=00:0C:29:3B:A3:99 MAC地址可以不写(与 /etc/udev/rules.d/70-persistent-net.rules 文件中的 ATTR{address}值一致就行)TYPE=Ethernet #网络类型(通常是Ethemet)UUID=3259a85a-c34c-4ecf-98e8-e1fe495c899f #随机数,唯一标识ONBOOT=yes #设置为yes,开机自动启用网络连接NM_CONTROLLED=yes #network mamager的参数 ,是否可以由NNetwork Manager托管BOOTPROTO=static #设置为none禁止DHCP,设置为static启用静态IP地址,设置为dhcp开启DHCP服务DNS1=192.168.200.1 #DNS 配置IPV6INIT=no #是否启用IPv6的接口USERCTL=no #是否允许非root用户控制该设备,设置为no,只能用root用户更改IPADDR=192.168.200.200 #指定静态ip地址NETMASK=255.255.255.0 #子网掩码GATEWAY=192.168.200.1 #默认网关

windows查看网关

控制面板 -->网络和Internet -->网络和共享中心 -->本地连接 -->详细信息

如图

5.重启网络

service network restart

 

转载于:https://www.cnblogs.com/skyessay/p/6591490.html

你可能感兴趣的文章
vue-11-路由嵌套-参数传递-路由高亮
查看>>
HDU 1199 - Color the Ball 离散化
查看>>
[SCOI2005]骑士精神
查看>>
Hibernate原理解析-Hibernate中实体的状态
查看>>
六时车主 App 隐私政策
查看>>
C语言常见问题 如何用Visual Studio编写C语言程序测试
查看>>
Web用户的身份验证及WebApi权限验证流程的设计和实现
查看>>
hdu 2098 分拆素数和
查看>>
[ONTAK2010]Peaks kruskal重构树,主席树
查看>>
ECMAScript6-let与const命令详解
查看>>
iOS 使用系统相机、相册显示中文
查看>>
什么是敏捷设计
查看>>
SCSS的基本操作
查看>>
"安装程序无法定位现有系统分区" 问题解决
查看>>
.NET中栈和堆的比较
查看>>
【莫队】bzoj 3781,bzoj 2038,bzoj 3289
查看>>
如何优化limit
查看>>
几种常用数据库字段类型查询语句
查看>>
字符全排列
查看>>
提高效率必须改掉的7种习惯
查看>>