现在的位置: 首页 > 综合 > 正文

ubuntu下修改网卡名称

2013年06月11日 ⁄ 综合 ⁄ 共 1373字 ⁄ 字号 评论关闭

修改/etc/udev/rules.d中的配置文件,根据不同人的电脑那个数是不一样的,在我的机器中是70-persistent-net.rules这个名字,用文本工具打开后看到里面包含如下语句:

  # PCI device 0x10de:0x054c (forcedeth)

  SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="*", NAME="eth0"

  这一段话可能在这个配置文件中出现多次,我们删除所有的NAME不是“eth0”的,然后按照我红色字的部分把原来的mac地址改为“*”号,这样以后启动计算机机器的网卡设备名就不会再变来变去了。

  按照这个方式你也可以把网卡设备名称改为你喜欢的。

# This file maintains persistent names for network interfaces.
# See udev(7) for syntax.
#
# Entries are automatically added by the 75-persistent-net-generator.rules
# file; however you are also free to add your own entries.

# PCI device 0x10ec:0x8167 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1c:c4:84:db:ff", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x1106:0x3106 (via-rhine)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:40:05:46:69:f2", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x10ec:0x8169 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1d:0f:20:23:11", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

# PCI device 0x10ec:0x8139 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:16:17:2b:84:4e", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"

# PCI device 0x10ec:0x8167 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1b:78:a5:1e:9e", ATTR{type}=="1", KERNEL=="eth*", NAME="eth4"

可以查找你的网卡mac地址后,定义一下NAME= 多少就行了

====

http://hi.baidu.com/hanovo/blog/item/fbb81a300d60d19fa9018ea8.html

抱歉!评论已关闭.