今天安装某个东西的时候发现下载失败,于是就有了下面的情况
[root@localhost ~]# ping baidu.com ping: unknown host baidu.com
它说连接不到主机,首先确认一下网关。
[root@localhost ~]# ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=2 ttl=128 time=54.0 ms 64 bytes from 8.8.8.8: icmp_seq=3 ttl=128 time=53.6 ms 64 bytes from 8.8.8.8: icmp_seq=4 ttl=128 time=62.5 ms 64 bytes from 8.8.8.8: icmp_seq=5 ttl=128 time=56.8 ms
联网没有问题,确认一下域名,和服务器的配置文件[root@localhost etc]# vim /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.com ############## 我的竟然没有下面的配置信息,所以出问题。将下面的信息补全就OK啦 ######### domain localdomain search localdomain nameserver 192.168.25.2