上個月有臺RedHat服務器更換網卡,編譯、安裝驅動後 service network restart。提示更換的網卡不存在。ifconfig -a 發現有三個網卡: eth0 eth1 eth2。
vi /etc/udev/rules.d/70-persistent-net.rules
把沒用的網卡(8139too)信息刪除或註釋掉,再修改新網卡(r8169)參數NAME="eth2"
例子:
[root@smalarm 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:0x1502 (e1000e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="f8:b1:56:xx:xx:xx", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x10ec:0x8139 (8139too)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:e0:4c:xx:xx:xx", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x10ec:0x8168 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:e0:4d:xx:xx:xx", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"