Solution to ping Baidu in Linux

Source: Internet
Author: User
Tags nameserver

Solution to ping Baidu in Linux

I encountered a problem when I learned about DNS today. My virtual machine can ping the IP address but cannot ping www.baidu.com www.qq.com or other domain names. First, the following error occurs:

After several hours, I finally found a solution.

1. Check whether the virtual machine can ping the Internet. You can ping the gateway.

ping 172.17.0.1
[Plain] view plaincopy
2. Make sure that the gateway is configured

[Plain] view plaincopy
Vim/etc/sysconfig/network-scripts/ifcfg-eth1
[Plain] view plaincopy
GATEWAY = 172.17.0.1

DNS1 = 172.17.0.1

After the modification, You need to restart the network service. Centos6:

Service network restart

3. Make sure there are available domain name servers

Cat/etc/resolv. conf

If not, edit one by yourself.

[Plain] view plaincopy
Vim/etc/resolv. conf

Nameserver 172.17.0.1

Nameserver 114.114.114.114

In this case, there is no problem.

But I still encountered a problem.

It should still be a network problem. I restarted the network service, but it still doesn't work.

So I checked the route table and found that a default route record is missing.

Add a route record.

Failed to add

We had to clear the path with records

Restart the network service, add the default route, and then parse the address.

.

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.