出自:www.win3c.com
今天早上,将前几天在另外一台电脑上建立的虚拟机文件拷贝过来重新打开,系统启动后,发现网卡eth0启动不了!
估计是虚拟机移动之后,虚拟网卡的mac地址发生了变化,所以fc9将旧的网卡eth0变成eth1来启动了,但查看/etc/sysconfig/network-scripts/下面,也没见eth1的配置文件存在,但ifconfig,列出eth1已经启动,并已从dhcp获得ip地址。
经过仔细研究,发现是udev作怪了。发现/etc/udev/rules.d/70-persistent-net.rules这个文件里面有如下记录
引用:[root@kevin ~]# cat 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.
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rule written by anaconda)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:d2:3f:2c", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:87:43:18", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:87:43:22", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:c8:3a:15", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"
这是udev在发现网卡mac变更之后,自动将接口改名的结果。将这个/etc/udev/rules.d/70-persistent-net.rules删除,重启,网卡eth0成功启动,并重新生成/etc/udev/rules.d/70-persistent-net.rules文件。