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