Ping: unknown host solution if the ping command returns the following error, the primary possibility is that the system's DNS settings are incorrect. [Cpp] [root @ CentOS5 ~] # Ping www.sina.com.cn ping: unknown host www.sina.com.cn can be solved through the following method. This method has been verified in linux and solaris systems. 1) if the Domain Name Server is not set, we recommend that you set the public DNS service for Google. It should not cause any problems [cpp] # cat/etc/resolv. conf modify nameserver 8.8.8.8 nameserver 8.8.4.4 ------------------------------------------------------------- 2) ensure that the route table is normal [cpp] [root @ CentOS5 ~] # Netstat-rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 192.168.128.0 0.0.0.0 255.u 0 0 0 eth0 255.0.0.0.0 255.255.0.0 U 0 0 0 eth0 0.0.0.0 255.0.0.0.0 UG 0 0 0 0 if not, add the gateway in the following way: [cpp] # route add default gw 192.168.128.2 3) ensure that dns resolution is available (this step is often forgotten) [cpp] # grep hosts/etc/nsswitch. conf -------------------------------------------------- ----------------- Hosts: files dns ------------------------------------------------------------------- note that the above configuration must be added with dns. The following is the dns configuration. Hosts: dns files indicates that the/etc/hosts file hosts is used only when DNS fails. dns indicates that only the host: files of the/etc/hosts file is used for DNS resolution. hosts: files dns uses the/etc/hosts file to resolve the host, indicating that DNS will be used if the host cannot be resolved.