udev is renaming my ethernet devices

一台 HP 的 centos 6 机器,原来有 onboard 的 Broadcom 网卡在 eth2/eth3,另外还有一张另外加上的 intel 82576 网卡 eth0/eth1。最近更换了那张 intel 卡,另外还再加多了一张同样的 intel 网卡。但是发现 dmesg 老是出现 udev: renamed network interface ethx to renamey 的字眼。通过 /etc/modprobe.d/igb.conf 配置文件也无法指定对应的 intel 卡 到 eth0-eth3 上。

[root@rtploadtest rtp_loadtest]# cat /etc/modprobe.d/igb.conf
# alias eth0 igb
# alias eth1 igb
# alias eth4 igb
# alias eth5 igb
options igb RSS=0,0


[root@rtploadtest rtp_loadtest]# dmesg | grep rename
udev: renamed network interface eth3 to rename5
udev: renamed network interface eth2 to rename4
udev: renamed network interface eth1 to eth5
udev: renamed network interface rename5 to eth1
udev: renamed network interface eth0 to eth4
udev: renamed network interface rename4 to eth0
[root@rtploadtest rtp_loadtest]# 



google 一把后才发现和 udev 有关

/etc/udev/rules.d/70-persistent-net.rules 按照卡的 MAC 地址将它映射到对应的 ethx 上。即使其中的一个卡或者MAC已经不见了,udev 还是会将这个映射保留。编辑这个文件就可以得到你需要的效果。

[root@rtploadtest rules.d]# 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, and change only the value of the NAME= key.

# PCI device 0x8086:0x10c9 (igb) (custom name provided by external tool)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1b:21:cf:ad:fd", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x14e4:0x164c (bnx2) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:23:7d:33:4d:02", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"

# PCI device 0x8086:0x10c9 (igb) (custom name provided by external tool)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1b:21:cf:ad:fc", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x14e4:0x164c (bnx2) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:23:7d:33:4d:12", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

# PCI device 0x8086:0x10c9 (igb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1b:21:d6:9f:64", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x10c9 (igb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1b:21:d6:9e:45", ATTR{type}=="1", KERNEL=="eth*", NAME="eth5"

# PCI device 0x8086:0x10c9 (igb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1b:21:d6:9e:44", ATTR{type}=="1", KERNEL=="eth*", NAME="eth4"

# PCI device 0x8086:0x10c9 (igb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1b:21:d6:9f:65", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
[root@rtploadtest rules.d]# 


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值