Solve the ping failure problem of centos 6.7 ping: unknown host on the Internet

Source: Internet
Author: User

Solve the ping failure problem of centos 6.7 ping: unknown host on the Internet
1. confirm that the NIC settings are correct.

vim /etc/sysconfig/network-scripts/ifcfg-eth*

The IP address must be in the same CIDR block as the gateway. For a virtual machine, make sure that the virtual machine ip address gateway and Host ip address are in the same network segment.

2. Check whether the route settings are correct.

After the first step is correct, the virtual machine can ping the host and the gateway can also ping the host. At this time, you can use the route-n command to view the system's route settings. For example, if my eth0 IP address is 192.168.0.100 and the gateway is 192.168.0.1, you should have a route set to any address connected to the Internet:

Kernel IP routing tableDestination     Gateway         Genmask         Flags Metric Ref    Use Iface0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth0

Destination indicates that the Destination address 0.0.0.0 represents any address (if you have special requirements, you can set it yourself. Here, we only use any address as an example) Gateway indicates the Gateway, Iface indicates the NIC used by the Destination address, you can learn the route command by yourself.

3. Check whether iptables (firewall) is correctly configured.

Firewall knowledge is not explained here. If your machine does not have security requirements, you can disable the firewall.

service iptables stop
4. Set the dns server
vim etc/resolv.conf

Add the following content

nameserver 8.8.8.8

Related Article

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.