虚拟机网卡与配置文件不匹配 Device eth0 does not seem to bepresent

安装虚拟机并复制之后,面临一个问题就是MAC的变更。

当Vmware第一次打开复制虚拟机的时候,会询问你虚拟机来源 

如果你选择 I Copy It 那么虚拟机会自动帮你变更MAC地址。

或者你可以自己手工变更MAC地址



此时就会发现ifconfig与 /etc/sysconfig/network-scripts/中配置文件无法对应的情况。


[root@localhost ~]# ifconfig 
eth1      Link encap:Ethernet  HWaddr 00:0C:29:07:92:17  
          inet addr:192.168.2.108  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe77:9217/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:313 errors:0 dropped:0 overruns:0 frame:0
          TX packets:105 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:36840 (35.9 KiB)  TX bytes:15389 (15.0 KiB)
查看配置文件

[root@localhost ~]# ll /etc/sysconfig/network-scripts/ifcfg-*
-rw-r--r--. 3 root root 286 Oct 27 17:49 /etc/sysconfig/network-scripts/ifcfg-eth0
-rw-r--r--. 1 root root 254 Apr 27  2012 /etc/sysconfig/network-scripts/ifcfg-lo


原因在于redhat6 在发现MAC地址变动后在udev配置文件中自动增加一条配置信息


[root@localhost ~]# cat /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 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:07:92:17", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:07:92:17", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"


问题就出现在这里。

此时只需要

1 删除带有旧的MAC地址的配置

2 讲带有新MC地址的配置文件后NAME修改为eth0

3 重新初始化UDEV start_udev

4 重启网络service network restart

就可以了。。




你可能感兴趣的:(虚拟机网卡与配置文件不匹配 Device eth0 does not seem to bepresent)