linux网卡名称修改
vim /etc/sysconfig/grub ,在倒数第二行添加如下代码
net.ifnames=0 biosdevname=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=centos/root rd.lvm.lv=centos/swap rhgb quiet net.ifnames=0 biosdevname=0" GRUB_DISABLE_RECOVERY="true"
执行命令 grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-mkconfig -o /boot/grub2/grub.cfg
[root@centos2 /etc/sysconfig]grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-3.10.0-957.27.2.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-957.27.2.el7.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-862.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-862.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-e1b070e76db146fbb48e981539ac34c6 Found initrd image: /boot/initramfs-0-rescue-e1b070e76db146fbb48e981539ac34c6.img done
重命名网卡名称
mv ifcfg-ens33 ifcfg-eth0
vim ifcfg-eth0 DEVICE改为eth0
重启服务器查看网卡名称是否改变