DNS: ping unknown host Solution

Source: Internet
Author: User

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

Ping: unknown host

This is because the DNS server is not configured properly. If the network is correct, perform the following steps:

1) vi/etc/resolv. conf

Add

Nameserver 192.168.59.2 gateway address of the Local Machine (vro address)

Search localdomain # search parameter specifies the domain name search order

2) set the Gateway

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

Add

GATEWAY = 192.168.59.2

Or

Set using commands

Route add default gw 192.168.59.2

Then restart the network service:

Service network restart

3) make sure DNS resolution is available

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

Output

Hosts: files dns

This file/etc/nsswith. conf is an extended name server switch developed by SUN. It is used to set the order in which files are read. If you want to read the/etc/hosts file first, you must first find the DNS server.

Hosts: files dns specifies to first find the/etc/hosts file. If the file fails, go to the DNS server to find the host information corresponding to the domain name.

4) test DNS

Ping www.centoscn.com


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.