Device eth0 (vmware 拷贝引起)

虚拟机中安装了centos,但是我拷贝了一份想两个一起用。网卡总是起不来,报了这么一个错误:

Device eth0 does not seem to be present, delaying initialization

意思看懂了,原因也能猜个差不多,大概就是因为拷贝虚拟机拷贝的网卡信息是一样的,解决我就不会了,google了一下。

我是这样解决的:

1、将/etc/udev/rules.d/70-persistent-net.rules 改名字,重启虚拟机。

此时机器自己重新生成 /etc/udev/rules.d/70-persistent-net.rules 文件,内容如下:
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:50:bd:1
7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"


这里只有eth1这块网卡的信息主要是MAC信息

看完的得记住

2、改网卡的文件名字。

mv /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1

我之前的网卡名字是eth0,现在是eth1这块网卡了。所以把ifcfg-eth0 改为ifcfg-eth1.

3、编辑/etc/sysconfig/network-scripts/ifcfg-eth1

 

DEVICE="eth1" #改网卡代号

BOOTPROTO=dhcp

HWADDR="00:0C:29:50:bd:17" #改成刚才看见的MAC地址

NM_CONTROLLED="yes"

ONBOOT="yes"


OK了。

service network restart 就好了。

你可能感兴趣的:(linux)