CentOS Ping:unknown Host Solution

Source: Internet
Author: User
Tags domain name server nameserver


If a Linux (CentOS) server pings the domain name, follow these tips:
# ping Www.sina.com
Ping:unknown Host Www.sina.com

To confirm that the network is not a problem, you can find a solution by following these steps:
1) Confirm that the domain name server is set up

 

# Cat/etc/resolv.conf
NameServer 8.8.8.8  # (Public DNS service for Google)
  nameserver 8.8.4.4  < Span style= "FONT-FAMILY:SIMSUN; font-size:14px; line-height:21px; " >  # (Public DNS service for Google)


2) Confirm that the gateway is set/confirm that the routing table is OK

# NETSTAT-RN
Kernel IP Routing Table
Destination Gateway genmask Flags MSS Window Irtt Iface
0.0.0.0 10.10.10.1 0.0.0.0 UG 0 0 0 eth0

If it is not set, the gateway is increased in the following ways:
# route add default GW 10.245.75.1

# grep gateway/etc/sysconfig/network-scripts/ifcfg*
/etc/sysconfig/network-scripts/ifcfg-eth0:gateway=10.245.75.1

3) Confirm available DNS resolution

# grep hosts/etc/nsswitch.conf
HostsFiles DNS


Above 1) 2) 3) point just to confirm the problem, the individual likes to write the configuration file manually, solve the problem at once.
After configuring the/etc/sysconfig/network-scripts/ifcfg-eth0 file, restart the network service:
Vim/etc/sysconfig/network-scripts/ifcfg-eth0
Device= "Eth0"
Nm_controlled= "Yes"
Onboot=yes
Type=ethernet
Bootproto=static
ipaddr=10.245.75.240
#PREFIX =24
gateway=10.245.75.1
dns1=8.8.8.8
dns2=8.8.4.4
Defroute=yes
Ipv4_failure_fatal=yes
Ipv6init=yes
Name= "System eth0"
UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX # UUID
Hwaddr=xx:xx:xx:xx:xx:xx# HWADDR
Networking=yes

# Service Network restart

CentOS Ping:unknown Host Solution

Related Article

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.