1. vim /etc/sysconfig/grub 编辑/etc/sysconfig/grub文件
添加 net.ifnames=0 biosname=0
GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet net.ifnames=0 biosname=0" #添加
GRUB_DISABLE_RECOVERY="true"
2. grub2-mkconfig -o /boot/grub2/grub.cfg 生成新的grub.cfg文件
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-3.10.0-957.21.3.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-957.21.3.el7.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-957.21.2.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-957.21.2.el7.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-862.14.4.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-862.14.4.el7.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-862.6.3.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-862.6.3.el7.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-862.2.3.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-862.2.3.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-6a40cff497a2412d91bb000f9652139a Found initrd image: /boot/initramfs-0-rescue-6a40cff497a2412d91bb000f9652139a.img
done
3.mv ifcfg-enp3s0 ifcfg-eth0 执行命令 并修改 ifcfg-eth0中DEVICE = enp3s0 为 DEVICE = eth0
4.shutdown -r 0 重启服务验证网卡名称是否为eth0