LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 600|回复: 2

把LFS复制到另一台主机上,网卡识别问题

[复制链接]
发表于 2012-1-14 23:16:34 | 显示全部楼层 |阅读模式
我在宿舍电脑用vbox虚拟机(记为V1)完成了LFS6.8的制作,然后我把所有文件打包起来,通过SSH的方式,把这个包解压到家里机器的虚拟机(记为V2)上,重新安装了grub,可以正常启动,但启动的过程中提示说没有eth0这个设备,大概是V1上的网卡的MAC与V2上的MAC不同,然后我把/etc/udev/rules.d/70-persistent-net.rules删掉,重新再生成一个,结果是
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:fd:5a:1c", ATTR{dev_id}=="0x0", ATTR
    {type}=="1", KERNEL=="eth*", NAME="eth1"

V2上的网卡被命名为了eth1,但为什么不是eth0,还需要做什么修改才会变回eth0呢? 因为有一些自定的脚本用了eth0这个名字,不想逐个改,请问有什么方法可以使用系统把现在V2的网卡识别为eth0。我查看过/sys上的目录,在/sys/class/net里也只有eth1和lo还有sit0目录。
发表于 2012-1-16 09:41:21 | 显示全部楼层
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:fd:5a:1c", ATTR{dev_id}=="0x0", ATTR
{type}=="1", KERNEL=="eth*", NAME="eth1"

把最后的eth1改为eth0就可以了吧?
回复 支持 反对

使用道具 举报

发表于 2012-1-16 09:43:41 | 显示全部楼层

http://www.linuxfromscratch.org/lfs/view/stable/chapter07/network.html

All Udev rules are made up of several keys, separated by commas and optional whitespace. This rule's keys and an explanation of each of them are as follows:

SUBSYSTEM=="net" - This tells Udev to ignore devices that are not network cards.

ACTION=="add" - This tells Udev to ignore this rule for a uevent that isn't an add ("remove" and "change" uevents also happen, but don't need to rename network interfaces).

DRIVERS=="?*" - This exists so that Udev will ignore VLAN or bridge sub-interfaces (because these sub-interfaces do not have drivers). These sub-interfaces are skipped because the name that would be assigned would collide with their parent devices.

ATTR{address} - The value of this key is the NIC's MAC address.

ATTR{type}=="1" - This ensures the rule only matches the primary interface in the case of certain wireless drivers, which create multiple virtual interfaces. The secondary interfaces are skipped for the same reason that VLAN and bridge sub-interfaces are skipped: there would be a name collision otherwise.

KERNEL=="eth*" - This key was added to the Udev rule generator to handle machines that have multiple network interfaces, all with the same MAC address (the PS3 is one such machine). If the independent interfaces have different basenames, this key will allow Udev to tell them apart. This is generally not necessary for most Linux From Scratch users, but does not hurt.

NAME - The value of this key is the name that Udev will assign to this interface.

The value of NAME is the important part. Make sure you know which name has been assigned to each of your network cards before proceeding, and be sure to use that NAME value when creating your configuration files below.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表