DNS problem: Ping Unknown host workaround

Source: Internet
Author: User

[Root@localhost ~]# Ping www.baidu.com

Prompt Ping:unknown Host

This is because the DNS server is not configured, and if the network is not a problem, you can follow these steps to check:

1) vi/etc/resolv.conf

Add to

NameServer 192.168.59.2 Native gateway address (router address)

Search Localdomain # Search parameter Specify the search order for the domain name

2) Set up the gateway

Vi/etc/sysconf/network-scripts/ifcfg-eth0

Add to

gateway=192.168.59.2

Or

Using command settings

Route add default GW 192.168.59.2

Then restart the Network service:

Service Network restart

3 ensure available DNS resolution

[Root@localhost desktop]# grep hosts/etc/nsswitch.conf

Output

Hosts:files DNS

The file/etc/nsswith.conf is an extended name server switch developed by Sun. Used to set the order in which files are read, whether to read the/etc/hosts file first or to find the DNS server first.

Hosts:files DNS Specifies to find the/etc/hosts file first, and if it fails, to the DNS server to find the host information that corresponds to the domain name.

4) Test DNS

Ping www.baidu.com

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Servers/DNS/

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.