-
ping: unknown host解决办法如果ping命令返回如下错误,那主要的可能性就是 系统的DNS设置有误。[cpp][root@CentOS5 ~]# ping www.sina.com.cnping: unknown host www.sina.com.cn可以通过如下方法来解决,此方法已经在linux和solaris系统下通过验证。1) 确定设置了域名服务器没有的话, 建议设置Google的公共DNS服务, 它应该不会出问题的# cat /etc/resolv.conf-------------------------------------------------------------------nameserver 8.8.8.8nameserver 8.8.4.4-------------------------------------------------------------------2) 确保由表正常[root@CentOS5 ~]# netstat -rnKernel IP routing tableDestination Gateway Genmask Flags MSS Window irtt Iface192.168.128.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth00.0.0.0 192.168.128.2 0.0.0.0 UG 0 0 0 eth0如果未设置, 则通过如下方式增加网关:# route add default gw 192.168.128.23) 确保可用dns解析(这步常忘了)[cpp]# grep hosts /etc/nsswitch.conf-------------------------------------------------------------------hosts: files dns-------------------------------------------------------------------注意,上面的配置要加上dns。以下是dns的配置,备忘。hosts: dns files表示只在DNS失效时候才使用/etc/hosts文件hosts: dns表示只用DNS解析主host: files表示只用/etc/hosts文件解析主机hosts: files dns将使用/etc/hosts文件解析主机,表示如果无法解析主机名将使用DNS。
ping: unknown host解决办法
最新推荐文章于 2023-10-19 17:13:05 发布