Chinaunix首页 | 论坛 | 博客
  • 博客访问: 396488
  • 博文数量: 380
  • 博客积分: 75
  • 博客等级: 民兵
  • 技术积分: 1925
  • 用 户 组: 普通用户
  • 注册时间: 2011-09-05 15:35
文章分类

全部博文(380)

文章存档

2014年(1)

2013年(2)

2012年(19)

2011年(358)

我的朋友

分类:

2011-09-05 18:27:43


经常遇到VMware中的Linux虚拟机网卡eth%d不断增加的情况,在这台机器上是eth0,到另外一台机器上运行这台需虚拟机后,网卡可能变成eth1,或者eth2等等。
如何为解决这个问题呢?

先看:
/etc/udev/rules.d/70-persistent-net.rules

这里面记录了下列信息:
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.

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rule written by anaconda)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:46:2c:64", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x1022:0x2000 (vmxnet)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:de:6b:c7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# USB device 0x07d1:0x3c03 (rt73)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:21:91:23:f1:35", ATTR{type}=="1", KERNEL=="rausb*", NAME="rausb0"

# USB device 0x07d1:0x3c03 (rt73usb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:21:91:23:f1:35", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

# PCI device 0x1022:0x2000 (vmxnet)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:89:75:43", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

# PCI device 0x1022:0x2000 (vmxnet)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:d8:2f:71", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"

# PCI device 0x1022:0x2000 (vmxnet)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:8f:e7:a4", ATTR{type}=="1", KERNEL=="eth*", NAME="eth4"

# PCI device 0x1022:0x2000 (vmxnet)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a9:ce:b5", ATTR{type}=="1", KERNEL=="eth*", NAME="eth5"

# PCI device 0x1022:0x2000 (vmxnet)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:56:8c:c2", ATTR{type}=="1", KERNEL=="eth*", NAME="eth6"

# PCI device 0x1022:0x2000 (vmxnet)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:14:c4:80", ATTR{type}=="1", KERNEL=="eth*", NAME="eth7"

# PCI device 0x1022:0x2000 (vmxnet)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:96:1b:6c", ATTR{type}=="1", KERNEL=="eth*", NAME="eth8"

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

# PCI device 0x1022:0x2000 (vmxnet)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:68:96:5e", ATTR{type}=="1", KERNEL=="eth*", NAME="eth10"

# PCI device 0x1022:0x2000 (vmxnet)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:52:cb:bb", ATTR{type}=="1", KERNEL=="eth*", NAME="eth11"

可以看到,这台虚拟机的网卡序号已经到了eth11了,而一般系统中都是eth0,因为如此,所以网卡不能在启动过程中被激活。

解决eth增加的办法,可以删除上面这个文件,重启系统。


这与系统的UUID相关,参考:
 



阅读(396) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~