Talking about the problem that Linux virtual machine can't recognize network card and can't surf the internet

Source: Internet
Author: User

The phenomenon that occurs:

[Email protected] net]# ifconfig

Lo Link encap:local Loopback

inet addr:127.0.0.1 mask:255.0.0.0

Inet6 addr::: 1/128 scope:host

Up LOOPBACK RUNNING mtu:16436 metric:1

RX packets:4 errors:0 dropped:0 overruns:0 frame:0

TX packets:4 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:252 (252.0 b) TX bytes:252 (252.0 b)


1. The first thing to do is to set up the virtual machine as a bridging mode, so that the virtual machine can share the network to surf the Internet and stop the virtual device in the real machine, set the method: Control Panel----Change the adapter settings----Disable the device that starts with "V", and if there is still no IP, proceed as follows.


2. In the virtual machine to view the current MAC address, such as:00:0c:29:1c:48:30 , this Mac is the Mac you want to load, normally eth0, but not necessarily eth0, if not a graphical interface, you can use the command to view

#查看网卡是否加载驱动, if there is no driver, additional driver installation is required

[Email protected] eth3]# DMESG |grep-i eth

e1000 0000:02:01.0:eth0: (pci:66mhz:32-bit) 00:0c:29:1c:48:30

e1000 0000:02:01.0:eth0:intel (R) pro/1000 Network Connection

e1000 0000:02:04.0:eth1: (pci:66mhz:32-bit) 00:0c:29:1c:48:3a

e1000 0000:02:04.0:eth1:intel (R) pro/1000 Network Connection

Udev:renamed network interface eth0 to Eth3

Udev:renamed network interface eth1 to Eth4

E1000:eth3 NIC Link is up to + Mbps full Duplex, Flow Control:none

Eth3:no IPV6 Routers present

#从以上信息可以看出eth3正在工作, you need to modify the ETH0 network card configuration information, corresponding to Eth3


#进入目录查看mac对应的是eth几

[Email protected] ~]# cd/sys/class/net

[[email protected] net]# ls

Eth3 Lo

#注意这里是eth几, the configuration file to be modified later is the ETH

[Email protected] net]# CD eth3/

[[email protected] eth3]# ls

Address

[email protected] eth3]# cat Address

00:0c:29:1c:48:30 #这个mac地址就是真正的mac地址


3. Modify the NIC configuration information

#修改ifcfg-eth0

[Email protected] ~]# cd/etc/sysconfig/network-scripts/

[[email protected] network-scripts]# ls

Ifcfg-eth0

#注意, there may be eth1 or eth2, etc., just modify one, the remainder of the ETH config file is deleted,

#注意, Ifcfg-lo and the rest of the directories cannot be deleted

#先把eth0更名为eth3 (/sys/class/net is a few of the ETH, just write the ETH)

[Email protected] network-scripts]# mv Ifcfg-eth0 ifcfg-eth3

#查看信息

[email protected] network-scripts]# cat Ifcfg-eth3

Device=eth0

Bootproto=dhcp

Hwaddr=00:0c:29:fa:ed:77

Ipv6init=yes

Nm_controlled=yes

Onboot=no

Type=ethernet

Uuid= "Dde10f3b-43be-4016-85fd-215aedf35a70"

Userctl=no

dns1=202.106.0.20

Peerdns=yes


#修改如下

[Email protected] network-scripts]# VI ifcfg-eth0

#删除HWADDR和UUID

#把ONBOOT值改成yes

#DEVICE的值根据/sys/class/net is the ETH, just write ETH.

Device=eth3

Bootproto=dhcp

Ipv6init=yes

Nm_controlled=yes

Onboot=yes

Type=ethernet

Userctl=no

dns1=202.106.0.20

Peerdns=yes

#保存退出


#修改70-persistent-net.rules

[Email protected] network-scripts]# cd/etc/udev/rules.d/

[[email protected] rules.d]# ls

60-raw.rules 70-persistent-cd.rules 70-persistent-net.rules

#编辑

[Email protected] rules.d]# VI 70-persistent-net.rules


# PCI Device 0x8086:0x100f (e1000)

subsystem== "NET", action== "Add", drivers== "? *", attr{address}=="00:0c:29:1c:48:30", attr{type}== "1", kernel== "eth*", name= "Eth3 "


#注意, remove the redundant PCI device configuration information, leave the same line as the MAC address, and change the name


4. Restart the service

[Email protected] rules.d]# Service Network Restart

Determining IP information for eth3 ... done.

#当你看到都ok的时候, Congratulations, IP is there!

#如果没有成功, please re-check the above steps, must be misconfigured, be sure to pay attention to the corresponding relationship between Mac and ETH.

#如笔者之前的eth0的mac地址是00:0c:29:1c:48:30, and Eth1 's MAC address is 00:0c:29:1c:48:3a, only one bit, so be sure to check carefully.

Talking about the problem that Linux virtual machine can't recognize network card and can't surf the internet

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.