Solve connect: network is unreachable Problems

Source: Internet
Author: User

Solve connect: network is unreachable Problems

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 defaultgw 192.168.1.1

That is your gateway.

Now route
Kernel IP routing table
Destination Gateway Genmask Flags Metric RefUse Iface
192.168.1.0*255.255.255.0 U 000 eth0
Default my. router 0.0.0.0 UG000 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 gateway192.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.