Ifconfig only lo and no eth0 solution

Source: Internet
Author: User

CentOS Virtual Machine ping www.baidu.com prompt to find unknown host, a check is not set IP on the virtual machine next to my DNS is not.

The command settings are as follows:

1. Enter Ifconfig to see if there is any information for lo and eth0,

One: If you only have lo, you need to manually create the eth0.

Second: If you have eth0, manually modify his parameters.

2. First, create the parameters we need by naming them.

Vi/etc/sysconfig/network-scripts/ifcfg-eth0,

I, enter the Insert edit mode, the specific parameters are set as follows:

Device=eth0

Bootproto=none (can also be set to static IP address)

Onboot=yes

Type=ethernet

netmask= Subnet Mask

Ipaddr=ip No.

Userctl=no

Ipv6init=no

Peerdns=yes

gateway= Gateway (consistent with the gateway on your machine)

ESC, exiting edit mode

shift+:wq! Save and Exit commands

3.ifconfig-a to see if it takes effect.

4.service network restart, Web server restart

5.ping +ip (IP set by virtual machine), prompt success

6.ping + Gateway, prompted as follows, on behalf of our set or there is a problem




7. Manually set up DNS with the following command

vi/etc/resolv.conf;

I, enter insert mode, set as follows:

nameserver=8.8.8.8 (This is the Google default setting, of course you can set the same as the DNS on your machine)

ESC, exit edit mode;

shift+:wq! Save and Exit commands

8.service network restart, Web server restart

9.ping + Gateway, if not, you need to detect your virtual machine network settings. If NAT is selected by default, the bridge mode is changed.


10. After Setup, reboot your virtual machine, ping+ Gateway, PING+IP should be successful

11.ping+www.baidu.com appears as follows, which means the setup was successful ~




Ifconfig only lo and no eth0 solution

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.