VirtualBox复制虚拟机后,发现新的虚拟机网卡启动不了。
ifconfig -a ...没有看到eth0.。然后重启网卡又报下面错误。
故障现象:
service network restart
Shutting down loopback insterface: [ OK ]
Bringing up loopback insterface: [ OK ]
Bringing up interface eth0: Device eth0 does not seem to be present, delaying initialization. [FAILED]
修改配置文件:vi /etc/udev/rules.d/70-persistent-net.rules
vi 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:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:48:20:62", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:c2:0c:25", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
发现有两个网卡,etho和eth1,并且两个MAC地址也不一样,实际上并没有eth1网卡。
处理方法:
1、删除或生命名这个文件:70-persistent-net.rules
2、Ifconfig –a 查看mac
3、修改网卡配置文件中的HWADDR为ipcofnig –a 看到的MAC地址
[root@namenode1 rules.d]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=08:00:27:C2:0C:25
TYPE=Ethernet
UUID=048c738b-8b3a-4deb-9478-e17c760b92bd
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.1.139
MASK=255.255.255.0
GATEWAY=192.168.1.1
重启系统,reboot –h now
重启后,查看文件70-persistent-net.rules
[root@namenode1 rules.d]# vi 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:0x100e (e1000) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:c2:0c:25", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0
只有一个etho,正常。