Linux server ping does not pass domain name

Source: Internet
Author: User
Tags domain name server

2014-09-06

When the Linux server ping does not pass the domain name, the following prompt appears:
[[email protected] ~]# Ping www.baidu.com
Ping:unknown Host Www.baidu.com

1. Network detection
First determine that the router is connected and the router has access to the extranet, which can be determined by accessing the gateway
[[email protected] ~]# Ping 192.168.2.251
PING 192.168.2.251 (192.168.2.251) bytes of data.
Bytes from 192.168.1.1:icmp_seq=1 ttl=64 time=2.96 ms


If you determine that the network is not a problem, you can find a workaround by following these steps:


1) OK set up the domain name server, if not, it is recommended to set up Google's public DNS service, it should not be a problem
[email protected] ~]# vi/etc/resolv.conf
nameserver 192.168.2.251

2) Make sure the gateway is set
# grep gateway/etc/sysconfig/network-scripts/ifcfg*
/etc/sysconfig/network-scripts/ifcfg-eth0:gateway=192.168.2.251

if it is not set, the gateway is increased in the following ways:
# route Add default GW 192.168.2.251
or, after manually writing the/etc/sysconfig/network-scripts/ifcfg* file, restart the network service:
# Service Network Restart


3) ensure available DNS resolution
# grep hosts/etc/nsswitch.conf
Hosts:files DNS

Successful results:
If any of the above problems, after the correction, re-test, should be no problem:
#ping www.baidu.com
PING www.a.shifen.com (220.181.6.175) bytes of data.
Bytes from 220.181.6.175:icmp_seq=0 ttl=50 time=9.51 ms


Linux server ping does not pass domain name

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.