1. Problem description
When executing ping www.baidu.com
the command, the ping fails and an error is reported:
[root@bigdata111 ~]# ping www.baidu.com
ping: unknown host www.baidu.com
In the case that other configurations are normal and the machine can be pinged through, this situation must be a DNS configuration problem. Next, check the DNS configuration file (resolv.conf)
command:
[root@bigdata111 ~]# vi /etc/resolv.conf
文件内容如下:
# Generated by NetworkManager
nameserver 8.8.8.8
修改为:
# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 8.8.4.4
After saving and exiting successfully, restart the network:
[root@bigdata112 ~]# service network restart
Restarting network (via systemctl): [ 确定 ]
Continue command: ping www.baidu.com
Still can't ping through.
Check the DNS configuration file (resolv.conf) again, and find that the DNS configuration has disappeared inexplicably.
Two, the solution
Execute the following commands in sequence:
chkconfig NetworkManager off
chkconfig network on
service NetworkManager stop
service network start
service network restart
Reconfigure DNS again
[root@bigdata111 ~]# vi /etc/resolv.conf
配置内容如下:
# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 8.8.4.4
After restarting the network, check that the DNS configuration file is still there, and it did not disappear inexplicably this time.
Execute the ping command again and find that it can be pinged
Problem solved perfectly! ! !