Ping: unknown host solution

Source: Internet
Author: User
Tags domain name server nameserver

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.