About CONNECT: network is unreachable

Source: Internet
Author: User

The original article is reproduced without being signed and its source. I will indicate the author and source at the beginning of all original articles in the future.

I hope that my friends will mark the author and source of the original blog post in the future.

Author: liukun321 (cool)

Source: http://blog.csdn.net/liukun321

Some netizens found that the ping command encountered the "Connect: network is unreachable" problem.

This is usually because the IP address is not set correctly.

Solution:

Check whether the NIC Driver is complete and the NIC Driver is compiled into the kernel.

Ls/etc/sysconfig/network-script/ifcfg-eth0

1. Check whether the ifcfg-eth0 file exists in the above directory, if there is, follow the steps below:

1. manually configure the IP address to see if it can be configured
Ifconfig eth0 172.18.128.143 netmask 255.255.255.0 broadcast 172.18.128.255
Route add default GW 172.18.128.1 (the same network segment may not be used)

Or

Directly edit VI/etc/sysconfig/network-scripts/ifcfg-eth0

2. Service Network restart

 

2. If there is no ifcfg-eth0, this file does not even exist under the/etc/sysconfig Directory Network-script directory, then you need to create this directory and create ifcfg-eth0

The ifcfg-eth0 file content is as follows:

You only need to modify the device hwaddr netmask ipaddr items as needed.

Then the service network restart

Ping it and try again.

If you ping a WAN instead of a LAN, make sure that the gateway and DNS settings are correct.

You can set the gateway according to the following steps.

This command can be done.
Route add default GW 192.168.1.1

That is your gateway.

Now Route
Kernel IP routing table
Destination gateway genmask flags metric ref use iface
192.168.1.0*255.255.255.0 u 0 0 0 eth0
Default my. Router 0.0.0.0 ug 0 0 0 eth0

If it is not added before, only the first one is shown above. The second is newly added.
If you still cannot access it, your situation may be a bit special.

In this way, it will be unavailable after restart.
Modify
Edit/etc/Network/interfaces
Add gateway 192.168.1.1

DNS records are in the resolv. conf file under/etc. You can modify DNS in the format of resolv. conf. Create one without resolv. conf.

Then the service network restart

Ping.

 

 

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.