简体   繁体   中英

Linux centos : ping displays unknown host for any domain name

Ping displays unknown host for any domain name.

It worked before this time true!!

Ping works for ip address but fails for domain names.

Can any one help me?

Check what's in /etc/resolv.conf . If there is no "nameserver" specified, you have to do that in order to resolve domains. Example:

nameserver dns1.domainname.com
nameserver dns2.domainname.com

or you can use Google's public DNS servers:

nameserver 8.8.8.8   
nameserver 8.8.4.4

(1) edit /etc/resolv.conf, add

nameserver dns1.domainname.com

nameserver dns2.domainname.com

(2) another reason may due to /etc/nsswitch.conf

add dns in the hosts: xxx

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM