在 linux 下如何變更 ethX 為 ethY?

有時候變更網路卡的時候,eth0會變成ethX。看起來其實蠻礙眼!還是想把ethX還原成eth0。所以就要編輯下列檔案

# vi /etc/udev/rules.d/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 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:xx:xx:xx", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:xx:xx:xx", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

含後重新開機一下就搞定.