- 生成系统引导文件
vim /etc/default/grub
GRUB_CMDLINE_LINUX行末添加:net.ifnames=0 biosdevname=0
- 使上面的更改生效
grub2-mkconfig -o /boot/grub2/grub.cfg
Found linux image: /boot/vmlinuz-3.10.0-514.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-514.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-009be6fc3ff745859259fc03fe537a64
Found initrd image: /boot/initramfs-0-rescue-009be6fc3ff745859259fc03fe537a64.img
done
- 查看有没有添加成功
grep linux16 /boot/grub2/grub.cfg
- 把原先的网卡配置文件改名
cd /etc/sysconfig/network-scripts/
mv ifcfg-ens33 ifcfg-eth0
修改配置文件中NAME和DEVICE这两个
- udev对网卡名称绑定
# vi /etc/udev/rules.d/70-persistent-net.rules
新文件添加如下:(ATTR{address}的值:ether 00:0c:29:71:c0:53)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:97:20:ae", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:28:15:82", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
- 重启生效
init 6
ifconfig -a 查看网卡名已经更改成eth0,至此Linux网卡重命名完成。