cd /etc/sysconfig/network-scripts/
将要改名的网卡配置文件重命名,例如
mv ifcfg-eth1 ifcfg-eth0
vim ifcfg-eth0 修改device和name字段为 eth0,其他参数不变
DEVICE="eth0"
NAME="eth0"
vim /etc/default/grub,添加 net.ifnames=0 biosdevname=0 参数,如下所示
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=VolGroup/lv_root net.ifnames=0 biosdevname=0 rd.lvm.lv=VolGroup/lv_swap rhgb quiet"
重新加载配置
grub2-mkconfig -o /boot/grub2/grub.cfg
vim /usr/lib/udev/rules.d/60-net.rules 注释原来的行,添加如下行,注意名称和mac地址要对应上
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="f4:8e:38:b9:75:d8", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:e0:4c:6a:b2:6a", NAME="eth1"
重启机器