1.问题描述
1.1yum仓库没办法使用
Loaded plugins: fastestmirror
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
One of the configured repositories failed (Unknown),
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.2没办法访问百度的域名
因为没办法访问外网,所以yum仓库包管理工具用不了,如上图所示
可以测试ping 百度
2.解决思路
2.1检查是否是dns的问题
ping不通百度可能是域名映射的问题,所以用ping ip的方式直接测试
如果能ping通,那几乎可能可以确定是dns的问题
2.2解决dns问题
或者直接修改网卡eth0(名字自己查看是否叫eth0)
网卡配置修改后需要重启网络服务
如果加上了还是不通就有可能是防火墙问题
3.解决防火墙问题
3.1确定宿主机网络正常
在宿主机上ping百度
如果宿主机上网络不通,首先解决宿主机的网络,这里暂不考虑此问题,因为发生的概率较小
3.2查看宿主机网桥状态
确认虚拟机网卡接口eth0已经添加到br0上
如果br0上的interfaces中没有kvm虚拟机对应的vnet(vnet0,vnet1,vnet2等),则需要执行命令添加到br0上
3.3查看防火墙
物理机设置
如果使用了iptables做网络ACL,确保kvm虚拟机的流量没有做限制。
3.3检查iptables规则
如果最后实在不会搞iptables,那就把所有的防火墙软件服务停掉,以及查看selinux,KYSEC相关规则