ip a
记下网卡名称和对应的MAC
sudo vi /etc/udev/rules.d/70-persistent-net.rules
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:62:38:1b", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:62:38:25", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:62:38:2f", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
上面表示有3张网卡,分别是eth0、eth1、eth2,按照他们的 MAC 来修改名称,修改后必须重启系统,使用 /etc/init.d/networking restart 重启网络是不行的。