维护服务器时,运行了yum clean。
然后悲催的事情发现了,再次运行yum update时发现出现了无法解析dns的提示。
然后我ping了下google.cN,发现也是ping不通。
目前为止,确定肯定是DNS的问题。
然后我查看了, /etc/resolv.conf文件,(nameserver 8.8.8.8 nameserver 8.8.4.4)里面DNS配置正常。
因为服务器的系统是CentOS7,所以我尝试关闭NetworkManager,然后重启网络。结果依然是解析错误。
经过一些国外论坛的案例,我尝试关闭了防火墙。
关闭防火墙后,DNS解析恢复了正常。
期间出现的错误提示:
ping错误:
ping: Name or service not known
yum更新或安装错误:
Yum update error: Could not retrieve mirrorlist
进行的操作:
vi /etc/resolv.conf
vi /etc/sysconfig/network-scripts/ifcfg-eth0
vi /etc/nsswitch.conf
最终解决办法:
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
systemctl stop iptables.service #停止iptables
systemctl disable iptables.service #禁止iptables开机启动