2018-03-12 Linux 宅必备
[root@WProAP-TESTLICENSE ~]# ifconfig -a | grep -i --color hwaddr
eth0 Link encap:Ethernet HWaddr 00:18:FE:26:CB:A2
新建udev绑定文件,如已存在该文件则在上面修改
注意先备份文件
# vi /etc/udev/rules.d/70-persistent-net.rules
# PCI device 0x14e4:0x1680 (tg3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="b8:ac:6f:65:31:e5", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
reboot
注意:该变更在重启后失效,如需固定需要在/etc/rc.d/rc.local文件中放入该命令
ifconfig ethX down
ifconfig ethX hw ether aa:bb:cc:dd:ee:ff
ifconfig ethX up
或者
ip set link dev ethX brd aa:bb:cc:dd:ee:ff
https://www.cyberciti.biz/faq/howto-linux-rename-ethernet-devices-named-using-udev/